forked from sfmax54/Superior-Injector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.cs
58 lines (55 loc) · 2.31 KB
/
Config.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
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Superior_Injector
{
class Config
{
public static int InjectionDelay = 0;
public static string InjectionMethod = "LoadLibrary";
public static string Process = string.Empty;
public static bool AsyncInjection = true;
public static bool SecureMode = false;
public static List<string> DLLPathes = new List<string>();
public static void SaveConfig()
{
string config = "InjectionDelay=" + InjectionDelay + ";" +
"InjectionMethod=" + InjectionMethod + ";" +
"Process=" + Process + ";" +
"AsyncInjection=" + AsyncInjection + ";" +
"SecureMode=" + SecureMode + ";";
if (DLLPathes.Count > 0)
{
config += "DLLList=" + string.Join(",", DLLPathes) + ";";
}
File.WriteAllText("config.ini", Convert.ToBase64String(Encoding.ASCII.GetBytes(config)));
}
public static void LoadConfig()
{
if (File.Exists("config.ini"))
{
try
{
string config = Encoding.ASCII.GetString(Convert.FromBase64String(File.ReadAllText("config.ini")));
foreach (var item in config.Split(';'))
{
var separateditem = item.Split('=');
switch (separateditem[0])
{
case "InjectionDelay": InjectionDelay = int.Parse(separateditem[1]); break;
case "InjectionMethod": InjectionMethod = separateditem[1]; break;
case "Process": Process = separateditem[1]; break;
case "AsyncInjection": AsyncInjection = bool.Parse(separateditem[1]); break;
case "SecureMode": SecureMode = bool.Parse(separateditem[1]); break;
case "DLLList": DLLPathes = new List<string>(separateditem[1].Split(',')); break;
}
}
} catch
{
File.Delete("config.ini");
}
}
}
}
}