public void saveSettingsAs(FSysSettings toBeSaved, string filePath) { serialiser = new BinaryFormatter(); writer = File.OpenWrite(filePath); serialiser.Serialize(writer, toBeSaved); writer.Close(); }
private void resetSettings() { currentSetting = new defaultSettings(); saveSettings(); }
public void saveSettings(FSysSettings toBeSaved) { serialiser = new BinaryFormatter(); if (!System.IO.File.Exists(".\\Settings")) { System.IO.Directory.CreateDirectory(".\\Settings"); } writer = File.OpenWrite(".\\Settings\\FSconfig.fsc"); serialiser.Serialize(writer, toBeSaved); writer.Close(); }
private void initialiseSettings() { SettingSerialiser sS = new SettingSerialiser(); try { currentSetting = sS.loadSettings(".\\Settings\\FSconfig.fsc"); } catch (FileNotFoundException) { resetSettings(); } catch (DirectoryNotFoundException) { Directory.CreateDirectory(".\\Settings"); resetSettings(); } this.label11.Text = "Amount(" + currentSetting.currency + "):"; }