Exemplo n.º 1
0
        public void LoadPrefsFromManager(CfgManager mgr)
        {
            this.Log().Debug("Loading a preference set using the manager");

            string input;
            int    output;

            input = mgr.GetValue(prefPrefix + "_format");
            if (input != "")
            {
                Int32.TryParse(input, out output);
                format = (prefFormat)output;
            }
            else
            {
                format = prefFormat.Bmp;
            }

            input = mgr.GetValue(prefPrefix + "_width");
            if (input != "")
            {
                Int32.TryParse(input, out output);
                width = output;
            }
            else
            {
                width = 1024;
            }

            input = mgr.GetValue(prefPrefix + "_height");
            if (input != "")
            {
                Int32.TryParse(input, out output);
                height = output;
            }
            else
            {
                height = 1024;
            }

            bool outputBool;

            input = mgr.GetValue(prefPrefix + "_proportion");
            if (input != "")
            {
                bool.TryParse(input, out outputBool);
                keepProportion = outputBool;
            }
            else
            {
                keepProportion = true;
            }
        }
Exemplo n.º 2
0
        public void CfgMgr_Xml_Read_CfgSysType()
        {
            string path = Path.Combine(localFolder, file_xml_1);

            configManager = new CfgManager(path, typeof(XmlConfigSystem));
            configManager.ReadConfig();

            Assert.AreEqual(5, configManager.GetDictionary().Count, "Dictionary Size should be 5");
            string value1 = configManager.GetValue("long");

            Assert.AreEqual("string with spaces", value1, "Content of \"long\" should be \"string with spaces\"");
            string value2 = configManager.GetValue("test");

            Assert.AreEqual("value", value2, "Content for \"test\" should be \"value\"");
            string value3 = configManager.GetValue("bar");

            Assert.AreEqual("", value3, "Content for \"bar\" should be empty");
        }
Exemplo n.º 3
0
        public void CfgMgr_Ini_Read_CfgSysType()
        {
            string path = Path.Combine(localFolder, file_ini_1);

            configManager = new CfgManager(path, typeof(IniConfigSystem));
            configManager.ReadConfig();

            Assert.AreEqual(5, configManager.GetDictionary().Count, "Dictionary Size should be 5");
            string value1 = configManager.GetValue("general_long");

            Assert.AreEqual("string with more data", value1, "Content of \"general_long\" should be \"string with more data\"");
            string value2 = configManager.GetValue("general_foo");

            Assert.AreEqual("bar", value2, "Content for \"general_foo\" should be \"bar\"");
            string value3 = configManager.GetValue("general_bar");

            Assert.AreEqual("", value3, "Content for \"general_bar\" should be empty");
        }
Exemplo n.º 4
0
        public void CfgMgr_Text_Read_CfgSysInstance()
        {
            string           path   = Path.Combine(localFolder, file_txt_1);
            TextConfigSystem cfgsys = new TextConfigSystem();

            configManager = new CfgManager(path, cfgsys);
            configManager.ReadConfig();

            Assert.AreEqual(5, configManager.GetDictionary().Count, "Dictionary Size should be 5");
            string value1 = configManager.GetValue("long");

            Assert.AreEqual("string with more data", value1, "Content of \"long\" should be \"string with more data\"");
            string value2 = configManager.GetValue("foo");

            Assert.AreEqual("bar", value2, "Content for \"foo\" should be \"bar\"");
            string value3 = configManager.GetValue("bar");

            Assert.AreEqual("", value3, "Content for \"bar\" should be empty");
        }
Exemplo n.º 5
0
        public void LoadParametersFromManager(CfgManager mgr)
        {
            this.Log().Debug("Loading a parameter set using the manager");

            string input;
            int    output;

            input = mgr.GetValue("previewsize");
            if (input != "")
            {
                Int32.TryParse(input, out output);
                previewSize = output;
            }
            else
            {
                previewSize = 64;
            }
        }