public MainWindow() { InitializeComponent(); WorkDirectory = Environment.CurrentDirectory; UnpackLogger = new TextBoxLogger(UnpackingProtocolTextBox); PackLogger = new TextBoxLogger(PackingProtocolTextBox); ProgramConfiguration = new MStarConfiguration(Path.Combine(WorkDirectory, "mstar.config")); ProgramConfiguration.load(); ProgramPreferences = new UserPreferences(Path.Combine(WorkDirectory, "mstar.preferences")); if (ProgramPreferences.load()) { if (Directory.Exists(ProgramPreferences.WorkingDirectory)) { WorkDirectory = ProgramPreferences.WorkingDirectory; } } }
public bool load() { try { if (File.Exists(Filename)) { using (FileStream inputStream = new FileStream(Filename, FileMode.Open, FileAccess.Read)) { MStarConfiguration loadedConfiguration = (MStarConfiguration)ConfigSerializer.ReadObject(inputStream); if (loadedConfiguration == null) { return(false); } FirmwareTitle = loadedConfiguration.FirmwareTitle; } } return(true); } catch (Exception error) { return(false); } }
public void saveConfigTo(MStarConfiguration programConfiguration) { programConfiguration.FirmwareTitle = FirmwareTitleTextBox.Text; }
public void useConfigFrom(MStarConfiguration programConfiguration) { FirmwareTitleTextBox.Text = programConfiguration.FirmwareTitle; }