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<string, object> 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;
|
}
|
|
/// <summary>
|
/// 获取脚本输入
|
/// </summary>
|
/// <returns></returns>
|
public Dictionary<string, object> GetInputs()
|
{
|
try
|
{
|
Dictionary<string, object> dicInputs = new Dictionary<string, object>();
|
|
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<string, object>(); }
|
}
|
}
|
}
|