private List <ModFile> GetModFilesFromPaths( IEnumerable <string> filePaths, ModFileCategory category, string modName, string bundlePath = null) { var fileList = new List <ModFile>(); foreach (var filePath in filePaths) { string relPath = null; if (category == Categories.Script) { relPath = Paths.GetRelativePath(filePath, Paths.ModScriptBase); } else if (category == Categories.Xml) { relPath = Paths.GetRelativePath(filePath, modName); } else if (category == Categories.BundleText) { relPath = filePath; } else { throw new NotImplementedException(); } var existingFile = Files.FirstOrDefault(file => file.RelativePath.EqualsIgnoreCase(relPath)); if (existingFile == null) { var newFile = (bundlePath != null ? new ModFile(relPath, bundlePath) : new ModFile(relPath)); newFile.Mods.Add(new FileHash { Name = modName }); fileList.Add(newFile); } else { existingFile.Mods.Add(new FileHash { Name = modName }); } } return(fileList); }
private List<ModFile> GetModFilesFromPaths( IEnumerable<string> filePaths, ModFileCategory category, string modName, string bundlePath = null) { var fileList = new List<ModFile>(); foreach (var filePath in filePaths) { string relPath = null; if (category == Categories.Script) relPath = Paths.GetRelativePath(filePath, Paths.ModScriptBase); else if (category == Categories.Xml) relPath = Paths.GetRelativePath(filePath, modName); else if (category == Categories.BundleText) relPath = filePath; else throw new NotImplementedException(); var existingFile = Files.FirstOrDefault(file => file.RelativePath.EqualsIgnoreCase(relPath)); if (existingFile == null) { var newFile = (bundlePath != null ? new ModFile(relPath, bundlePath) : new ModFile(relPath)); newFile.Mods.Add(new FileHash { Name = modName }); fileList.Add(newFile); } else existingFile.Mods.Add(new FileHash { Name = modName }); } return fileList; }
public TreeNode GetCategoryNode(ModFileCategory category) { return CategoryNodes.FirstOrDefault(node => category == (ModFileCategory)node.Tag); }