/// <summary> /// Загрузить данные из XML-файла. /// </summary> 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.PasswordNeed = obj.DBConnection.PasswordNeed; DBConnection.LoginFormNeed = obj.DBConnection.LoginFormNeed; DBConnection.User = obj.DBConnection.User; DBConnection.Password = obj.DBConnection.Password; SystemPlatform.NodeName = obj.SystemPlatform.NodeName; SystemPlatform.GalaxyName = obj.SystemPlatform.GalaxyName; SystemPlatform.Login = obj.SystemPlatform.Login; SystemPlatform.Password = obj.SystemPlatform.Password; SystemPlatform.NameField = obj.SystemPlatform.NameField; SystemPlatform.DescriptionField = obj.SystemPlatform.DescriptionField; SystemPlatform.PointNumField = obj.SystemPlatform.PointNumField; SystemPlatform.UnitField = obj.SystemPlatform.UnitField; } }
public void Init() { Version = "v1.3.0"; string fileName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location); varXml = new VarXml(string.Format("{0}.xml", fileName)); varXml.LoadFromXML(); //varXml.SaveToXML(); }