public ShutdownActionBuilder()
 {
     actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Shutdown);
     action           = new Core.Action.Models.ActionModel();
     action.Action    = Core.Action.Types.ActionType.Shutdown;
     actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Shutdown);
 }
Exemplo n.º 2
0
        public DownloadFileActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.DownloadFile);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.DownloadFile;
            inputData         = new DownloadFileActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();
            actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.DownloadFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入网络文件链接",
                Title       = "网络文件链接",
                BindingName = nameof(DownloadFileActionInputModel.Url)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入保存路径,包括文件名",
                Title       = "保存路径",
                BindingName = nameof(DownloadFileActionInputModel.SavePath)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "请求头",
                BindingName = nameof(DownloadFileActionInputModel.Headers)
            });
        }
        public RegexActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Regex);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.Regex;
            inputData         = new RegexActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();

            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Regex);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                Title       = "内容",
                BindingName = nameof(RegexActionInputModel.Content)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                Title       = "正则表达式",
                BindingName = nameof(RegexActionInputModel.Regex)
            });
        }
        public KillProcessActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.KillProcess);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.KillProcess;
            inputData         = new KillProcessActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();

            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.KillProcess);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "区分大小写,不需要填写.exe",
                Title       = "进程名称",
                IsStretch   = true,
                BindingName = nameof(KillProcessActionInputModel.ProcessName)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Bool,
                Title       = "模糊匹配",
                BindingName = nameof(KillProcessActionInputModel.IsFuzzy)
            });
        }
        public IFActionActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.IF);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.IF;
            inputData     = new IFActionInputModel()
            {
                Condition = IFActionConditionData.ComBoxData[0]
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.IF);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "如果",
                Placeholder = "请输入",
                BindingName = nameof(IFActionInputModel.Left)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                SelectItems = IFActionConditionData.ComBoxData,
                BindingName = nameof(IFActionInputModel.Condition)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                BindingName = nameof(IFActionInputModel.Right)
            });
        }
Exemplo n.º 6
0
        public HttpRequestActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.HttpRequest);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.HttpRequest;
            inputData     = new HttpRequestActionInputModel()
            {
                PamramsType = HttpRequestActionData.PamramsTypes[0],
                Method      = HttpRequestActionData.MethodTypes[0]
            };
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();
            actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.HttpRequest);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "请求地址",
                Placeholder = "请输入完整地址",
                IsStretch   = true,
                BindingName = nameof(HttpRequestActionInputModel.Url)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "方法",
                SelectItems = HttpRequestActionData.MethodTypes,
                BindingName = nameof(HttpRequestActionInputModel.Method)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "参数类型",
                SelectItems = HttpRequestActionData.PamramsTypes,
                BindingName = nameof(HttpRequestActionInputModel.PamramsType)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "请求参数",
                BindingName = nameof(HttpRequestActionInputModel.QueryParams)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "请求头",
                BindingName = nameof(HttpRequestActionInputModel.Headers)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "文件(仅Form参数类型时有效)",
                BindingName = nameof(HttpRequestActionInputModel.Files)
            });
        }
Exemplo n.º 7
0
 private void UpdateSelectionActionResults()
 {
     if (VariableActionComboBox.SelectedItem != null && VariableActionResultsComboBox != null)
     {
         var selectionItem = VariableActionComboBox.SelectedItem as ComBoxModel;
         var action        = ActionContainer.ActionItems.Where(m => m.Action.ID == selectionItem.ID).FirstOrDefault();
         if (action != null)
         {
             SetActionResults(ActionData.GetActionResults(action.Action.ActionType));
         }
     }
 }
Exemplo n.º 8
0
        public OpenURLActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.OpenURL);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.OpenURL;
            inputData        = new OpenURLActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.OpenURL);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入网页链接",
                Title       = "链接",
                IsStretch   = true,
                BindingName = nameof(OpenURLActionInputModel.URL)
            });
        }
        public SoundPlayActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.SoundPlay);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.SoundPlay;
            inputData        = new SoundPlayActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.SoundPlay);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入音频文件路径,支持mp3、wav",
                Title       = "音频文件路径",
                IsStretch   = true,
                BindingName = nameof(SoundPlayActionInputModel.Path)
            });
        }
        public KeyboardActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Keyboard);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.Keyboard;
            inputData        = new KeyboardActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Keyboard);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入按键名,支持组合键如:Ctrl+G",
                Title       = "按键",
                IsStretch   = true,
                BindingName = nameof(KeyboardActionInputModel.Keys)
            });
        }
Exemplo n.º 11
0
        public SnippingActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Snipping);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.Snipping;
            inputData        = new SnippingActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Snipping);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入保存路径",
                Title       = "截图保存路径",
                IsStretch   = true,
                BindingName = nameof(SnippingActionInputModel.SavePath)
            });
        }
Exemplo n.º 12
0
        public ReadFileActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.ReadFile);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.ReadFile;
            inputData        = new ReadFileActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.ReadFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入本地文件路径",
                Title       = "文件路径",
                IsStretch   = true,
                BindingName = nameof(ReadFileActionInputModel.FilePath)
            });
        }
Exemplo n.º 13
0
        public JsonDeserializeActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.JsonDeserialize);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.JsonDeserialize;
            inputData        = new JsonDeserializeActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.JsonDeserialize);


            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "需要解析的json",
                Title       = "Json",
                IsStretch   = true,
                BindingName = nameof(JsonDeserializeActionInputModel.Content)
            });
        }
        public LoopsActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Loops);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.Loops;
            inputData     = new LoopsActionInputModel()
            {
                Count = 1
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Loops);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Number,
                Title       = "次数",
                Placeholder = "请输入循环次数",
                BindingName = nameof(LoopsActionInputModel.Count)
            });
        }
Exemplo n.º 15
0
        public DelayActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Delay);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.Delay;
            inputData     = new DelayActionInputModel()
            {
                Seconds = "3"
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Delay);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Number,
                Placeholder = "秒",
                Title       = "延迟(秒)",
                IsStretch   = true,
                BindingName = nameof(DelayActionInputModel.Seconds)
            });
        }
Exemplo n.º 16
0
        public SetDeviceVolumeActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.SetDeviceVolume);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.SetDeviceVolume;
            inputData     = new SetDeviceVolumeActionInputModel()
            {
                Volume = "50"
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.SetDeviceVolume);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "音量值 0-100",
                Title       = "音量",
                IsStretch   = true,
                BindingName = nameof(SetDeviceVolumeActionInputModel.Volume)
            });
        }
        public DialogActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Dialog);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.Dialog;
            inputData         = new DialogActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();
            actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.Dialog);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "标题",
                Placeholder = "请输入",
                BindingName = nameof(DialogActionInputModel.Title)
            });

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "内容",
                Placeholder = "请输入",
                BindingName = nameof(DialogActionInputModel.Content)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "图标",
                Placeholder = "请输入图标文件路径,仅支持本地图片",
                BindingName = nameof(DialogActionInputModel.Image)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "按钮",
                BindingName = nameof(DialogActionInputModel.Buttons)
            });
        }
Exemplo n.º 18
0
        public GetIPAddressActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.GetIPAddress);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.GetIPAddress;
            inputData     = new GetIPAddressActionInputModel()
            {
                //选择下拉框的需要指定默认选择
                Type = GetIPAddressActionData.IPAddressTypes[0]
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.GetIPAddress);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "获取类型",
                IsStretch   = true,
                SelectItems = GetIPAddressActionData.IPAddressTypes,
                BindingName = nameof(GetIPAddressActionInputModel.Type)
            });
        }
 public StartProcessActionBuilder()
 {
     actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.StartProcess);
     action            = new Core.Action.Models.ActionModel();
     action.Action     = Core.Action.Types.ActionType.StartProcess;
     inputData         = new StartProcessActionInputModel();
     inputModels       = new List <ActionInputModel>();
     actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.StartProcess);
     detailInputModels = new List <ActionInputModel>();
     inputModels.Add(new ActionInputModel()
     {
         InputType   = Types.InputType.Text,
         Title       = "进程路径",
         Placeholder = "请输入进程路径",
         IsStretch   = true,
         BindingName = nameof(StartProcessActionInputModel.Path)
     });
     detailInputModels.Add(new ActionInputModel()
     {
         InputType   = Types.InputType.Text,
         Title       = "启动参数",
         BindingName = nameof(StartProcessActionInputModel.Args)
     });
 }
Exemplo n.º 20
0
        public WriteFileActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.WriteFile);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.WriteFile;
            inputData        = new WriteFileActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.WriteFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入文件路径",
                Title       = "路径",
                BindingName = nameof(WriteFileActionInputModel.FilePath)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入文件内容",
                Title       = "内容",
                BindingName = nameof(WriteFileActionInputModel.Content)
            });
        }
Exemplo n.º 21
0
        /// <summary>
        /// 验证输入是否有效
        /// </summary>
        private void Valid(InputBox inputTextBox)
        {
            inputTextBox.BorderBrush = FindResource("InputBorderBrush") as SolidColorBrush;
            if (inputTextBox == null)
            {
                return;
            }
            if (inputTextBox.Text == string.Empty)
            {
                return;
            }
            //验证操作结果变量
            var matchs = Regex.Matches(inputTextBox.Text, @"\{(?<id>[0-9]{1,5})\.(?<key>[0-9]{1,25})\}");

            foreach (Match match in matchs)
            {
                var id  = int.Parse(match.Groups["id"].Value);
                var key = int.Parse(match.Groups["key"].Value);
                //判断action是否存在
                var action = ActionContainer.ActionItems.Where(m => m.Action.ID == id && m.Action.Index < Action.Index).FirstOrDefault();
                if (action == null)
                {
                    inputTextBox.BorderBrush = Colors.GetColor(ColorTypes.Red);
                    break;
                }

                //判断action是否支持该变量
                var results = ActionData.GetActionResults(action.Action.ActionType);
                if (!results.Where(m => m.ID == key).Any())
                {
                    inputTextBox.BorderBrush = Colors.GetColor(ColorTypes.Red);
                    break;
                }
            }
            //验证事件变量
            var eventVariableMatchs = Regex.Matches(inputTextBox.Text, @"\{(?<key>[a-zA-Z]{1,25})\}");

            if (eventVariableMatchs.Count > 0)
            {
                if (!EventVariableData.Variables.ContainsKey(ActionContainer.EventType))
                {
                    inputTextBox.BorderBrush = Colors.GetColor(ColorTypes.Red);
                    return;
                }
                var eventVariables = EventVariableData.Variables[ActionContainer.EventType];
                foreach (Match match in eventVariableMatchs)
                {
                    var key = match.Groups["key"].Value;
                    if (!eventVariables.ContainsKey(key))
                    {
                        inputTextBox.BorderBrush = Colors.GetColor(ColorTypes.Red);
                        break;
                    }
                }
            }
            //验证全局变量
            var variables = Regex.Matches(inputTextBox.Text, @"\{@(?<key>[a-zA-Z]{1,25})\}");

            if (variables.Count > 0)
            {
                foreach (Match variable in variables)
                {
                    var key = variable.Groups["key"].Value;
                    if (!GlobalVariable.Variables.ContainsKey(key))
                    {
                        inputTextBox.BorderBrush = Colors.GetColor(ColorTypes.Red);
                        break;
                    }
                }
            }
        }