public void LoadFiles(string basePath) { var mPath = Path.Combine(basePath, _archive ?? _folder); if (Path.GetExtension(mPath) == ".zip") { _zipFile = ZipFile.Read(mPath); foreach (var item in _zipFile) { if (string.Compare(item.FileName, "descriptor.mod", true) == 0) { continue; } var modFile = ModFile.Load(new ZipFileLoader(item), item.FileName, this); Files.Add(modFile); } } else { mPath = mPath + "\\"; var items = Directory.EnumerateFiles(mPath, "*.*", SearchOption.AllDirectories); foreach (var item in items) { if (string.Compare(Path.GetFileName(item), "descriptor.mod", true) != 0) { var refPath = Uri.UnescapeDataString(new Uri(mPath).MakeRelativeUri(new Uri(item)).OriginalString); var modFile = ModFile.Load(new DiskFileLoader(item), refPath, this); Files.Add(modFile); } } } }
ModFileConflictDescriptor ToConflictDescriptor(ModFile file) { var mmf = file as MergedModFile; if (mmf != null) { return(new ModFileConflictDescriptor(mmf, mmf.SourceFiles)); } return(new ModFileConflictDescriptor(file, Enumerable.Empty <ModFile>())); }
public ModFileConflictDescriptor(ModFile file, IEnumerable <ModFile> conflictingModFiles) { File = file; ConflictingModFiles = conflictingModFiles.ToList(); }
public void RemoveSourceFile(ModFile file) { _sourceFiles.Remove(file); }