using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LB_VisionProcesses.Processes.RecordTool { [Process("绘制工具", Category = "其他工具", Description = "创建绘制工具")] public class RecordTool : BaseProcess { public RecordTool() { strProcessClass = "LB_VisionProcesses.Processes.RecordTool"; strProcessName = "绘制工具"; } public override bool Run() { try { InitRunParams(); Dictionary dicInputs = GetInputs(); foreach (var kvp in dicInputs) Params.Inputs.Add(kvp.Key, kvp.Value); Result = true; } catch (Exception ex) { Msg = $"脚本异常,原因是:{ex.Message}"; Result = false; } return Result; } /// /// 获取脚本输入 /// /// public Dictionary GetInputs() { try { Dictionary dicInputs = new Dictionary(); for (int i = 0; i <= Params.Inputs.Count - 1; i++) { bool isFindKey = Params.Inputs.GetKey(i, out string key); //忽略不需要的参数 if (!isFindKey) continue; dicInputs.TryAdd(key, Params.Inputs[i]); } return dicInputs; } catch { return new Dictionary(); } } } }