public LoadModule(string moduleName) { ModuleName = moduleName.Split('\\').Last(); GetDirContents(moduleName, ".xml"); //now have all xml files in a module foreach (var moduleFile in ModuleFiles) { XElement rootNode = XElement.Load(moduleFile); switch (rootNode.Name.ToString()) { case "BackgroundTiles": GetElementsAttributes(rootNode).ToList().ForEach(k => LoadedBackgroundTiles[k.Key] = k.Value); break; case "Maps": GetElementsAttributes(rootNode).ToList().ForEach(k => LoadedMaps[k.Key] = k.Value); break; case "Actors": GetElementsAttributes(rootNode).ToList().ForEach(k => LoadedActors[k.Key] = k.Value); break; case "Actions": GetElementsAttributes(rootNode).ToList().ForEach(k => { var convertedActionsArgs = new Dictionary <ActionArgs, string>(); k.Value.ToList().ForEach(v => convertedActionsArgs[ActionHandler.ConvertActionArg(v.Key)] = v.Value); LoadedActions[k.Key] = convertedActionsArgs; }); break; } } }