273
社区成员
发帖
与我相关
我的任务
分享Action创建步骤:
1、新建类库.Net Framework,框架版本4.7.2

2、更改项目设置
后补..。


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);
}
}
}