void Run() { game = new Game(); try { LogStart("Initializing database"); Database.Initialize(SharpOT.Properties.Settings.Default.DatabaseFile); LogDone(); LogStart("Loading items"); ItemInfo.LoadItemsOtb(SharpOT.Properties.Settings.Default.ItemsOtbFile); ItemInfo.LoadItemsXml(SharpOT.Properties.Settings.Default.ItemsXmlFile); LogDone(); LogStart("Loading map"); game.Map.Load(); LogDone(); LogStart("Loading scripts"); string errors = Scripting.ScriptManager.LoadAllScripts(game); LogDone(); if (errors.Length > 0) { Log("There were errors when compiling scripts:\n\n" + errors); } LogStart("Listening for clients"); clientLoginListener.Start(); clientLoginListener.BeginAcceptSocket(new AsyncCallback(LoginListenerCallback), clientLoginListener); clientGameListener.Start(); clientGameListener.BeginAcceptSocket(new AsyncCallback(GameListenerCallback), clientGameListener); LogDone(); } catch (Exception e) { LogError(e.ToString()); if (Debugger.IsAttached) { throw; } } while (true) { bool exit = false; string line = Console.ReadLine(); switch (line.ToLower()) { case "exit": exit = true; break; case "reloadscripts": ScriptManager.ReloadAllScripts(game); break; } if (exit) { break; } } connections.ForEach(c => c.Close()); clientGameListener.Stop(); clientLoginListener.Stop(); }