Пример #1
0
        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;
                }
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
 public void saveConfigTo(MStarConfiguration programConfiguration)
 {
     programConfiguration.FirmwareTitle = FirmwareTitleTextBox.Text;
 }
Пример #4
0
 public void useConfigFrom(MStarConfiguration programConfiguration)
 {
     FirmwareTitleTextBox.Text = programConfiguration.FirmwareTitle;
 }