protected string GetFromArgPanel(RCProcess.CustomCommandParser command) { bool flag = false; int num = 0; List <string> list = new List <string>(); foreach (RCProcess.CustomCommandParser.CommandArg arg in command.Arguments) { string text = this.GetArgument(num, arg); if (text.IndexOf('\'') != -1) { Utility.ShowErrorMessage(LocalizeText.Get(533)); return(null); } if (string.IsNullOrEmpty(text)) { text = string.Empty; flag = true; } list.Add(string.Format("'{0}'", text)); num++; } string finalCommand = command.GetFinalCommand(list.ToArray()); if (flag && !Utility.InputYesNoFromWarning(LocalizeText.Get(405))) { return(null); } return(finalCommand); }
public string GetCustomCommand() { RCProcess.CustomCommandParser[] array = new RCProcess.CustomCommandParser[this.listViewCustomCommand.Items.Count]; for (int i = 0; i < array.Length; i++) { ListViewItem listViewItem = this.listViewCustomCommand.Items[i]; array[i] = new RCProcess.CustomCommandParser(listViewItem.SubItems[0].Text, listViewItem.SubItems[1].Text); } return(RCProcess.CustomCommandParser.ToRawString(array)); }
private void UpdateUI(RCProcess.CustomCommandParser cmdParser) { this.textBoxName.Text = cmdParser.Name; this.textBoxCommand.Text = cmdParser.Command; this.listViewArg.Items.Clear(); foreach (RCProcess.CustomCommandParser.CommandArg commandArg in cmdParser.Arguments) { ListViewItem listViewItem = this.listViewArg.Items.Add(new ListViewItem(new string[] { commandArg.Name, (string)this.comboBoxType.Items[(int)commandArg.Type] })); listViewItem.Tag = commandArg.Comment; } }
public CustomCommandForm(string name, string command) : this() { RCProcess.CustomCommandParser customCommandParser = new RCProcess.CustomCommandParser(name, command); this.UpdateUI(customCommandParser); this.textBoxRawCommand.Text = string.Format("{0}|{1}", customCommandParser.Name, customCommandParser.RawCommand); }
public CommandItem(RCProcess.CustomCommandParser command) { this.Command = command; }
protected IEnumerable <CommandForm.ArgumentControl> SetArgPanel(Panel panel, RCProcess.CustomCommandParser command, IEnumerable <string> serverList) { panel.Controls.Clear(); this.controlArgs.Clear(); this.ctrlTotalSize = 0; foreach (RCProcess.CustomCommandParser.CommandArg arg in command.Arguments) { Label textLabel = new Label(); textLabel.Text = arg.Name; textLabel.TextAlign = ContentAlignment.MiddleCenter; textLabel.Location = new Point(0, this.ctrlTotalSize); textLabel.Size = new Size(100, 24); Control ctrl = null; int width = panel.Size.Width - 120; int height = 24; int x = 100; int y = this.ctrlTotalSize; switch (arg.Type) { case RCProcess.CustomCommandParser.DataType.Numeric: ctrl = new Utility.NumericTextBox(); break; case RCProcess.CustomCommandParser.DataType.Date: ctrl = new DateTimePicker(); ((DateTimePicker)ctrl).CustomFormat = "yyyy-MM-dd HH:mm:ss"; ((DateTimePicker)ctrl).Format = DateTimePickerFormat.Custom; break; case RCProcess.CustomCommandParser.DataType.Boolean: ctrl = new TwoRadioButton(); break; case RCProcess.CustomCommandParser.DataType.ServerGroup: { ctrl = new ComboBox(); ComboBox comboBox = ctrl as ComboBox; comboBox.DropDownStyle = ComboBoxStyle.DropDownList; if (serverList != null) { comboBox.Items.AddRange(serverList.ToArray <string>()); } break; } case RCProcess.CustomCommandParser.DataType.LargeString: { ctrl = new RichTextBox(); RichTextBox richTextBox = ctrl as RichTextBox; richTextBox.Multiline = true; x = 20; y = this.ctrlTotalSize + 24; height = 120; width = panel.Width - 40; break; } default: ctrl = new TextBox(); break; } if (ctrl != null) { ctrl.Name = arg.Name; ctrl.Location = new Point(x, y); ctrl.Size = new Size(width, height); ctrl.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right); new ToolTip { AutoPopDelay = 5000, InitialDelay = 500, ReshowDelay = 250, ShowAlways = true }.SetToolTip(ctrl, arg.Comment); panel.Controls.Add(textLabel); panel.Controls.Add(ctrl); this.controlArgs.Add(ctrl); yield return(new CommandForm.ArgumentControl(textLabel, ctrl, arg)); } int sizeToIncrease = y - this.ctrlTotalSize + (ctrl.Visible ? height : 0); this.ctrlTotalSize += sizeToIncrease; } yield break; }