コード例 #1
0
        public void UserConfigWriteTest()
        {
            UserConfigWriter.m_TestUserConfigName = Path.GetTempPath() + "user.config";
            AppConfigWriter.m_TestAppConfigName   = Path.GetTempPath() + "app.config";
            if (File.Exists(UserConfigWriter.m_TestUserConfigName))
            {
                File.Delete(UserConfigWriter.m_TestUserConfigName);
            }
            ConfigWriter config = new ConfigWriter();

            config.Read(UserConfigWriter.m_TestUserConfigName);
            Assert.AreEqual("", config.GetItem("PromtReasonForChange"));
            //UserConfigWriter.Instance.SetItem("PromtReasonForChange", "true");
            //UserConfigWriter.Instance.SetItem("SomeItem", "true");
            //UserConfigWriter.Instance.Save();
            //config.Read(UserConfigWriter.m_TestUserConfigName);
            //Assert.AreEqual("true", config.GetItem("PromtReasonForChange"));
            //Assert.AreEqual("", config.GetItem("SomeItem"));
            var target = UserConfigWriter.CreateConfigWriter();

            target.SetItem("PromtReasonForChange", "false");
            target.SetItem("SomeItem", "false");
            target.Save();
            config.Read(UserConfigWriter.m_TestUserConfigName);
            Assert.AreEqual("false", config.GetItem("PromtReasonForChange"));
            Assert.AreEqual("", config.GetItem("SomeItem"));
        }
コード例 #2
0
        public void AppConfigWriteTest()
        {
            UserConfigWriter.m_TestUserConfigName = Path.GetTempPath() + "user_v6.config";
            AppConfigWriter.m_TestAppConfigName   = Path.GetTempPath() + "app_v6.config";
            if (File.Exists(AppConfigWriter.m_TestAppConfigName))
            {
                File.Delete(AppConfigWriter.m_TestAppConfigName);
            }
            var config = new ConfigWriter();

            config.Read(AppConfigWriter.m_TestAppConfigName);
            Assert.AreEqual("", config.GetItem("DocumentPrinter"));
            string expected = "test printer";
            //Assert.AreEqual(AppConfigWriter.Instance.FileName, AppConfigWriter.m_TestAppConfigName);
            //AppConfigWriter.Instance.SetItem("DocumentPrinter", expected);
            //AppConfigWriter.Instance.SetItem("SomeItem", "true");
            //AppConfigWriter.Instance.Save();
            //config.Read(AppConfigWriter.m_TestAppConfigName);
            //Assert.AreEqual(expected, config.GetItem("DocumentPrinter"));
            //Assert.AreEqual("", config.GetItem("SomeItem"));
            ConfigWriter target = AppConfigWriter.CreateConfigWriter();

            target.SetItem("DocumentPrinter", expected);
            target.SetItem("SomeItem", "false");
            target.Save();
            config.Read(AppConfigWriter.m_TestAppConfigName);
            Assert.AreEqual(expected, config.GetItem("DocumentPrinter"));
            Assert.AreEqual("", config.GetItem("SomeItem"));
        }
コード例 #3
0
        private void InitWebAdvancedSettingsTab()
        {
            var defRegion = m_config.GetItem(DefaultRegionInSearch).ToLowerInvariant();

            defaultRegionInSearch.Checked = (defRegion == "true" || defRegion.Trim() == String.Empty);
            defaultDateFilter.Text        = m_config.GetItem(DefaultDateFilter);
            listGridPageSize.Text         = m_config.GetItem(ListGridPageSize);
            popupGridPageSize.Text        = m_config.GetItem(PopupGridPageSize);
            detailGridPageSize.Text       = m_config.GetItem(DetailGridPageSize);
            labSectionPageSize.Text       = m_config.GetItem(LabSectionPageSize);
        }