public static unsafe void Install2(PluginHeader *plugin) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //SplashScreen.Start(); m_ActiveWnd = SplashScreen.Instance; ClassicUOClient.UOFilePath = ((OnGetUOFilePath)Marshal.GetDelegateForFunctionPointer(plugin->GetUOFilePath, typeof(OnGetUOFilePath)) )(); ClassicUOClient cuo = new ClassicUOClient(); Client.Instance = cuo; cuo.InitPlugin(plugin); cuo.Init(false); cuo.RunUI(); //if (!(Client.Instance as ClassicUOClient).Install(plugin, HostExecutionContext, character)) //{ // Process.GetCurrentProcess().Kill(); // return; //} }
internal static unsafe void InitializePlugin(PluginHeader *plugin) { _onConnected = OnConnected; _onDisconnected = OnDisconnected; _onReceive = OnPacketReceive; _onSend = OnPacketSend; _onPlayerPositionChanged = OnPlayerPositionChanged; _onClientClosing = OnClientClosing; _onHotkeyPressed = OnHotkeyPressed; _onMouse = OnMouse; _onTick = OnTick; WindowHandle = plugin->HWND; plugin->OnConnected = Marshal.GetFunctionPointerForDelegate(_onConnected); plugin->OnDisconnected = Marshal.GetFunctionPointerForDelegate(_onDisconnected); plugin->OnRecv = Marshal.GetFunctionPointerForDelegate(_onReceive); plugin->OnSend = Marshal.GetFunctionPointerForDelegate(_onSend); plugin->OnPlayerPositionChanged = Marshal.GetFunctionPointerForDelegate(_onPlayerPositionChanged); plugin->OnClientClosing = Marshal.GetFunctionPointerForDelegate(_onClientClosing); plugin->OnHotkeyPressed = Marshal.GetFunctionPointerForDelegate(_onHotkeyPressed); plugin->OnMouse = Marshal.GetFunctionPointerForDelegate(_onMouse); plugin->Tick = Marshal.GetFunctionPointerForDelegate(_onTick); _getPacketLength = Marshal.GetDelegateForFunctionPointer <OnGetPacketLength>(plugin->GetPacketLength); _getUOFilePath = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(plugin->GetUOFilePath); _sendToClient = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Recv); _sendToServer = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Send); _requestMove = Marshal.GetDelegateForFunctionPointer <RequestMove>(plugin->RequestMove); _setTitle = Marshal.GetDelegateForFunctionPointer <OnSetTitle>(plugin->SetTitle); ClientPath = _getUOFilePath(); ClientVersion = new Version((byte)(plugin->ClientVersion >> 24), (byte)(plugin->ClientVersion >> 16), (byte)(plugin->ClientVersion >> 8), (byte)plugin->ClientVersion); if (!Path.IsPathRooted(ClientPath)) { ClientPath = Path.GetFullPath(ClientPath); } Art.Initialize(ClientPath); Hues.Initialize(ClientPath); Cliloc.Initialize(ClientPath); Skills.Initialize(ClientPath); Speech.Initialize(ClientPath); TileData.Initialize(ClientPath); Statics.Initialize(ClientPath); MapInfo.Initialize(ClientPath); ClassicAssembly = AppDomain.CurrentDomain.GetAssemblies() .FirstOrDefault(a => a.FullName.StartsWith("ClassicUO,")); InitializeExtensions(); }
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); } }
public unsafe bool Install(PluginHeader *header) { _sendToClient = (OnPacketSendRecv)Marshal.GetDelegateForFunctionPointer(header->Recv, typeof(OnPacketSendRecv)); _sendToServer = (OnPacketSendRecv)Marshal.GetDelegateForFunctionPointer(header->Send, typeof(OnPacketSendRecv)); _getPacketLength = (OnGetPacketLength)Marshal.GetDelegateForFunctionPointer(header->GetPacketLength, typeof(OnGetPacketLength)); _getPlayerPosition = (OnGetPlayerPosition)Marshal.GetDelegateForFunctionPointer(header->GetPlayerPosition, typeof(OnGetPlayerPosition)); _castSpell = (OnCastSpell)Marshal.GetDelegateForFunctionPointer(header->CastSpell, typeof(OnCastSpell)); _getStaticImage = (OnGetStaticImage)Marshal.GetDelegateForFunctionPointer(header->GetStaticImage, typeof(OnGetStaticImage)); _requestMove = (RequestMove)Marshal.GetDelegateForFunctionPointer(header->RequestMove, typeof(RequestMove)); _setTitle = (OnSetTitle)Marshal.GetDelegateForFunctionPointer(header->SetTitle, typeof(OnSetTitle)); _uoFilePath = (OnGetUOFilePath)Marshal.GetDelegateForFunctionPointer(header->GetUOFilePath, typeof(OnGetUOFilePath)); m_ClientVersion = new Version((byte)(header->ClientVersion >> 24), (byte)(header->ClientVersion >> 16), (byte)(header->ClientVersion >> 8), (byte)header->ClientVersion).ToString(); m_ClientRunning = true; m_ClientWindow = header->HWND; _tick = Tick; _recv = OnRecv; _send = OnSend; _onHotkeyPressed = OnHotKeyHandler; _onMouse = OnMouseHandler; _onUpdatePlayerPosition = OnPlayerPositionChanged; _onClientClose = OnClientClosing; _onInitialize = OnInitialize; _onConnected = OnConnected; _onDisconnected = OnDisconnected; _onFocusGained = OnFocusGained; _onFocusLost = OnFocusLost; header->Tick = Marshal.GetFunctionPointerForDelegate(_tick); header->OnRecv = Marshal.GetFunctionPointerForDelegate(_recv); header->OnSend = Marshal.GetFunctionPointerForDelegate(_send); header->OnHotkeyPressed = Marshal.GetFunctionPointerForDelegate(_onHotkeyPressed); header->OnMouse = Marshal.GetFunctionPointerForDelegate(_onMouse); header->OnPlayerPositionChanged = Marshal.GetFunctionPointerForDelegate(_onUpdatePlayerPosition); header->OnClientClosing = Marshal.GetFunctionPointerForDelegate(_onClientClose); header->OnInitialize = Marshal.GetFunctionPointerForDelegate(_onInitialize); header->OnConnected = Marshal.GetFunctionPointerForDelegate(_onConnected); header->OnDisconnected = Marshal.GetFunctionPointerForDelegate(_onDisconnected); header->OnFocusGained = Marshal.GetFunctionPointerForDelegate(_onFocusGained); header->OnFocusLost = Marshal.GetFunctionPointerForDelegate(_onFocusLost); return(true); }
public static unsafe void Install(PluginHeader *plugin) { Initialize(); InitializePlugin(plugin); _mainThread = new Thread(() => { _window = new MainWindow(); _window.ShowDialog(); }) { IsBackground = true }; _mainThread.SetApartmentState(ApartmentState.STA); _mainThread.Start(); }
internal static unsafe void InitializePlugin(PluginHeader *plugin) { _onConnected = OnConnected; _onDisconnected = OnDisconnected; _onReceive = OnPacketReceive; _onSend = OnPacketSend; _onPlayerPositionChanged = OnPlayerPositionChanged; _onClientClosing = OnClientClosing; _onHotkeyPressed = OnHotkeyPressed; _onMouse = OnMouse; _hWnd = plugin->HWND; plugin->OnConnected = Marshal.GetFunctionPointerForDelegate(_onConnected); plugin->OnDisconnected = Marshal.GetFunctionPointerForDelegate(_onDisconnected); plugin->OnRecv = Marshal.GetFunctionPointerForDelegate(_onReceive); plugin->OnSend = Marshal.GetFunctionPointerForDelegate(_onSend); plugin->OnPlayerPositionChanged = Marshal.GetFunctionPointerForDelegate(_onPlayerPositionChanged); plugin->OnClientClosing = Marshal.GetFunctionPointerForDelegate(_onClientClosing); plugin->OnHotkeyPressed = Marshal.GetFunctionPointerForDelegate(_onHotkeyPressed); plugin->OnMouse = Marshal.GetFunctionPointerForDelegate(_onMouse); _getPacketLength = Marshal.GetDelegateForFunctionPointer <OnGetPacketLength>(plugin->GetPacketLength); _getUOFilePath = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(plugin->GetUOFilePath); _sendToClient = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Recv); _sendToServer = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Send); _requestMove = Marshal.GetDelegateForFunctionPointer <RequestMove>(plugin->RequestMove); ClientPath = _getUOFilePath(); if (!Path.IsPathRooted(ClientPath)) { ClientPath = Path.GetFullPath(ClientPath); } Art.Initialize(ClientPath); Hues.Initialize(ClientPath); Cliloc.Initialize(ClientPath); Skills.Initialize(ClientPath); Speech.Initialize(ClientPath); TileData.Initialize(ClientPath); }
public static unsafe void Install2(PluginHeader *plugin, string shard_host) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); 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")))); }; //SplashScreen.Start(); m_ActiveWnd = SplashScreen.Instance; ClassicUOClient.ShardHost = shard_host; ClassicUOClient cuo = new ClassicUOClient(); Client.Instance = cuo; cuo.InitPlugin(plugin); cuo.Init(false); cuo.RunUI(); //if (!(Client.Instance as ClassicUOClient).Install(plugin, HostExecutionContext, character)) //{ // Process.GetCurrentProcess().Kill(); // return; //} }
internal static bool InstallHooks(PluginHeader *header) { _sendToClient = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(header->Recv); _sendToServer = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(header->Send); _getPacketLength = Marshal.GetDelegateForFunctionPointer <OnGetPacketLength>(header->GetPacketLength); _getPlayerPosition = Marshal.GetDelegateForFunctionPointer <OnGetPlayerPosition>(header->GetPlayerPosition); _castSpell = Marshal.GetDelegateForFunctionPointer <OnCastSpell>(header->CastSpell); _getStaticImage = Marshal.GetDelegateForFunctionPointer <OnGetStaticImage>(header->GetStaticImage); _requestMove = Marshal.GetDelegateForFunctionPointer <RequestMove>(header->RequestMove); ClientWindow = header->HWND; _onTick = Tick; _recv = OnRecv; _send = OnSend; _onHotkeyPressed = OnHotKeyHandler; _onMouse = OnMouseHandler; _onUpdatePlayerPosition = OnPlayerPositionChanged; _onClientClose = OnClientClosing; _onInitialize = OnInitialize; _onConnected = OnConnected; _onDisconnected = OnDisconnected; // _onFocusGained = OnFocusGained; // _onFocusLost = OnFocusLost; header->OnRecv = Marshal.GetFunctionPointerForDelegate(_recv); header->OnSend = Marshal.GetFunctionPointerForDelegate(_send); header->OnHotkeyPressed = Marshal.GetFunctionPointerForDelegate(_onHotkeyPressed); header->OnMouse = Marshal.GetFunctionPointerForDelegate(_onMouse); header->OnPlayerPositionChanged = Marshal.GetFunctionPointerForDelegate(_onUpdatePlayerPosition); header->OnClientClosing = Marshal.GetFunctionPointerForDelegate(_onClientClose); header->OnInitialize = Marshal.GetFunctionPointerForDelegate(_onInitialize); header->OnConnected = Marshal.GetFunctionPointerForDelegate(_onConnected); header->OnDisconnected = Marshal.GetFunctionPointerForDelegate(_onDisconnected); // header->OnFocusGained = Marshal.GetFunctionPointerForDelegate( _onFocusGained ); // header->OnFocusLost = Marshal.GetFunctionPointerForDelegate( _onFocusLost ); header->Tick = Marshal.GetFunctionPointerForDelegate(_onTick); return(true); }
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; }
public static unsafe void Install(PluginHeader *plugin) { 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")))); }; //ClassicUO.Configuration.Settings settings = ClassicUO.Configuration.Settings.Get(); Install2(plugin); }
public static unsafe void Install(PluginHeader *plugin) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); 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")))); }; SplashScreen.Start(); m_ActiveWnd = SplashScreen.Instance; Client.Init(false); if (!(Client.Instance as ClassicUOClient).Install(plugin)) { Process.GetCurrentProcess().Kill(); return; } /* Load localization files */ if (!Language.Load("ENU")) { SplashScreen.End(); MessageBox.Show( String.Format( "WARNING: Razor was unable to load the file Language/Razor_lang.ENU\n."), "Language Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } m_Running = true; string clientPath = ((OnGetUOFilePath)Marshal.GetDelegateForFunctionPointer(plugin->GetUOFilePath, typeof(OnGetUOFilePath)) )(); Ultima.Files.SetMulPath(clientPath); Ultima.Multis.PostHSFormat = UsePostHSChanges; Client.Instance.ClientEncrypted = false; Client.Instance.ServerEncrypted = false; Language.LoadCliLoc(); /* Initialize engine */ SplashScreen.Message = LocString.Initializing; Initialize(typeof(Engine).Assembly); /* Load Profile */ SplashScreen.Message = LocString.LoadingLastProfile; Config.LoadCharList(); if (!Config.LoadLastProfile()) { MessageBox.Show( "The selected profile could not be loaded, using default instead.", "Profile Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } SplashScreen.Message = LocString.WaitingForClient; SplashScreen.End(); Thread t = new Thread(() => { RunUI(); }); t.SetApartmentState(ApartmentState.STA); t.IsBackground = true; t.Start(); }
public static unsafe void Install(PluginHeader *plugin) { ClassicUO.Configuration.Settings settings = ClassicUO.Configuration.Settings.Get(); Install2(plugin, settings.IP); }