-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
81 lines (68 loc) · 2.42 KB
/
Program.cs
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
// Source code of DDS Fixer
// Made by Ondra907
// https://github.com/Ondra9071/Drug-Dealer-Simulator-1-Fixer
using System;
using System.Diagnostics;
using Microsoft.Win32;
class Program
{
static void Main()
{
string name = "OPENSSL_ia32cap";
string _value = "~0x200000200000000";
Console.Title = "Drug Dealer Simulator Fixer";
SetSystemEnvironmentVariableWindows(name, _value);
}
static void SetSystemEnvironmentVariableWindows(string variableName, string variableValue)
{
string logs = "logs.txt";
try
{
using (var envKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", true))
{
if (envKey == null)
{
Console.WriteLine("Failed to open system environment key.");
WriteLog(logs, "Failed to open system environment key.");
return;
}
envKey.SetValue(variableName, variableValue);
envKey.Close();
}
WriteLog(logs, "System environment variable set on Windows.");
Console.WriteLine(@"Drug Dealer Simulator 1 was successfully fixed.
If you still can't start your game, try restarting PC.
Press anything to close the application.");
Console.ReadKey();
}
catch (Exception ex)
{
WriteLog(logs, ex.Message);
CallError(logs, ex);
}
}
static void WriteLog(string filePath, string message)
{
try
{
using (StreamWriter writer = File.AppendText(filePath))
{
string logEntry = $"[{(DateTime.Now).ToString().Replace(" ", ", ")}]: {message}";
writer.WriteLine(logEntry);
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
static void CallError(string logs, Exception ex)
{
WriteLog(logs, ex.Message);
Console.WriteLine("An error occurred, see more in the logs. Press 1 to see logs, anything else to end application");
ConsoleKeyInfo keyInfo = Console.ReadKey();
if (keyInfo.Key == ConsoleKey.D1 || keyInfo.Key == ConsoleKey.NumPad1) Process.Start("notepad.exe", logs);
Environment.Exit(0);
}
}