Files
lightsetup/LightSetupMd5/Program.cs
2023-05-22 09:29:58 +08:00

52 lines
1.7 KiB
C#

// See https://aka.ms/new-console-template for more information
using System.Text.Json;
using System.Text;
using LightSetupBase;
using System.Reflection;
namespace LightSetupMd5 // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
try
{
Md5InitMainArgs argsHandle = new Md5InitMainArgs();
Md5MainArgs arg = argsHandle.InitArgs(args);
if (arg.Help)
{
argsHandle.ShowHelper();
return;
}
Md5Config config = new Md5ConfigRead().ReadConfig(arg);
// 需要检测md5的文件名
List<FileInfo> fileInfos = new Md5FileFIlter().GetFiles(arg, config);
// 获取md5值
string md5 = new Md5Release().GetMd5(arg, fileInfos);
// 获取Ip
string ip = new IpHelper().GetIp();
// 获取Ip
string computerName = new ComputerHelper().GetComputerName();
// 获取默认参数
Dictionary<string, string> defaultPara = new Md5DefaultParamter().getPara(md5, ip, computerName);
// 获取扩展参数
Dictionary<string, string> extendPara = new Md5HttpExtend().RequestAsync(arg, config, defaultPara);
// 生成文件
new Md5ConfigFile().WriteFile(arg, config, extendPara);
// 生成文件
new Md5HttpPost().Request(arg, config, extendPara);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}