Example #1
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);
            }
        }
Example #2
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 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static PresetsFile DeserializePresetsData(string filename)
        {
            PresetsFile pres = null;

            // Open up the file...
            if (File.Exists(filename))
            {
                XmlSerializer nser  = new XmlSerializer(typeof(PresetsFile));
                TextReader    ntext = new StreamReader(filename);
                try {
                    pres = (PresetsFile)nser.Deserialize(ntext);
                } catch {
                    pres = null;
                } finally {
                    ntext.Close();
                    ntext.Dispose();
                }
            }

            return(pres);
        }
Example #4
0
 public frmPresetsEditor(PresetsFile afile) : this()
 {
     presetfile = afile;
     this.RefreshData();
 }