Пример #1
0
        public void LoadGenerateDatabase()
        {
            var active = JsonUtils.Load <String>(Path.Combine(DATA_PATH, "app.conf"));

            if (String.IsNullOrEmpty(active))
            {
                return;
            }
            var file = Path.Combine(DATA_PATH, active);

            generateDatabase = JsonUtils.Load <GenerateDatabase>(file);
        }
Пример #2
0
        public void StoreGenerateDatabase()
        {
            var info = Sql.GetConnectInfor();

            generateDatabase          = new GenerateDatabase();
            generateDatabase.Server   = info.DataSource;
            generateDatabase.Database = info.InitialCatalog;
            generateDatabase.Username = info.UserID;
            generateDatabase.Password = info.Password;

            if (!Directory.Exists(DATA_PATH))
            {
                Directory.CreateDirectory(DATA_PATH);
            }
            var fileName = GetFolderSetting(generateDatabase.Server, generateDatabase.Database) + ".conf";
            var file     = Path.Combine(DATA_PATH, fileName);

            JsonUtils.Save(fileName, Path.Combine(DATA_PATH, "app.conf"));
            JsonUtils.Save(generateDatabase, file);
        }