-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAppBootstrapper.cs
More file actions
140 lines (113 loc) · 5.1 KB
/
AppBootstrapper.cs
File metadata and controls
140 lines (113 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using System;
using Stylet;
using StyletIoC;
using PubgMod.ViewModels;
using System.Windows;
using System.Windows.Threading;
using System.IO;
using System.Threading.Tasks;
using System.Diagnostics;
namespace PubgMod
{
public class AppBootstrapper : Bootstrapper<MainViewModel>
{
protected override void OnStart()
{
}
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
// Bind your own types. Concrete types are automatically self - bound.
builder.Bind(typeof(ITabItem)).ToAllImplementations();
}
protected override void Configure()
{
// This is called after Stylet has created the IoC container, so this.Container exists, but before the
// Root ViewModel is launched.
// Configure your services, etc, in here
}
protected override void OnLaunch()
{
}
protected override void OnExit(ExitEventArgs e)
{
if (SettingsViewModel.IsFileRestored) return;
var PubgPath = Properties.Settings.Default.pubgpath;
var appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
var reshadePath = $@"{appdata}\Reshade";
if (File.Exists($@"{PubgPath}\Content\Paks\TslGame-WindowsNoEditor_xmod.pak"))
File.Delete($@"{PubgPath}\Content\Paks\TslGame-WindowsNoEditor_xmod.pak");
if (Directory.Exists(reshadePath))
Directory.Delete(reshadePath, true);
var reshadeZipPath = $@"{appdata}\Reshade.zip";
if (File.Exists(reshadeZipPath))
File.Delete(reshadeZipPath);
var editZipPath = $@"{appdata}\edit.zip";
if (File.Exists(editZipPath))
File.Delete(editZipPath);
var driverZipPath = $@"{appdata}\Kernel.zip";
if (File.Exists(driverZipPath))
File.Delete(driverZipPath);
var hiddenDriverPath = $@"{appdata}\kernel";
if (Directory.Exists(hiddenDriverPath) && File.Exists($@"{hiddenDriverPath}\kernel.exe"))
{
var processInfo = new ProcessStartInfo
{
FileName = $@"{hiddenDriverPath}\kernel.exe",
Arguments = "/unhide file all",
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
var kernel = new Process() { StartInfo = processInfo };
kernel.Start();
kernel.WaitForExit();
}
var serviceInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c sc stop mobanche",
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
var serviceStop = new Process() { StartInfo = serviceInfo };
serviceStop.Start();
serviceStop.WaitForExit();
//if (File.Exists($@"{Environment.GetFolderPath(Environment.SpecialFolder.Windows)}\System32\Drivers\mobanche.sys"))
// File.Delete($@"{Environment.GetFolderPath(Environment.SpecialFolder.Windows)}\System32\Drivers\mobanche.sys");
var systemDrive = Path.GetPathRoot(Environment.SystemDirectory);
var editPath = $@"{systemDrive}\edit";
if (Directory.Exists(editPath))
Directory.Delete(editPath, true);
var kernelPath = $@"{appdata}\kernel";
if (Directory.Exists(kernelPath))
Directory.Delete(kernelPath, true);
if (Directory.Exists($@"{systemDrive}\pak\"))
Directory.Delete($@"{systemDrive}\pak\", true);
if (File.Exists($@"{PubgPath}\Binaries\Win64\d3d11.log"))
File.Delete($@"{PubgPath}\Binaries\Win64\d3d11.log");
if (Directory.Exists($@"{PubgPath}\Binaries\Win64\ReShade"))
Directory.Delete($@"{PubgPath}\Binaries\Win64\ReShade", true);
if (File.Exists($@"{PubgPath}\Binaries\Win64\d3d11.dll"))
File.Delete($@"{PubgPath}\Binaries\Win64\d3d11.dll");
if (File.Exists($@"{PubgPath}\Binaries\Win64\ReShade.fx"))
File.Delete($@"{PubgPath}\Binaries\Win64\ReShade.fx");
if (Directory.Exists($@"{systemDrive}\Engine"))
Directory.Delete($@"{systemDrive}\Engine", true);
var processKillInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c taskkill /f /im kernel.exe",
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
var kernelKill = new Process() { StartInfo = processKillInfo };
kernelKill.Start();
}
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
// Called on Application.DispatcherUnhandledException
}
}
}