Exemplo n.º 1
0
        /// <summary>
        /// Adds a CommandOption.
        /// </summary>
        /// <param name="anoption"></param>
        /// <returns></returns>
        public int Add(CommandOption anoption)
        {
            int res = -1;
            try {
                // see if this is already in there...
                res = FindIndex(anoption);
                if (res == -1) {
                    list.Add(anoption);
                }
            } catch {
                res = -1;
            }

            return res;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anoption"></param>
        /// <returns></returns>
        public int FindIndex(CommandOption anoption)
        {
            int res = -1;

            for (int i = 0; i < list.Count; i++) {
                if (list[i].Name == anoption.Name) {
                    res = i;
                    break;
                }
            }

            return res;
        }
Exemplo n.º 3
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;
        }