Esempio n. 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="apreset"></param>
 /// <returns></returns>
 public int AddPreset(Preset apreset)
 {
     int res = -1;
     try {
         presetslist.Add(apreset);
     } catch {
         res = -1;
     }
     return res;
 }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="afilename"></param>
        /// <param name="apreset"></param>
        /// <returns></returns>
        public MediaFile AddMediaFile(string afilename, Preset apreset)
        {
            MediaFile f = null;

            if (!String.IsNullOrEmpty(afilename) && apreset != null) {
                f = new MediaFile(afilename, apreset);
                items.Add(f);
            }

            return f;
        }
        public override int Compare(Preset x, Preset y)
        {
            int i = 0;

            if (x != null && y != null) {
                if (!this.Reverse) {
                    i = x.UsedCount.CompareTo(y.UsedCount);
                } else {
                    i = y.UsedCount.CompareTo(x.UsedCount);
                }
            }

            return i;
        }
Esempio n. 4
0
        public override void LoadFile(string afilename)
        {
            base.LoadFile(afilename);
            if (File.Exists(afilename)) {
                XmlDocument newdoc = new XmlDocument();
                newdoc.Load(afilename);
                XmlNodeList rootlist = newdoc.DocumentElement.ChildNodes;

                foreach (XmlNode node in rootlist) {
                    Preset newpreset = new Preset();
                    if (node is XmlElement) {
                        if (node.HasChildNodes) {

                            XmlNodeList children = node.ChildNodes;

                            foreach (XmlNode childnode in children) {
                                if (childnode.Name == Functions.WINFF_NODE_LABEL) {
                                    newpreset.Name = childnode.InnerText;
                                }

                                if (childnode.Name == Functions.WINFF_NODE_CATEGORY) {
                                    newpreset.Category = childnode.InnerText;
                                }

                                if (childnode.Name == Functions.WINFF_NODE_EXTENSION) {
                                    newpreset.Extension = childnode.InnerText;
                                }

                                if (childnode.Name == Functions.WINFF_NODE_PARAMS) {
                                    string[] a = childnode.InnerText.Split(new string[] { "-" },
                                        StringSplitOptions.RemoveEmptyEntries);

                                    if (a.Length > 0) {
                                        foreach (string l in a) {
                                            string d = l.Trim();
                                            if (d.Contains(" ")) {
                                                string[] t = d.Split(new char[] { ' ' });
                                                if (t.Length == 1) {
                                                    newpreset.CommandLineOptions.Add(
                                                        new CommandOption(t[0].Trim(), ""));
                                                } else if (t.Length == 2) {
                                                    newpreset.CommandLineOptions.Add(
                                                        new CommandOption(t[0].Trim(), t[1].Trim()));
                                                }
                                            } else {
                                                newpreset.CommandLineOptions.Add(
                                                    new CommandOption(d.Trim(), ""));
                                            }
                                        }
                                    }
                                }
                            } // end foreach
                        }

                    } // end if

                    if (!String.IsNullOrEmpty(newpreset.Name)) {
                        this.list.Add(newpreset);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="apreset"></param>
        /// <returns></returns>
        public int FindPresetIndex(Preset apreset)
        {
            int res = -1;

            for (int i = 0; i < this.presetslist.Count; i++) {
                if (this.presetslist[i].Name == apreset.Name) {
                    res = i;
                    break;
                }
            }
            return res;
        }
Esempio n. 6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="apreset"></param>
 public void RemovePreset(Preset apreset)
 {
     this.presetslist.Remove(apreset);
 }
Esempio n. 7
0
        /// <summary>
        /// 
        /// </summary>
        private void cloneCurrentPreset()
        {
            this.currentpreset = this.buildPreset();

            if (this.currentpreset != null) {
                int i = this.presetfile.FindPresetIndex(this.currentpreset.Name);

                if (i > -1) {
                    this.currentpreset.Name = String.Format("Copy of {0}", this.currentpreset.Name);
                }

                this.presetfile.AddPreset(this.currentpreset);
                this.RefreshData();
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="presetdata"></param>
 public void AddPreset(Preset presetdata)
 {
     presetfile.AddPreset(presetdata);
     presetfile.Sort();
 }
Esempio n. 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private Preset buildPreset()
        {
            Preset pre = null;

            if (this.cboPresetname.Text != "") {
                pre = new Preset();
                pre.Name = this.cboPresetname.Text;
                pre.Category = this.cboPresetCategory.Text;
                pre.Description = this.txtDescription.Text;
                pre.Extension = this.cboFileExtension.Text;

                if (this.txtDirectory.Text != "") {
                    if (this.txtDirectory.Text[this.txtDirectory.Text.Length -1] != '\\') {
                        pre.OutputFolder = this.txtDirectory.Text + "\\";
                    } else {
                        pre.OutputFolder = this.txtDirectory.Text;
                    }
                } else {
                    pre.OutputFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\";
                }

                CommandLineOptions preoptions = new CommandLineOptions();

                // get the commandlineoptions...
                foreach (DataGridViewRow r in this.datagridArguments.Rows) {

                    string stt = "";

                    if (r.Cells[1].Value != null) {
                        stt = r.Cells[1].Value.ToString();
                    }

                    if (r.Cells[0].Value != null) {
                        CommandOption opt = new CommandOption(
                            r.Cells[0].Value.ToString(), stt);
                        preoptions.Add(opt);
                    }
                }

                pre.CommandLineOptions = preoptions;
            }

            return pre;
        }
Esempio n. 10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cboPresetname_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.currentpreset = presetfile.FindPreset(this.cboPresetname.Text);
     if (this.currentpreset != null) {
         this.ClearScreen(true);
         this.showPreset(this.cboPresetname.Text);
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Saves the current (edited) preset
        /// </summary>
        public void SaveCurrentPreset()
        {
            this.currentpreset = this.buildPreset();

            if (this.currentpreset != null) {
                int i = this.presetfile.FindPresetIndex(this.currentpreset);

                if (i == -1) {
                    this.presetfile.AddPreset(this.currentpreset);
                    this.RefreshData();
                } else {
                    this.presetfile.Presets[i] = this.currentpreset;
                }

                this.presetfile.Sort();

                this.ClearScreen();
                this.showPreset(this.currentpreset.Name);
            } else {
                this.ClearScreen();
                this.showPreset(0);
            }
        }
Esempio n. 12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="presetdata"></param>
 public void RemovePreset(Preset presetdata)
 {
     presetfile.RemovePreset(presetdata);
 }
Esempio n. 13
0
 /// <summary>
 /// Third constructor.
 /// </summary>
 /// <param name="afilename"></param>
 /// <param name="apreset"></param>
 public MediaFile(string afilename, Preset apreset, int anorder)
 {
     this.filename = afilename;
     this.currentpreset = apreset;
     this.order = anorder;
 }
Esempio n. 14
0
 /// <summary>
 /// Secondary constructor.
 /// </summary>
 /// <param name="afilename"></param>
 /// <param name="apreset"></param>
 public MediaFile(string afilename, Preset apreset)
 {
     this.filename = afilename;
     this.currentpreset = apreset;
 }
Esempio n. 15
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public MediaFile()
 {
     currentpreset = new Preset();
 }