old_flsystem/FLSystem/Forms/EncPlugin.cs

97 lines
3.2 KiB
C#
Raw Normal View History

2022-09-20 03:10:29 +00:00
using Api.Framework;
using CsharpHttpHelper;
using Grant.Framework;
using System;
using System.Windows.Forms;
using UI.Framework.Forms;
namespace FLSystem.Forms
{
public partial class EncPlugin :BaseForm
{
public EncPlugin()
{
InitializeComponent();
}
private void EncPlugin_Load(object sender, EventArgs e)
{
try
{
var a = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
var b = System.IO.File.ReadAllBytes(a);
if (b[b.Length - 1] != 83 || b[b.Length - 2] != 84)
{
this.button1.Text = "已获得可调试权限";
this.button1.Enabled = false;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
Computer cx = Computer.Instance();
var md5 = HttpHelper.ToMD5(cx.ComputerName + cx.CpuID + cx.LoginUserName);
MessageBox.Show($@"机器码:{md5}
!","");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void groupBox1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
}
private void groupBox1_DragDrop(object sender, DragEventArgs e)
{
try
{
var text = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
var plugin = PluginClient.FileConvertPlugin(text);
ShowSuccess($"恭喜您,封装成功!\r\n友情提示:\r\n 您的DLL可以先混淆加密再來封裝会更安全哦!\r\n路径:{plugin.FilePath}","操作成功");
}
catch (Exception ex)
{
ShowError(ex.Message);
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Multiselect = true;//该值确定是否可以选择多个文件
dialog.Title = "请选择插件DLL";
dialog.Filter = "所有文件(*.dll)|*.dll";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string file = dialog.FileName;
var plugin = PluginClient.FileConvertPlugin(file);
ShowSuccess($@"恭喜您,封装成功!
DLL可以先混淆加密再來封裝会更安全哦!
:{plugin.FilePath}", "");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}