public void LoadConfig(string configDir) { string configPath = configDir + "\\csvcolumnizer.dat"; if (!File.Exists(configPath)) { this.config = new CsvColumnizerConfig(); this.config.InitDefaults(); } else { Stream fs = File.OpenRead(configPath); BinaryFormatter formatter = new BinaryFormatter(); try { this.config = (CsvColumnizerConfig)formatter.Deserialize(fs); } catch (SerializationException e) { MessageBox.Show(e.Message, "Deserialize"); this.config = new CsvColumnizerConfig(); this.config.InitDefaults(); } finally { fs.Close(); } } }
public CsvColumnizerConfigDlg(CsvColumnizerConfig config) { this.config = config; InitializeComponent(); fillValues(); }