Return exit values through wrapper.

release-1.1.0
Icedream 2015-01-16 10:25:16 +01:00
parent e5d1675ee6
commit 364fee11dd
1 changed files with 13 additions and 4 deletions

View File

@ -1,18 +1,27 @@
using System.Linq; using System;
using System.IO;
using System.Reflection; using System.Reflection;
// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace
internal class Program internal static class Program
{ {
private static void Main(string[] args) private static int Main(string[] args)
{ {
// Mono's XBuild uses assembly redirects to make sure it uses .NET 4.5 target binaries.
// We emulate it using our own assembly redirector.
AppDomain.CurrentDomain.AssemblyLoad += (sender, e) =>
{
var assemblyName = e.LoadedAssembly.GetName();
Console.WriteLine("Assembly load: {0}", assemblyName);
};
var mainAsm = Assembly.Load("citizenmp_server_updater"); var mainAsm = Assembly.Load("citizenmp_server_updater");
mainAsm.GetType("Costura.AssemblyLoader") mainAsm.GetType("Costura.AssemblyLoader")
.GetMethod("Attach") .GetMethod("Attach")
.Invoke(null, null); .Invoke(null, null);
mainAsm.GetType("CitizenMP.Server.Installer.Program") return (int) mainAsm.GetType("CitizenMP.Server.Installer.Program")
.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static) .GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static)
.Invoke(null, new object[] {args}); .Invoke(null, new object[] {args});
} }