《动手打造自己的RPA工具箱-第1讲》作业

PreJuly 2021-10-06 00:26:57

Action创建步骤:


1、新建类库.Net Framework,框架版本4.7.2

2、更改项目设置

修改程序集标题
修改调试启动程序为Ribon
添加资源表述
  1. 添加Ribon.Core.dll引用
  2. 根据模板添加必要的Attribute
  3. 书写实现功能
  4. 调试

后补..。

 

 

using Robin.Core;
using Robin.Core.Attributes;
using Security.WinTrust;
using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Robin.Modules.VerifyTrust.Actions
{
    [Action(Order = 1)]
    [Icon(Code = "F691")]
    [Throws("MyError")]
    public class CheckFile : ActionBase
    {
        [InputArgument(Order = 1)]
        [DefaultValue(@"D:\ProJect\Ribon\RibonAction\VerifyTrust\bin\Debug\Robin.Core.dll")]
        public String modulePath { get; set; }

        [OutputArgument(Order = 1)]
        public bool IsValid { get; set; }

        public override void Execute(ActionContext context)
        {
            try
            {
                IsValid = CheckValid(modulePath);
                MessageBox.Show(IsValid.ToString());
            }
            catch (Exception ex2)
            {
                throw;
            }
        }
        public bool CheckValid(string Path)
        {
            if (modulePath == null)
            {
                throw new ArgumentNullException("modulePath");
            }
            if (!File.Exists(modulePath))
            {
                throw new FileNotFoundException("Cannot find module", modulePath);
            }
			return WinTrust.VerifyEmbeddedSignature(modulePath);

		}
	}
}

 

...全文
350 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

273

社区成员

发帖
与我相关
我的任务
社区描述
低代码/RPA开发者的聚集地,我们按城市定期开展线上/线下下活动,交流编程经验,分享工作效率技巧,探讨低代码/RPA最新资讯,推广Low-Code及RPA等效率工具。
机器人 个人社区
社区管理员
  • 微创社(MCC)
  • Daniel Wang777
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧