public void Run(string[] args) { // TODO: Print version information #if DEBUG // TODO: Print "DEBUGGING ON"-message Log.WriteDebug("Debugging on."); #endif // Load configuration // Remove configuration asm/ if (Directory.Exists("asm")) Directory.Delete("asm", true); string configFile = "config.cs"; // Read config file in command line argument if (args.Length > 0) { if (!File.Exists(args[0])) { Console.WriteLine("Usage: mono cyclops.exe [config file]"); Console.WriteLine(); return; } else { configFile = args[0]; } } if (!File.Exists(configFile)) { // TODO: Create new template config file configFile = "config.cs"; } Log.WriteBegin("Loading config file (" + configFile + ")..."); try { DynamicCompile compiler = new DynamicCompile(); Dictionary<string, string> values = (Dictionary<string, string>) compiler.Compile(configFile, null); Config.Load(values); } catch (Exception e) { Log.WriteError(e.ToString()); return; } Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading items..."); Item.LoadItems(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading spells..."); Spell.Load(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading monsters..."); Monster.Load(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading commands..."); Command.Load(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading map..."); Map map = Map.Load(); world = new GameWorld(map); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading non-person characters..."); NPC.Load(); List<NPC> allNPCs = NPC.GetAllNPCs(); foreach (NPC npc in allNPCs) world.SendAddNPC(npc, npc.CurrentPosition); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading monster spawns..."); Respawn.Load(world); Log.WriteEnd(); // TODO: Write load-message (listener) Log.WriteBegin("Starting TCP listener..."); listener = new TcpListener(IPAddress.Any, Config.GetPort()); listener.Start(); Log.WriteEnd(); Log.WriteLine("Server is now running."); // TODO: Write message: SERVER NOW RUNNING AcceptConnections(); }
public void Run(string[] args) { // TODO: Print version information #if DEBUG // TODO: Print "DEBUGGING ON"-message Log.WriteDebug("Debugging on."); #endif // Load configuration // Remove configuration asm/ if (Directory.Exists("asm")) { Directory.Delete("asm", true); } string configFile = "config.cs"; // Read config file in command line argument if (args.Length > 0) { if (!File.Exists(args[0])) { Console.WriteLine("Usage: mono cyclops.exe [config file]"); Console.WriteLine(); return; } else { configFile = args[0]; } } if (!File.Exists(configFile)) { // TODO: Create new template config file configFile = "config.cs"; } Log.WriteBegin("Loading config file (" + configFile + ")..."); try { DynamicCompile compiler = new DynamicCompile(); Dictionary <string, string> values = (Dictionary <string, string>)compiler.Compile(configFile, null); Config.Load(values); } catch (Exception e) { Log.WriteError(e.ToString()); return; } Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading items..."); Item.LoadItems(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading spells..."); Spell.Load(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading monsters..."); Monster.Load(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading commands..."); Command.Load(); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading map..."); Map map = Map.Load(); world = new GameWorld(map); Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading non-person characters..."); NPC.Load(); List <NPC> allNPCs = NPC.GetAllNPCs(); foreach (NPC npc in allNPCs) { world.SendAddNPC(npc, npc.CurrentPosition); } Log.WriteEnd(); // TODO: Write load-message Log.WriteBegin("Loading monster spawns..."); Respawn.Load(world); Log.WriteEnd(); // TODO: Write load-message (listener) Log.WriteBegin("Starting TCP listener..."); listener = new TcpListener(IPAddress.Any, Config.GetPort()); listener.Start(); Log.WriteEnd(); Log.WriteLine("Server is now running."); // TODO: Write message: SERVER NOW RUNNING AcceptConnections(); }