Ejemplo n.º 1
0
        public static void LoadOnCurrentApplicationDomain(
            IntPtr gameDllNameAsPointer,
            IntPtr gameTypeNameAsPointer,
            int currentPlatformAsInteger)
        {
            Platform currentPlatform = (Platform)currentPlatformAsInteger;

            ApplicationPlatform.Initialize(currentPlatform, Controller.RuntimeLibrary);
            string stringAnsi1 = Marshal.PtrToStringAnsi(gameDllNameAsPointer);
            string stringAnsi2 = Marshal.PtrToStringAnsi(gameTypeNameAsPointer);

            Debug.Print("Appending private path to current application domain.");
            AppDomain.CurrentDomain.AppendPrivatePath(ManagedDllFolder.Name);
            Debug.Print("Creating GameApplicationDomainController on current application domain.");
            GameApplicationDomainController domainController = new GameApplicationDomainController(false);

            if (domainController == null)
            {
                Console.WriteLine("GameApplicationDomainController is NULL!");
                Console.WriteLine("Press a key to continue...");
                Console.ReadKey();
            }
            if (Controller.RuntimeLibrary == TaleWorlds.Library.Runtime.Mono)
            {
                Debug.Print("Initializing GameApplicationDomainController as Mono.");
                domainController.LoadAsMono(Controller._passManagedInitializeMethodPointer, Controller._passManagedCallbackMethodPointer, stringAnsi1, stringAnsi2, currentPlatform);
            }
            else
            {
                Debug.Print("Initializing GameApplicationDomainController as Dot Net.");
                domainController.Load(Controller._passManagedInitializeMethod, Controller._passManagedCallbackMethod, stringAnsi1, stringAnsi2, currentPlatform);
            }
        }
 public GameApplicationDomainController()
 {
     Debug.Print("Constructing GameApplicationDomainController.");
     GameApplicationDomainController._instance = this;
     this._newApplicationDomain = true;
 }