コード例 #1
0
        public static unsafe void Install(PluginHeader *header)
        {
            Console.WriteLine("Install Invoked CEasyUO");
            AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
            {
                string[] fields  = e.Name.Split(',');
                string   name    = fields[0];
                string   culture = fields[2];

                if (name.EndsWith(".resources") && !culture.EndsWith("neutral"))
                {
                    return(null);
                }
                AssemblyName askedassembly = new AssemblyName(e.Name);

                bool isdll = File.Exists(Path.Combine(RootPath, askedassembly.Name + ".dll"));

                return(Assembly.LoadFile(Path.Combine(RootPath, askedassembly.Name + (isdll ? ".dll" : ".exe"))));
            };
            try
            {
                ClientVersion = (ClientVersions)header->ClientVersion;
                if (!ClientCommunication.InstallHooks(header))
                {
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    return;
                }
                UOFilePath = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(header->GetUOFilePath)();
                Ultima.Files.SetMulPath(UOFilePath);
                Ultima.Multis.PostHSFormat = UsePostHSChanges;
                // Thread t = new Thread( () =>
                // {
                //Thread.CurrentThread.Name = "EasyUO Main Thread";
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                m_MainForm = new CEasyUOMainForm();
                m_MainForm.Show();
                //  } );
                //   t.SetApartmentState( ApartmentState.STA );
                PacketHandlers.Initialize();
                // Targeting.Initialize();
                Spell.Initialize(); EUOVars.Initialize();
                // t.IsBackground = true;

                //  t.Start();
                IsInstalled = true;
            }
            catch (Exception e)
            {
                Debugger.Break();
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
0
        public static unsafe void Install(PluginHeader *header)
        {
            Console.WriteLine("Install Invoked CEasyUO");
            ClientVersion = (ClientVersions)header->ClientVersion;
            try
            {
                PacketHandlers.Initialize();
                Targeting.Initialize();
                Spell.Initialize();
                if (!ClientCommunication.InstallHooks(header))
                {
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    return;
                }
                string clientPath = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(header->GetUOFilePath)();
                Ultima.Files.SetMulPath(clientPath);
                Ultima.Multis.PostHSFormat = UsePostHSChanges;
            }
            catch (Exception e)
            {
            }

            Thread t = new Thread(() =>
            {
                Thread.CurrentThread.Name = "EasyUO Main Thread";
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            });

            t.SetApartmentState(ApartmentState.STA);

            t.IsBackground = true;

            t.Start();
            IsInstalled = true;
        }