-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (45 loc) · 1.72 KB
/
Program.cs
File metadata and controls
53 lines (45 loc) · 1.72 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
using System;
using System.IO;
using D3Edit.Core;
namespace D3Edit
{
internal static class Program
{
static int Main(string[] args)
{
if (args.Length != 2)
{
Console.Error.WriteLine("Usage: D3Edit <input> <output>");
return 2;
}
string inPath = args[0];
string outPath = args[1];
try
{
string inExt = Path.GetExtension(inPath).ToLowerInvariant();
string outExt = Path.GetExtension(outPath).ToLowerInvariant();
if (inExt == ".gam" && outExt == ".json")
return GamToJson.Convert(inPath, outPath);
if (inExt == ".json" && outExt == ".gam")
return JsonToGam.Convert(inPath, outPath);
if (inExt == ".qst" && outExt == ".json")
return QstToJson.Convert(inPath, outPath);
if (inExt == ".json" && outExt == ".qst")
return JsonToQst.Convert(inPath, outPath);
if (inExt == ".acr" && outExt == ".json")
return AcrToJson.Convert(inPath, outPath);
if (inExt == ".mon" && outExt == ".json")
return MonToJson.Convert(inPath, outPath);
if (inExt == ".json" && outExt == ".mon")
return JsonToMon.Convert(inPath, outPath);
Console.Error.WriteLine("Please read the ReadMe for supported filetypes and conversions.");
return 2;
}
catch (Exception ex)
{
Console.Error.WriteLine("FAIL: " + ex.Message);
return 1;
}
}
}
}