1
0
mirror of https://github.com/mastercodeon314/KsDumper-11.git synced 2025-02-20 04:21:14 +01:00
KsDumper-11/KsDumper11/Program.cs
2023-12-15 14:01:15 -07:00

74 lines
1.7 KiB
C#

using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using KsDumper11.Driver;
namespace KsDumper11
{
public class Program
{
[STAThread]
private static void Main()
{
KduSelfExtract.DisableDriverBlockList();
KduSelfExtract.Extract();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool driverOpen = KsDumperDriverInterface.IsDriverOpen("\\\\.\\KsDumper");
//Debugger.Break();
if (!driverOpen)
{
if (!File.Exists(KduSelfExtract.AssemblyDirectory + @"\\Providers.json"))
{
// Run the selector here to populate the providers and set a default provider.
Application.Run(new ProviderSelector());
Application.Run(new Dumper());
}
else
{
KduWrapper wr = new KduWrapper(KduSelfExtract.AssemblyDirectory + @"\Driver\kdu.exe");
wr.LoadProviders();
if (wr.DefaultProvider != -1)
{
wr.Start();
if (KsDumperDriverInterface.IsDriverOpen("\\\\.\\KsDumper"))
{
Application.Run(new Dumper());
}
else
{
Environment.Exit(0);
}
}
else
{
// Run the selector here to populate the providers and set a default provider.
Application.Run(new ProviderSelector());
if (KsDumperDriverInterface.IsDriverOpen("\\\\.\\KsDumper"))
{
Application.Run(new Dumper());
}
else
{
Environment.Exit(0);
}
}
}
}
else
{
Application.Run(new Dumper());
}
}
}
}