1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-22 22:12:45 +01:00
Peacock/patcher/Program.cs
Reece Dunham 6245e91624 Initial commit
Co-authored-by: Tino Roivanen <tino.roivanen98@gmail.com>
Co-authored-by: Govert de Gans <grappigegovert@hotmail.com>
Co-authored-by: Gray Olson <gray@grayolson.com>
Co-authored-by: Alexandre Sanchez <alex73630@gmail.com>
Co-authored-by: Anthony Fuller <24512050+anthonyfuller@users.noreply.github.com>
Co-authored-by: atampy25 <24306974+atampy25@users.noreply.github.com>
Co-authored-by: David <davidstulemeijer@gmail.com>
Co-authored-by: c0derMo <c0dermo@users.noreply.github.com>
Co-authored-by: Jeevat Singh <jeevatt.singh@gmail.com>
Signed-off-by: Reece Dunham <me@rdil.rocks>
2022-10-19 21:33:45 -04:00

56 lines
1.6 KiB
C#

using System;
using System.Security.Principal;
using System.Windows.Forms;
namespace HitmanPatcher
{
static class Program
{
public static bool HasAdmin;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
HasAdmin = CheckForAdmin();
#if !DEBUG
Cli.EnsureConsole(args);
#endif
Cli.CliOptions o = Cli.CliOptions.FromArguments(args);
if (o.Headless)
{
// ReSharper disable once LocalizableElement
Console.WriteLine(CliLocale.HeadlessBanner);
MemoryPatcher.PatchAllProcesses(new Cli.ConsoleLogger(), new MemoryPatcher.Options
{
AlwaysSendAuthHeader = true,
CustomConfigDomain = o.Domain,
DisableCertPinning = true,
DisableForceOfflineOnFailedDynamicResources = o.OptionalDynRes,
SetCustomConfigDomain = true,
UseHttp = o.UseHttp
});
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(MainForm.GetInstance());
}
}
static bool CheckForAdmin()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
}
}