-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
45 lines (42 loc) · 1.58 KB
/
Program.cs
File metadata and controls
45 lines (42 loc) · 1.58 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
using CommandLine;
using System;
namespace XmlToLuaTableConverter
{
class Program
{
public class Options
{
[Option('i', "input", Required = true, HelpText = "Path to the input XML file")]
public string InputFileName { get; set; }
[Option('o', "output", Required = false, HelpText = "Path to the output LUA file (default: same folder as the executable)")]
public string OutputFileName { get; set; }
}
static void Main(string[] args)
{
string xmlFileName = string.Empty;
string luaFileName = @".\MonolithDKP.lua";
Parser.Default.ParseArguments<Options>(args)
.WithParsed<Options>(o =>
{
xmlFileName = o.InputFileName;
if (o.OutputFileName != null && o.OutputFileName != "")
{
luaFileName = o.OutputFileName;
}
});
LuaConverter luaConverter = new LuaConverter();
Console.WriteLine("Starting to read XML data...");
var dkpEntryList = luaConverter.ReadXmlFile(xmlFileName);
Console.WriteLine("Convert data and write LUA table file...");
var result = luaConverter.WriteLuaTableFile(dkpEntryList, luaFileName);
if (result)
{
Console.WriteLine("Successfully finished the data convert!");
}
else
{
Console.WriteLine("Error occured during data convert!");
}
}
}
}