示例#1
0
        public Settings()
        {
            InitializeComponent();
            panel.AutoScroll = true;

            config = WorkspaceConfig.Load();
            TextBoxOutputDirectory.Text    = config.outputDirectory;
            TextBoxExcludedExtensions.Text = config.excludedExtensions;
            foreach (var link in config.encoders)
            {
                AddItem(link.extension, link.encoder);
            }

            FormClosing += (_, e) => {
                config.encoders.Clear();

                foreach (EncoderEntry entry in entries)
                {
                    config.encoders.Add(new EncoderLink {
                        extension = entry.extension, encoder = entry.encoder
                    });
                }

                config.Save();
            };
        }
示例#2
0
        static public WorkspaceConfig Load()
        {
            WorkspaceConfig config;

            try
            {
                using (var myFileStream = File.OpenRead("config.workspace"))
                {
                    var mySerializer = new XmlSerializer(typeof(WorkspaceConfig));
                    config = (WorkspaceConfig)mySerializer.Deserialize(myFileStream);
                }
            }
            catch (System.Exception)
            {
                config = new WorkspaceConfig();
                config.Reset();
            }

            return(config);
        }
示例#3
0
        private void buttonSettings_Click(object sender, EventArgs e)
        {
            ButtonPack.Enabled     = false;
            ButtonSettings.Enabled = false;

            var settingsForm = new Settings();

            settingsForm.Show();
            settingsForm.BringToFront();
            settingsForm.FormClosed += delegate
            {
                ButtonPack.Enabled     = true;
                ButtonSettings.Enabled = true;

                // Refresh settings.
                config = WorkspaceConfig.Load();

                RefreshWorkspace();
            };
        }
示例#4
0
        private void buttonSettings_Click(object sender, EventArgs e)
        {
            ButtonPack.Enabled     = false;
            ButtonUpdate.Enabled   = false;
            ButtonSettings.Enabled = false;

            var settingsForm = new Settings();

            settingsForm.Show();
            settingsForm.BringToFront();
            settingsForm.FormClosed += delegate {
                ButtonPack.Enabled     = true;
                ButtonUpdate.Enabled   = true;
                ButtonSettings.Enabled = true;

                // Refresh settings.
                config     = WorkspaceConfig.Load();
                outputPath = Path.GetFullPath(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + config.outputDirectory);

                RefreshWorkspace();
            };
        }