Exemple #1
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs sargs)
            {
                string resourceName = new AssemblyName(sargs.Name).Name + ".dll";
                string text         = Array.Find <string>(typeof(Program).Assembly.GetManifestResourceNames(), (string element) => element.EndsWith(resourceName));
                if (text == null)
                {
                    return(null);
                }
                Assembly result;
                using (Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text))
                {
                    byte[] array = new byte[manifestResourceStream.Length];
                    manifestResourceStream.Read(array, 0, array.Length);
                    result = Assembly.Load(array);
                }
                return(result);
            };
#if SERVER
            WindowsLaunch._handleRoutine = new WindowsLaunch.HandlerRoutine(WindowsLaunch.ConsoleCtrlCheck);
            WindowsLaunch.SetConsoleCtrlHandler(WindowsLaunch._handleRoutine, true);
#endif
            Program.LaunchGame(args, false);
        }
Exemple #2
0
 private static void Main(string[] args)
 {
     AppDomain.CurrentDomain.AssemblyResolve += (ResolveEventHandler)((sender, sargs) =>
     {
         string resourceName = new AssemblyName(sargs.Name).Name + ".dll";
         string name = Array.Find <string>(typeof(Program).Assembly.GetManifestResourceNames(), (Predicate <string>)(element => element.EndsWith(resourceName)));
         if (name == null)
         {
             return((Assembly)null);
         }
         using (Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
         {
             byte[] numArray = new byte[manifestResourceStream.Length];
             manifestResourceStream.Read(numArray, 0, numArray.Length);
             return(Assembly.Load(numArray));
         }
     });
     WindowsLaunch._handleRoutine = new WindowsLaunch.HandlerRoutine(WindowsLaunch.ConsoleCtrlCheck);
     WindowsLaunch.SetConsoleCtrlHandler(WindowsLaunch._handleRoutine, true);
     Program.LaunchGame(args, false);
 }