コード例 #1
0
ファイル: TestConfigure.cs プロジェクト: radtek/ProxyService
        public static TestConfigure GetConfig()
        {
            string path = System.IO.Path.Combine(System.IO.Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData),
                                                                        "ProxyService\\TestConfig"), "TestConfig.xml");
            TestConfigure xmlConfig = null;

            if (File.Exists(path))
            {
                XmlSerializer oXmlserialize = new XmlSerializer(typeof(TestConfigure));
                TextReader    oTextreader   = new StreamReader(path);
                xmlConfig = (TestConfigure)oXmlserialize.Deserialize(oTextreader);
                oTextreader.Close();
            }

            return(xmlConfig);
        }
コード例 #2
0
        static TestTCPClient()
        {
            try
            {
                TestConfigure.Serialize();
                string test = ListeningIPInterface;
                int    int1 = ListeningPort;
                TestConfig = TestConfigure.GetConfig();

                //if (ConstantVariables.IsInDebug && TestConfig.TestCheck && File.Exists(GuidFilePath))
                //{
                //    ReadHostIds();
                //}
            }
            catch (Exception)
            {
                TestConfig           = new TestConfigure();
                TestConfig.TestCheck = false;
            }
            TestConfig           = new TestConfigure();
            TestConfig.TestCheck = false;
        }
コード例 #3
0
ファイル: TestConfigure.cs プロジェクト: radtek/ProxyService
        public static void Serialize()
        {
            string path = System.IO.Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData),
                                                 "ProxyService\\TestConfig");


            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            path = System.IO.Path.Combine(path, "TestConfig.xml");

            if (!File.Exists(path))
            {
                TestConfigure xmlConfig = new TestConfigure();
                xmlConfig.TestCheck = true;
                xmlConfig.TestCount = 10;

                XmlSerializer oXmlserialize = new XmlSerializer(typeof(TestConfigure));
                TextWriter    oTextreader   = new StreamWriter(path);
                oXmlserialize.Serialize(oTextreader, xmlConfig);
                oTextreader.Close();
            }
        }