public List <FomodFile> GetFilesToInstall(List <string> ModOptionNames, bool ignoreMissing = false) { List <FomodFile> filesToInstall = new List <FomodFile>(); Dictionary <string, string> flags = new Dictionary <string, string>(); if (ModOptionNames.Contains("Base FOMOD Files")) { filesToInstall.AddRange(BaseFiles); } foreach (string name in ModOptionNames) { FomodPlugin foundPlugin = Plugins.Find(p => p.Name.Equals(name)); if (foundPlugin != null) { filesToInstall.AddRange(foundPlugin.Files); foundPlugin.Flags.ForEach(f => flags[f.Name] = f.Value); } else { if (!ignoreMissing) { throw new Exception("Mod Option " + name + " not found."); } } } foreach (FomodPattern pattern in GetSatisfiedPatterns(flags)) { filesToInstall.AddRange(pattern.Files); } return(filesToInstall); }
public FomodConfig(string xmlPath, bool skipPatterns = false) { XmlDocument xmlDoc = new XmlDocument(); string xmlText = File.ReadAllText(@".\fomod\ModuleConfig.xml"); xmlDoc.LoadXml(xmlText); Plugins = FomodPlugin.FromDocument(xmlDoc); Patterns = FomodPattern.FromDocument(xmlDoc); FileMap = new List <Tuple <FomodFile, ModOption> >(); GetBaseFiles(xmlDoc); if (!skipPatterns) { MapPluginPatterns(); } }