Esempio n. 1
0
 public static void GetConfig()
 {
     try
     {
         XmlDocument document = new XmlDocument();
         document.Load(Application.StartupPath + @"\Config.xml");
         _PathOVPN    = document.SelectSingleNode("//PathOVPN").Attributes["Value"].Value;
         _PathConfigs = document.SelectSingleNode("//PathConfigs").Attributes["Value"].Value;
         _user        = document.SelectSingleNode("//User").Attributes["Value"].Value;
         _Pass        = document.SelectSingleNode("//Pass").Attributes["Value"].Value;
         _index       = Convert.ToInt32(document.SelectSingleNode("//Index").Attributes["Value"].Value);
         _TimeChange  = Convert.ToInt32(document.SelectSingleNode("//TimeChange").Attributes["Value"].Value);
         try
         {
             _strRunFile  = document.SelectSingleNode("//RunFile").Attributes["Value"].Value;
             _charlesname = document.SelectSingleNode("//charles").Attributes["Value"].Value;
         }
         catch (Exception ex)
         {
             CTLError.WriteError("Loi GetConfig ", ex.Message);
         }
         _HourChange = document.SelectSingleNode("//HourChange").Attributes["Value"].Value;
     }
     catch (Exception exception)
     {
         CTLError.WriteError("loi Config GetDateUpdate ", exception.Message);
     }
 }
Esempio n. 2
0
        public static void Setvalue(string KeyConfig, string value)
        {
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(Environment.CurrentDirectory + @"\Config.xml");
                document.SelectSingleNode("//" + KeyConfig).Attributes["Value"].Value = value;
                document.Save(Path.Combine(Application.StartupPath, "Config.xml"));
            }
            catch (Exception exception)
            {
                CTLError.WriteError("Loi Setvalue Config.....", exception.Message);
            }
        }