/// <summary> /// Загрузить данные из XML-файла. /// </summary> /// <returns></returns> public void LoadFromXML() { if (File.Exists(FilePath)) { XmlSerializer deserializer = new XmlSerializer(typeof(VarXml)); TextReader textReader = new StreamReader(FilePath); VarXml obj = (VarXml)deserializer.Deserialize(textReader); textReader.Close(); DBConnection.DataBaseType = obj.DBConnection.DataBaseType; DBConnection.DataBase = obj.DBConnection.DataBase; DBConnection.Server = obj.DBConnection.Server; DBConnection.PasswordNeed = obj.DBConnection.PasswordNeed; DBConnection.LoginFormNeed = obj.DBConnection.LoginFormNeed; DBConnection.User = obj.DBConnection.User; DBConnection.Password = obj.DBConnection.Password; Disbalance.Account1 = obj.Disbalance.Account1; Disbalance.Account2 = obj.Disbalance.Account2; Disbalance.Account3 = obj.Disbalance.Account3; Disbalance.Account4 = obj.Disbalance.Account4; Disbalance.Account5 = obj.Disbalance.Account5; Disbalance.Account6 = obj.Disbalance.Account6; Disbalance.Account7 = obj.Disbalance.Account7; Disbalance.Account8 = obj.Disbalance.Account8; Disbalance.Account9 = obj.Disbalance.Account9; Disbalance.Account10 = obj.Disbalance.Account10; } }
public void Init() { //Version = "v1.6.50"; Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); varXml = new VarXml("Config.xml"); varXml.LoadFromXML(); //varXml.SaveToXML(); }