예제 #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     if (File.Exists(Settings.Default["xml_filename"].ToString()))
     {
         if (new FileInfo(Settings.Default["xml_filename"].ToString()).Length != 0)
         {
             ConfigDao.Load(Settings.Default["xml_filename"].ToString());
             LoadXMLToListbox();
             LoadXMLAccountsToComboBox();
         }
         else
         {
             CreateDefaultXMLConfFile();
             LoadXMLToListbox();
             LoadXMLAccountsToComboBox();
         }
     }
     else
     {
         CreateDefaultXMLConfFile();
         LoadXMLToListbox();
         LoadXMLAccountsToComboBox();
     }
     checkBox1.Checked = Settings.Default.clear_cache;
     checkBox2.Checked = Settings.Default.auto_account_login;
 }
예제 #2
0
        public object Do_UpdateConfig(BaseApi baseApi)
        {
            UpdateConfigParam updateConfigParam = JsonConvert.DeserializeObject <UpdateConfigParam>(baseApi.param.ToString());

            if (updateConfigParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }

            ConfigDao configDao = new ConfigDao();
            var       list      = configDao.GetConfigList(updateConfigParam.env, updateConfigParam.group);

            if (list.Count > 0)
            {
                if (!Global.ConfigList.ContainsKey(updateConfigParam.env))
                {
                    Global.ConfigList.Add(updateConfigParam.env, new Dictionary <string, ConfigGroup>());
                }

                if (!Global.ConfigList[updateConfigParam.env].ContainsKey(updateConfigParam.group))
                {
                    Global.ConfigList[updateConfigParam.env].Add(updateConfigParam.group, new ConfigGroup(updateConfigParam.group));
                }

                Global.ConfigList[updateConfigParam.env][updateConfigParam.group].list = list;

                topic(updateConfigParam.env, updateConfigParam.group);
                return(Global.ConfigList[updateConfigParam.env][updateConfigParam.group]);
            }

            throw new ApiException(CodeMessage.InvalidEnvAndGroup, "InvalidEnvAndGroup");
        }
예제 #3
0
    /// <summary>
    /// バージョンアップ実行
    /// </summary>
    /// <param name="version">バージョン</param>
    public void VersionUp(int version)
    {
        // バージョン単位の更新処理
        ExecVersionUp();

        // バージョン値を上げる ※連続呼び出しも回数が限定されるので、毎度インスタンス生成
        ConfigDao.UpdateDbVersion(version);
    }
        private void nextBtn_Click(object sender, RoutedEventArgs e)
        {
            ConfigObj config = new ConfigDao().select("TnCAcceptant");

            config.value = "1";
            new ConfigDao().save(config);
            MoveNext();
        }
예제 #5
0
 public void UpdateConfiguration(ConfigurationItem item)
 {
     RepositoryAction.Transaction((c, t) =>
     {
         var dao = new ConfigDao(c, t);
         dao.DeleteInsert(ConfigTableRow.FromDomainObject(item));
     });
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ConfigObj config = new ConfigDao().select("TnCAcceptant");
            bool      status = Convert.ToBoolean(Convert.ToInt16(config.value));

            if (status)
            {
                MoveNext();
            }
        }
예제 #7
0
    /// <summary>
    /// DBバージョンアップ
    /// </summary>
    public static void UpdateVersion()
    {
        int curVersion = ConfigDao.SelectDbVersion();

        // 1バージョンずつアップしていく
        for (++curVersion; curVersion <= DB_VERSION; curVersion++)
        {
            // バージョンアップ実施 ※呼び出し回数が少ないので、実装コストを取ってジェネリクス利用
            DbVersionBase verInst = (DbVersionBase)Activator.CreateInstance(Type.GetType(String.Format("DbVersion{0}", curVersion)));
            verInst.VersionUp(curVersion);
        }
    }
예제 #8
0
        private void mephobiaButton1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Length != 0 && textBox2.Text.Trim().Length != 0)
            {
                try
                {
                    XDocument doc   = XDocument.Load(Settings.Default["xml_filename"].ToString());
                    XElement  Realm = new XElement("Realm", new XElement("Name", textBox1.Text),
                                                   new XElement("Realmlist", textBox2.Text),
                                                   new XElement("rPath", textBox3.Text),
                                                   new XElement("wPath", textBox4.Text));
                    doc.Root.Add(Realm);
                    doc.Save(Settings.Default["xml_filename"].ToString());

                    //- Realmlist Addresses id:1
                    ConfigDao.RealmlistAddresses.Add(textBox2.Text);

                    //- Realmlist Paths id:2
                    ConfigDao.RealmlistPaths.Add(textBox3.Text);

                    //- WoW Exe Paths id:3
                    ConfigDao.WoWExePaths.Add(textBox4.Text);

                    //- Realm Names id:1
                    ConfigDao.RealmNames.Add(textBox1.Text);

                    ConfigDao.ReloadRealm();

                    onReal();
                }
                catch (Exception ex)
                {
                    // Exceptions: wrong xml structure, empty file
                    //- So we create a new xml configuration file
                    //Form1 form1 = new Form1();
                    //form1.CreateDefaultXMLConfFile();

                    //- We add new data which failed in this exception
                    XDocument doc   = XDocument.Load(Settings.Default["xml_filename"].ToString());
                    XElement  Realm = new XElement("Realm", new XElement("Name", textBox1.Text),
                                                   new XElement("Realmlist", textBox2.Text),
                                                   new XElement("rPath", textBox3.Text),
                                                   new XElement("wPath", textBox4.Text));
                    doc.Root.Add(Realm);

                    doc.Save(Settings.Default["xml_filename"].ToString());
                    MessageBox.Show("An error was ocurred while adding new data in configuration file, we recommend you to restart your application. " + ex.ToString());
                }
            }

            this.Dispose();
            this.Close();
        }
예제 #9
0
        public ConfigurationItem[] SelectAll()
        {
            ConfigurationItem[] results = null;

            RepositoryAction.Query(c =>
            {
                var dao = new ConfigDao(c, null);

                results = dao.SelectAll().Select(i => i.ConvertToDomainObject()).ToArray();
            });

            return(results);
        }
예제 #10
0
        public void GetConfigAll()
        {
            ConfigDao configDao = new ConfigDao();

            Global.ConfigList = configDao.GetConfigAll();
            foreach (string env in Global.ConfigList.Keys)
            {
                foreach (string group in Global.ConfigList[env].Keys)
                {
                    topic(env, group);
                }
            }
        }
예제 #11
0
        public void TestAddProject()
        {
            var obj = new ProjectConfig
            {
                project_name = "testproject",
                dbconn       = "Data Source=192.168.2.112;Initial Catalog=DB_Monitor;User ID=sa;Password=taotao778899!;Persist Security Info=False;Max Pool Size=100",
                project_des  = "测试项目",
                createtime   = DateTime.Now,
                updatetime   = DateTime.Now
            };

            ConfigDao.AddProjectConfig(obj);
        }
예제 #12
0
        public void TestAddModule()
        {
            var obj = new ModuleConfig
            {
                module_name    = "testmodule",
                project_id     = 0,
                contact_email  = "*****@*****.**",
                contact_moblie = "13693304040;13693350505",
                createtime     = DateTime.Now,
                updatetime     = DateTime.Now,
                module_des     = "测试模块",
                ProjectConfig  = new ProjectConfig {
                    project_name = "testproject"
                }
            };

            ConfigDao.AddModuleConfig(obj);
        }
예제 #13
0
        public static void Reset()
        {
            _dataApi = null;

            _administratorDao         = null;
            _administratorsInRolesDao = null;
            _areaDao               = null;
            _channelDao            = null;
            _channelGroupDao       = null;
            _configDao             = null;
            _contentCheckDao       = null;
            _contentDao            = null;
            _contentGroupDao       = null;
            _countDao              = null;
            _databaseDao           = null;
            _dbCacheDao            = null;
            _departmentDao         = null;
            _errorLogDao           = null;
            _keywordDao            = null;
            _logDao                = null;
            _permissionsInRolesDao = null;
            _pluginConfigDao       = null;
            _pluginDao             = null;
            _recordDao             = null;
            _relatedFieldDao       = null;
            _relatedFieldItemDao   = null;
            _roleDao               = null;
            _siteDao               = null;
            _siteLogDao            = null;
            _sitePermissionsDao    = null;
            _specialDao            = null;
            _tableDao              = null;
            _tableMatchDao         = null;
            _tableMetadataDao      = null;
            _tableStyleDao         = null;
            _tableStyleItemDao     = null;
            _tagDao                = null;
            _templateDao           = null;
            _templateLogDao        = null;
            _templateMatchDao      = null;
            _userDao               = null;
            _userLogDao            = null;
        }
예제 #14
0
        public static void Reset()
        {
            _databaseApi = null;

            _accessTokenDao           = null;
            _administratorDao         = null;
            _administratorsInRolesDao = null;
            _channelDao            = null;
            _channelGroupDao       = null;
            _configDao             = null;
            _contentCheckDao       = null;
            _contentDao            = null;
            _contentGroupDao       = null;
            _databaseDao           = null;
            _dbCacheDao            = null;
            _errorLogDao           = null;
            _keywordDao            = null;
            _libraryGroupDao       = null;
            _libraryImageDao       = null;
            _libraryTextDao        = null;
            _logDao                = null;
            _permissionsInRolesDao = null;
            _pluginConfigDao       = null;
            _pluginDao             = null;
            _relatedFieldDao       = null;
            _relatedFieldItemDao   = null;
            _roleDao               = null;
            _siteDao               = null;
            _siteLogDao            = null;
            _sitePermissionsDao    = null;
            _specialDao            = null;
            _tableStyleDao         = null;
            _tableStyleItemDao     = null;
            _tagDao                = null;
            _templateDao           = null;
            _templateLogDao        = null;
            _templateMatchDao      = null;
            _userDao               = null;
            _userGroupDao          = null;
            _userLogDao            = null;
            _userMenuDao           = null;
        }
예제 #15
0
        private void Load()
        {
            Dictionary <string, ConfigItem> configItems = new Dictionary <string, ConfigItem>();

            foreach (ConfigItem item in ConfigDao.GetConfigItems())
            {
                if (item.Id == "NodeDatabaseVersion")
                {
                }
                else
                {
                    item.Value = _cryptographyProvider.Decrypt(item.Value);
                }
                configItems.Add(item.Id.ToUpper(), item);
            }
            lock (_lockObject)
            {
                _configItems = configItems;
            }
        }
예제 #16
0
        public MainWindow()
        {
            // 判断是否有目录 无就创建
            Util.XmlHandler.CreatPath(Config.BasePath);
            // 判断是否有 config。xml文件
            ConfigDao.CreateConfigFile();
            // 判断是否有 book.xml 文件
            BooksDao.CreateBooksFile();

            // 打开视图
            InitializeComponent();
            // 添加视图
            Active = this;
            // 刷新视图 获取书本
            bookDao = new BooksDao();
            List <Book> bs = bookDao.GetAllBook();

            foreach (Book item in bs)
            {
                // 添加书籍
                ViewAddBook(item, leftLength, TopLength, BooksList);
                if (leftLength >= 450 && TopLength < 220)
                {
                    leftLength = 150;
                    TopLength  = 220;
                }
                else
                {
                    leftLength += 150;
                }
            }
            // 添加按钮书籍
            btn_addBook.Click += OnClick;
            // 移动添加按钮
            ViewMoveBook(btn_addBook, leftLength, TopLength);
        }
        private async Task SetConfigDaoAsync(string authority, CancellationToken cancellationToken, ConfigDao configDao = null, string uri = null, string description = null)
        {
            var dao = new AuthorityDao
            {
                Authority   = authority,
                Json        = (configDao == null) ? null : JsonSerializer.Serialize(configDao),
                Uri         = uri,
                Description = description
            };

            await SetConfigurationAsync(dao, cancellationToken);
        }
예제 #18
0
 /// <summary>
 ///     Hàm sửa cấu hình quyền Windows
 /// </summary>
 /// <param name="config"></param>
 public static void WindowsAuthentication(Config config)
 {
     ConfigDao.ChangeConnectionString(string.Format(ConnectionStrWindows, config.ServerName, config.DatabaseName));
 }
예제 #19
0
 /// <summary>
 ///     Hàm sửa cấu hình quyền Sql Server
 /// </summary>
 /// <param name="config"></param>
 public static void SqlSeverAuthentication(Config config)
 {
     ConfigDao.ChangeConnectionString(string.Format(ConnectionStrSqlServer, config.ServerName, config.DatabaseName,
                                                    config.UserName, config.Password));
 }
예제 #20
0
 public ConfigService()
 {
     _ConfigDao  = new ConfigDao();
     BaseCrudDao = _ConfigDao;
 }