Beispiel #1
0
        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);
        }
Beispiel #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;
        }
Beispiel #3
0
        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();
            }
        }