/// <summary> /// Loads the settings file from the xml in program directory. /// </summary> public void load() { XmlSerializer set_serialized = new XmlSerializer(typeof(TrapSettings)); StreamReader xml_settings_file = new StreamReader("TrapWindow.xml"); //Set variable to old saved settings file. _settings = (TrapSettings)set_serialized.Deserialize(xml_settings_file); xml_settings_file.Close(); }
/// <summary> /// Create a Settings file if none exists. /// </summary> /// <param name="fileName"></param> public void CreateSettingsFile() { XmlSerializer set_serialized = new XmlSerializer(typeof(TrapSettings)); _settings = new TrapSettings(1, 1, 1, 1); using (StreamWriter xmlfile = new StreamWriter("TrapWindow.xml")) { set_serialized.Serialize(xmlfile, _settings); } }
/// <summary> /// Updates the Variables in the settings file. /// </summary> /// <param name="X1"></param> /// <param name="Y1"></param> /// <param name="X2"></param> /// <param name="Y2"></param> public void Update(int X1, int Y1, int X2, int Y2) { _settings = new TrapSettings(X1, Y1, X2, Y2); }