quantum-space-buddies/QNetWeaver/Program.cs

65 lines
1.4 KiB
C#
Raw Normal View History

2021-05-03 19:13:03 +00:00
using System;
using System.IO;
namespace QNetWeaver
{
public class Program
{
2021-05-03 19:27:52 +00:00
private static void Main(string[] args)
2021-05-03 19:13:03 +00:00
{
2021-05-03 21:18:30 +00:00
Console.WriteLine("Start weaving process.");
2021-05-03 19:13:03 +00:00
if (args.Length == 0)
{
Log.Error("No args supplied!");
}
var unityEngine = args[0];
var qnetDLL = args[1];
var unetDLL = args[2];
var outputDirectory = args[3];
var assembly = args[4];
2021-05-03 21:35:18 +00:00
CheckDLLPath(unityEngine);
CheckDLLPath(qnetDLL);
CheckDLLPath(unetDLL);
CheckOutputDirectory(outputDirectory);
CheckAssemblyPath(assembly);
2021-05-03 19:13:03 +00:00
Weaver.WeaveAssemblies(assembly, null, null, outputDirectory, unityEngine, qnetDLL, unetDLL);
}
private static void CheckDLLPath(string path)
{
2021-05-03 21:18:30 +00:00
Console.WriteLine($"Check dll {path} ...");
2021-05-03 19:13:03 +00:00
if (!File.Exists(path))
{
throw new Exception("dll could not be located at " + path + "!");
}
2021-06-18 21:40:38 +00:00
2021-05-03 21:18:30 +00:00
Console.WriteLine($"Path OK!");
2021-05-03 19:13:03 +00:00
}
private static void CheckAssemblyPath(string assemblyPath)
{
2021-05-03 21:18:30 +00:00
Console.WriteLine($"Check assembly path {assemblyPath} ...");
2021-05-03 19:13:03 +00:00
if (!File.Exists(assemblyPath))
{
throw new Exception("Assembly " + assemblyPath + " does not exist!");
}
2021-06-18 21:40:38 +00:00
2021-05-03 21:18:30 +00:00
Console.WriteLine($"Assembly Path OK!");
2021-05-03 19:13:03 +00:00
}
private static void CheckOutputDirectory(string outputDir)
{
2021-05-03 21:18:30 +00:00
Console.WriteLine($"Check output path {outputDir} ...");
2021-05-03 19:13:03 +00:00
if (!Directory.Exists(outputDir))
{
Directory.CreateDirectory(outputDir);
}
2021-06-18 21:40:38 +00:00
2021-05-03 21:18:30 +00:00
Console.WriteLine($"Output Path OK!");
2021-05-03 19:13:03 +00:00
}
}
}