-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (53 loc) · 1.82 KB
/
Program.cs
File metadata and controls
57 lines (53 loc) · 1.82 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
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace SentinelLoader
{
internal static class Program
{
[STAThread]
static void Main()
{
const string US_EXE = "BCDx36HP_Sentinel.exe";
const string EU_EXE = "UBCD3600XLT_Sentinel.exe";
Dictionary<uint, uint> d = new Dictionary<uint, uint>
{
{ 512000000u, 757999999u },
{ 823987500u, 849012499u },
{ 868987500u, 894012499u },
{ 960000000u, 1239999999u },
};
try
{
string exeFilename = string.Empty;
if (File.Exists(US_EXE))
exeFilename = US_EXE;
else if (File.Exists(EU_EXE))
exeFilename = EU_EXE;
else
{
MessageBox.Show("No executable Sentinel file found!", "Error");
return;
}
Assembly asm = Assembly.LoadFrom(exeFilename);
var freqLibType = asm.GetType("HomePatrol_Sentinel.FrequencyLib");
var freqTableField = freqLibType.GetField("FrequencyTable", BindingFlags.Static | BindingFlags.NonPublic);
var freqTable = freqTableField.GetValue(null) as uint[,];
for (var i = 0; i < freqTable.GetLength(0); i++)
{
if (d.ContainsKey(freqTable[i, 1]))
{
freqTable[i, 1] = d[freqTable[i, 1]];
}
}
asm.EntryPoint.Invoke(null, null);
}
catch
{
MessageBox.Show("Something wrong!","Exception");
}
}
}
}