-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
59 lines (49 loc) · 2.34 KB
/
Program.cs
File metadata and controls
59 lines (49 loc) · 2.34 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
using DB2StructGenerator.StructGenerators;
namespace DB2StructGenerator
{
internal class Program
{
static void Main(string[] args)
{
if (!Directory.Exists("definitions") || Directory.GetFiles("definitions").Length == 0)
{
Console.WriteLine("The definitions folder does not exist or is empty. The programm cannot function this way.");
Console.WriteLine("Please download the definitions from https://github.com/wowdev/WoWDBDefs and place the 'definitions' folder into this application's directory.");
printExitPrompt();
return;
}
Console.WriteLine("NOTE: if you want to update an existing DB2Structure.h file, please put the old header file into this application's directory and use the 'DB2StructureUpdated.h' file for updating your source");
Console.WriteLine("");
Console.WriteLine("Please insert build number (e.g. 65299)");
int buildNumber = 0;
while (buildNumber == 0)
{
if (!int.TryParse(Console.ReadLine(), out int inputBuildNumber) || inputBuildNumber == 0)
{
Console.WriteLine("Could not read provided build input. Please try again.");
continue;
}
buildNumber = inputBuildNumber;
}
DBDStorage storage = new();
storage.ReadDefinitions(buildNumber);
if (storage.Definitions.IsEmpty)
{
Console.WriteLine("Definitions have been read but no valid data has been extracted. Please make sure the definitions are up to date or update the DBDefsLib if the format should have changed.");
printExitPrompt();
return;
}
CppStructGenerator cppStructGenerator = new(storage.Definitions, buildNumber);
cppStructGenerator.GenerateStructs();
CsStructGenerator csStruct = new(storage.Definitions, buildNumber);
csStruct.GenerateStructs();
Console.WriteLine($"All done. C++ and C# structs have been generated.");
printExitPrompt();
}
private static void printExitPrompt()
{
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
}
}
}