Пример #1
0
        public List <PersistLogin> Clone()
        {
            var catalog = new PersistLoginCatalog();

            lock (LockObject)
            {
                foreach (var obj in Collection)
                {
                    catalog.Collection.Add(obj.Clone());
                }
            }

            return(catalog.Collection);
        }
Пример #2
0
        public SecurityManager(Core core) : base(core)
        {
            loginCatalogFile = Path.Combine(core.Settings.DataRootPath, Constants.LoginCatalogFile);

            //If the catalog doesnt exist, create a new empty one.
            if (File.Exists(loginCatalogFile) == false)
            {
                Catalog = new PersistLoginCatalog();

                Catalog.Add(new PersistLogin()
                {
                    Name         = "admin",
                    PasswordHash = Library.Utility.HashPassword("")
                });

                Directory.CreateDirectory(core.Settings.DataRootPath);
                core.IO.PutJsonNonTracked(loginCatalogFile, Catalog);
            }

            Catalog = core.IO.GetJsonNonTracked <PersistLoginCatalog>(loginCatalogFile);
        }