-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
77 lines (68 loc) · 2.78 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
using MySqlConnector;
using WoWTools.WDBUpdater.Parsers;
namespace WoWTools.WDBUpdater
{
internal class Program
{
static void Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine(String.Format("Usage: {0} wdbfile mysql/txt", System.AppDomain.CurrentDomain.FriendlyName));
return;
}
HashSet<UInt32> acceptedBuild = null;
if (args.Length >= 3)
{
if (args[2] == "onlyretail")
{
acceptedBuild = new HashSet<UInt32>();
using (var connection = new MySqlConnection(SettingsManager.connectionString))
{
connection.Open();
using (var command = new MySqlCommand("SELECT build FROM `wowtools`.`wow_builds` WHERE `branch` = \"Retail\"", connection))
{
using (MySqlDataReader mreader = command.ExecuteReader())
{
while (mreader.Read())
{
acceptedBuild.Add(mreader.GetUInt32(0));
}
}
}
}
}
}
WDBReader reader = new WDBReader(args[0]);
if (!reader.Read(acceptedBuild))
return;
QuestCache.Parse(reader);
CreatureCache.Parse(reader);
GameObejctCache.Parse(reader);
PageTextCache.Parse(reader);
NpcCache.Parse(reader);
switch (args[1])
{
case "txt":
Utils.Dumper<QuestCache>.DumpWDBText();
Utils.Dumper<CreatureCache>.DumpWDBText();
Utils.Dumper<GameObejctCache>.DumpWDBText();
Utils.Dumper<PageTextCache>.DumpWDBText();
Utils.Dumper<NpcCache>.DumpWDBText();
break;
case "mysql":
using (var connection = new MySqlConnection(SettingsManager.connectionString))
{
connection.Open();
Utils.Dumper<QuestCache>.DumpToSql(connection, reader);
Utils.Dumper<CreatureCache>.DumpToSql(connection, reader);
Utils.Dumper<GameObejctCache>.DumpToSql(connection, reader);
Utils.Dumper<PageTextCache>.DumpToSql(connection, reader);
Utils.Dumper<NpcCache>.DumpToSql(connection, reader);
}
break;
}
Console.WriteLine(reader.dataTable.Count);
}
}
}