private static void Compile(Object arg, string path) { FileInfo[] fileList = new DirectoryInfo(path).GetFiles(); DynamicCompile dCompile = new DynamicCompile(); foreach (FileInfo info in fileList) { dCompile.Compile(path + info.Name, arg); } }
private static void Compile(string path, Dictionary <string, SpellInfo> dict) { FileInfo[] fileList = new DirectoryInfo(path).GetFiles(); DynamicCompile dCompile = new DynamicCompile(); foreach (FileInfo info in fileList) { SpellInfo spellInfo = new SpellInfo(); dCompile.Compile(path + info.Name, spellInfo); dict.Add(spellInfo.Name.ToLower(), spellInfo); } }
/// <summary> /// Load all the npcs as specified in the configuration file. /// </summary> public static void Load() { string path = Config.GetDataPath() + Config.GetNPCDirectory(); FileInfo[] fileList = new DirectoryInfo(path).GetFiles(); DynamicCompile dCompile = new DynamicCompile(); foreach (FileInfo info in fileList) { NPC npc = (NPC)dCompile.Compile(path + info.Name, null); NPCDictionary.Add(npc.Name.ToLower(), npc); } }
/// <summary> /// Loads all the monsters. /// </summary> public static void Load() { string path = Config.GetDataPath() + Config.GetMonsterDirectory(); FileInfo[] fileList = new DirectoryInfo(path).GetFiles(); DynamicCompile dCompile = new DynamicCompile(); foreach (FileInfo info in fileList) { Monster monster = (Monster)dCompile.Compile(path + info.Name, null); masterDictionary.Add(monster.Name.ToLower(), monster); } }
/// <summary> /// Load the commands. /// </summary> public static void Load() { string path = Config.GetDataPath() + Config.GetCommandDirectory(); FileInfo[] fileList = new DirectoryInfo(path).GetFiles(); DynamicCompile dCompile = new DynamicCompile(); foreach (FileInfo info in fileList) { CommandInfo commandInfo = new CommandInfo(); dCompile.Compile(path + info.Name, commandInfo); commands.Add(commandInfo.Name.ToLower(), commandInfo); } }
private static void Compile(string path, Dictionary<string, SpellInfo> dict) { FileInfo[] fileList = new DirectoryInfo(path).GetFiles(); DynamicCompile dCompile = new DynamicCompile(); foreach (FileInfo info in fileList) { SpellInfo spellInfo = new SpellInfo(); dCompile.Compile(path + info.Name, spellInfo); dict.Add(spellInfo.Name.ToLower(), spellInfo); } }
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(); }