ファイルをそれぞれの .exe にドラッグするコンソールまたはフォームを作成しようとしています。プログラムはそのファイルを取得してハッシュし、クリップボードのテキストを以前に生成されたハッシュに設定します。
これは私のコードです
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Windows.Forms;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string path = args[0];
StreamReader wer = new StreamReader(path.ToString());
wer.ReadToEnd();
string qwe = wer.ToString();
string ert = Hash(qwe);
string password = "~" + ert + "~";
Clipboard.SetText(password);
}
static public string Hash(string input)
{
MD5 md5 = MD5.Create();
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
}
}
リリースから単一の .exe を取得してファイルをドラッグすると、ある種のスレッド エラーが発生します。vb2010 ではなくコンソールにあるため、提供できません。助けてくれてありがとう