public void LoadConfig(string configDir) { string configPath = configDir + CFG_FILE_NAME; if (!File.Exists(configPath)) { this.config = new EminusConfig(); } else { Stream fs = File.OpenRead(configPath); BinaryFormatter formatter = new BinaryFormatter(); try { this.config = (EminusConfig)formatter.Deserialize(fs); } catch (SerializationException e) { MessageBox.Show(e.Message, "Deserialize"); this.config = new EminusConfig(); } finally { fs.Close(); } } }
public EminusConfig Clone() { EminusConfig config = new EminusConfig(); config.host = this.host; config.port = this.port; config.password = this.password; return config; }
public EminusConfig Clone() { EminusConfig config = new EminusConfig(); config.host = this.host; config.port = this.port; config.password = this.password; return(config); }
public EminusConfigDlg(EminusConfig config) { InitializeComponent(); this.TopLevel = false; this.config = config; this.hostTextBox.Text = config.host; this.portTextBox.Text = "" + config.port; this.passwordTextBox.Text = config.password; }
public void SaveConfig(string configDir) { string configPath = configDir + CFG_FILE_NAME; if (this.dlg != null) { this.dlg.ApplyChanges(); } this.config = this.tmpConfig.Clone(); BinaryFormatter formatter = new BinaryFormatter(); Stream fs = new FileStream(configPath, FileMode.Create, FileAccess.Write); formatter.Serialize(fs, this.config); fs.Close(); }
public void StartConfig() { this.tmpConfig = this.config.Clone(); }