Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Error with PlusEmulator
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="tyutu" data-source="post: 436439" data-attributes="member: 71974"><p>Open your emulator in visual studio and swap program.cs for this:</p><p></p><p>[CODE]using System;</p><p>using System.Runtime.InteropServices;</p><p>using System.Security.Permissions;</p><p>using Plus.Core;</p><p>using log4net.Config;</p><p></p><p>namespace Plus</p><p>{</p><p> public static class Program</p><p> {</p><p> private const int MF_BYCOMMAND = 0x00000000;</p><p> public const int SC_CLOSE = 0xF060;</p><p></p><p> [DllImport("Kernel32")]</p><p> private static extern bool SetConsoleCtrlHandler(EventHandler handler, bool add);</p><p></p><p> [DllImport("user32.dll")]</p><p> public static extern int DeleteMenu(IntPtr hMenu, int nPosition, int wFlags);</p><p></p><p> [DllImport("user32.dll")]</p><p> private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);</p><p></p><p> [DllImport("kernel32.dll", ExactSpelling = true)]</p><p> private static extern IntPtr GetConsoleWindow();</p><p></p><p> [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlAppDomain)]</p><p></p><p> public static void Main(string[] Args)</p><p> {</p><p> DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND);</p><p></p><p> XmlConfigurator.Configure();</p><p></p><p> Console.ForegroundColor = ConsoleColor.White;</p><p> Console.CursorVisible = false;</p><p> AppDomain currentDomain = AppDomain.CurrentDomain;</p><p> currentDomain.UnhandledException += MyHandler;</p><p></p><p> PlusEnvironment.Initialize();</p><p></p><p> while (true)</p><p> {</p><p> if (Console.ReadKey(true).Key == ConsoleKey.Enter)</p><p> {</p><p> Console.Write("plus> ");</p><p> string Input = Console.ReadLine();</p><p></p><p> if (Input.Length > 0)</p><p> {</p><p> string s = Input.Split(' ')[0];</p><p></p><p> ConsoleCommands.InvokeCommand(s);</p><p> }</p><p> }</p><p> }</p><p> }</p><p></p><p> private static void MyHandler(object sender, UnhandledExceptionEventArgs args)</p><p> {</p><p> var e = (Exception) args.ExceptionObject;</p><p> //Logger.LogCriticalException("SYSTEM CRITICAL EXCEPTION: " + e);</p><p> PlusEnvironment.PerformShutDown();</p><p> }</p><p></p><p> private enum CtrlType</p><p> {</p><p> CTRL_C_EVENT = 0,</p><p> CTRL_BREAK_EVENT = 1,</p><p> CTRL_CLOSE_EVENT = 2,</p><p> CTRL_LOGOFF_EVENT = 5,</p><p> CTRL_SHUTDOWN_EVENT = 6</p><p> }</p><p></p><p> private delegate bool EventHandler(CtrlType sig);</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="tyutu, post: 436439, member: 71974"] Open your emulator in visual studio and swap program.cs for this: [CODE]using System; using System.Runtime.InteropServices; using System.Security.Permissions; using Plus.Core; using log4net.Config; namespace Plus { public static class Program { private const int MF_BYCOMMAND = 0x00000000; public const int SC_CLOSE = 0xF060; [DllImport("Kernel32")] private static extern bool SetConsoleCtrlHandler(EventHandler handler, bool add); [DllImport("user32.dll")] public static extern int DeleteMenu(IntPtr hMenu, int nPosition, int wFlags); [DllImport("user32.dll")] private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); [DllImport("kernel32.dll", ExactSpelling = true)] private static extern IntPtr GetConsoleWindow(); [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlAppDomain)] public static void Main(string[] Args) { DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND); XmlConfigurator.Configure(); Console.ForegroundColor = ConsoleColor.White; Console.CursorVisible = false; AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += MyHandler; PlusEnvironment.Initialize(); while (true) { if (Console.ReadKey(true).Key == ConsoleKey.Enter) { Console.Write("plus> "); string Input = Console.ReadLine(); if (Input.Length > 0) { string s = Input.Split(' ')[0]; ConsoleCommands.InvokeCommand(s); } } } } private static void MyHandler(object sender, UnhandledExceptionEventArgs args) { var e = (Exception) args.ExceptionObject; //Logger.LogCriticalException("SYSTEM CRITICAL EXCEPTION: " + e); PlusEnvironment.PerformShutDown(); } private enum CtrlType { CTRL_C_EVENT = 0, CTRL_BREAK_EVENT = 1, CTRL_CLOSE_EVENT = 2, CTRL_LOGOFF_EVENT = 5, CTRL_SHUTDOWN_EVENT = 6 } private delegate bool EventHandler(CtrlType sig); } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Error with PlusEmulator
Top