Beispiel #1
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;
        }