static void Main(string[] args) { // Load assemblies EmbeddedAssembly.Load("MCServer_World_Converter.Newtonsoft.Json.dll", "Newtonsoft.Json.dll"); EmbeddedAssembly.Load("MCServer_World_Converter.Substrate.dll", "Substrate.dll"); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); // Dirty hack for switching between console and GUI if (!IsRunningOnMono() && args.Length > 0) { AttachConsole(-1); } if (args.Length == 2) { if (!Directory.Exists(args[0])) { Console.WriteLine("Error: Source directory doesn't exist!"); return; } if (!Directory.Exists(args[1])) { Console.WriteLine("Error: Output directory doesn't exist!"); return; } MainForm.Run(args[0], args[1], true); } else if (args.Length > 0) { Console.WriteLine("Usage: MCServer.World.Converter <sourceDirectory> <outputDirectory>"); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } }
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { return(EmbeddedAssembly.Get(args.Name)); }