Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="presetdata"></param>
        /// <returns></returns>
        public static bool SerializePresetsData(string filename, PresetsFile presetdata)
        {
            bool res = true;

            XmlSerializer nser = new XmlSerializer(typeof(PresetsFile));
            TextWriter ntext = new StreamWriter(filename);
            try {
                nser.Serialize(ntext, presetdata);
                ntext.Flush();
            } catch {
                res = false;
            } finally {
                ntext.Dispose();
            }

            return res;
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolsPresetsEditorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmPresetsEditor nform = new frmPresetsEditor(this.presetdata);

            nform.StartPosition = FormStartPosition.CenterParent;

            DialogResult res = nform.ShowDialog();
            try {
                if (res == DialogResult.OK) {
                    // Save Presetfile.
                    if (Config.Settings.MakeBackupsXMLFiles) {
                        Functions.CreateBackupFile(Config.Settings.LastUsedPresetFile);
                    }

                    bool b = Functions.SerializePresetsData(
                        Config.Settings.LastUsedPresetFile,
                        this.presetdata);

                    if (b == false && Config.Settings.MakeBackupsXMLFiles) {
                        // I could throw it but...
                        DialogResult a = MessageBox.Show("Do you want your stuff restored?", "Convendro", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                        if (a == DialogResult.Yes) {
                            // if backup file was loaded...
                            if (Functions.RestoreBackupFile(Config.Settings.LastUsedPresetFile)) {
                                this.presetdata = Functions.DeserializePresetsData(
                                    Config.Settings.LastUsedPresetFile);
                            }
                        }
                    }

                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Convendro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            } finally {
                // Save commandline descriptions...
                nform.SaveDescriptionSettings(Config.Settings.LastUsedCommandDescriptionFile);
                nform.Dispose();
            }
        }
Example #3
0
        /// <summary>
        /// Main Form Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            // Load File Folder settings.
            Config.LoadFileFolderSettings();

            // Load Form settings...
            Config.LoadFormSettings(this);

            pluginManager = new PluginManager(Config.Settings.PluginFolders);
            pluginManager.OnPluginLoad += new PluginLoadedEvent(pluginManager_OnPluginLoad);
            pluginManager.Load();

            // Prepare PresetFile
            if (String.IsNullOrEmpty(Config.Settings.LastUsedPresetFile)) {
                this.presetdata = null;
                Config.Settings.LastUsedPresetFile = Path.Combine(Functions.GetCurrentLocalAppPath(),
                    Functions.FILENAME_PRESETSDATA);
            } else {
                this.presetdata = Functions.DeserializePresetsData(
                    Config.Settings.LastUsedPresetFile);
            }

            //
            if (String.IsNullOrEmpty(Config.Settings.LastUsedCommandDescriptionFile)) {
                Config.Settings.LastUsedCommandDescriptionFile =
                    Path.Combine(Functions.GetCurrentLocalAppPath(), Functions.FILENAME_COMMANDLINEDESCRIPTION);
            }

            // Create the file automatically...

            if (this.presetdata == null) {
                this.newPresetFile = true;
                this.presetdata = new PresetsFile();
            }

            refreshPresetMenu();
            setUpToolbars();
            SetControlsThreading(true);

            // If FFMEPG doesn't exist, we should probably show a dialog...
            if (String.IsNullOrEmpty(Config.Settings.FFMPEGFilePath)) {
                MessageBox.Show("FFMPeg was not found " + Config.Settings.FFMPEGFilePath + ". You may wish to set this in the settings", Application.ProductName,
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="afile"></param>
 public frmPresetsEditor(PresetsFile afile)
     : this()
 {
     presetfile = afile;
     this.RefreshData();
 }