-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (49 loc) · 2.23 KB
/
Program.cs
File metadata and controls
57 lines (49 loc) · 2.23 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.IO;
namespace Memoria.Compiler
{
internal static class Program
{
private const String DefaultReferencesPath64 = "../../../x64/FF9_Data/Managed/";
private const String DefaultReferencesPath86 = "../../../x86/FF9_Data/Managed/";
private const String DefaultSourcesPath = "../Sources/";
private const String DefaultOutputPath = "../";
private const String DefaultOutputName = "Memoria.Scripts.dll";
internal static void Main(String[] args)
{
try
{
Compile();
Console.WriteLine("Success!");
}
catch (Exception ex)
{
Console.WriteLine(ex);
Console.WriteLine("Fail!");
}
Console.WriteLine("Press enter to exit...");
Console.ReadLine();
}
private static void Compile()
{
String referencesDirectoryPath;
if (Directory.Exists(DefaultReferencesPath64))
referencesDirectoryPath = Path.GetFullPath(DefaultReferencesPath64);
else if (Directory.Exists(DefaultReferencesPath86))
referencesDirectoryPath = Path.GetFullPath(DefaultReferencesPath86);
else
throw new DirectoryNotFoundException("Cannot find the directory \"FF9_Data/Managed/\"");
String sourcesDirectoryPath = Path.GetFullPath(DefaultSourcesPath);
if (!Directory.Exists(sourcesDirectoryPath))
throw new DirectoryNotFoundException("Directory not found: " + sourcesDirectoryPath);
String outputDirectoryPath = Path.GetFullPath(DefaultOutputPath);
if (!Directory.Exists(outputDirectoryPath))
throw new DirectoryNotFoundException("Directory not found: " + outputDirectoryPath);
String outputFileName = DefaultOutputName;
if (String.IsNullOrWhiteSpace(outputFileName))
throw new InvalidDataException("You must specify a name for output file.");
Compiler compiler = new Compiler(referencesDirectoryPath, sourcesDirectoryPath, outputDirectoryPath, outputFileName);
compiler.Compile();
}
}
}