Add MrTrust GUI and Gitea release build
Some checks failed
Build MrTrust / build-windows (push) Has been cancelled

This commit is contained in:
MrSphay
2026-05-15 23:47:10 +02:00
parent 7d4e9759e6
commit b58b6358f4
20 changed files with 1179 additions and 403 deletions

58
src/MrTrustLauncher.cs Normal file
View File

@@ -0,0 +1,58 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace MrTrust
{
internal static class MrTrustLauncher
{
[STAThread]
private static int Main()
{
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
string scriptPath = Path.Combine(baseDirectory, "MrTrust.ps1");
if (!File.Exists(scriptPath))
{
MessageBox.Show(
"MrTrust.ps1 was not found next to MrTrust.exe.",
"MrTrust",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return 1;
}
try
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "powershell.exe",
Arguments = "-NoProfile -ExecutionPolicy Bypass -File \"" + scriptPath + "\" gui",
UseShellExecute = false,
CreateNoWindow = true,
WorkingDirectory = baseDirectory
};
using (Process process = Process.Start(startInfo))
{
if (process == null)
{
throw new InvalidOperationException("PowerShell could not be started.");
}
}
return 0;
}
catch (Exception ex)
{
MessageBox.Show(
ex.Message,
"MrTrust",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return 1;
}
}
}
}