private bool CheckEntity(ProcessingFlags pProcessingFlags, out string pReport) { pReport = null; bool showDetailedContents = pProcessingFlags.HasFlag(ProcessingFlags.ShowAddonContents); bool appendToPackageSet = pProcessingFlags.HasFlag(ProcessingFlags.AppendToAddonPackageSet); if (!showDetailedContents) { pReport = BriefReport(); if (!appendToPackageSet) { return(true); } } string tempPath = Utils.GetTempDirectory(); AddonPackage package = new AddonPackage(AbsolutePath, pProcessingFlags, tempPath); if (showDetailedContents) { pReport = package?.ToString(); } if (appendToPackageSet && (AddonPackageSet != null) && (package != null)) { if (package.HasIssues) { pReport += " >>> NOT inserted/updated into Catalogue (has problems!)"; } else { if (AddonPackageSet.Append(package, pProcessingFlags.HasFlag(ProcessingFlags.AppendToAddonPackageSetForceRefresh))) { pReport += " >>> Inserted/updated into Catalogue"; } } } return(true); }
private bool CheckEntity(ProcessingFlags pProcessingFlags, out string pReport) { bool reportOnlyIssues = pProcessingFlags.HasFlag(ProcessingFlags.JustReportIssues); bool showAddonContents = pProcessingFlags.HasFlag(ProcessingFlags.ShowAddonContents); bool appendToPackageSet = pProcessingFlags.HasFlag(ProcessingFlags.AppendToAddonPackageSet); List <ArchiveFileInfo> entryList; SevenZipArchiver archiver = new SevenZipArchiver(AbsolutePath); archiver.ArchivedFileList(out entryList); if ((entryList?.Count ?? -1) <= 0) { pReport = $"{ErrorTokenString} Invalid file or format"; if (showAddonContents) { pReport += "\n"; } return(false); } List <string> demoMovies, stockAssets; bool hasMeshes, hasData; AddonSignatureFile addonSignature; bool formatOk = CheckFormat(archiver, entryList, out hasMeshes, out hasData, out demoMovies, out stockAssets, out addonSignature); if (!formatOk) { pReport = $"{ErrorTokenString} Invalid/obsolete addon format"; if (showAddonContents) { pReport += "\n"; } return(false); } // Addon good format pReport = null; if (reportOnlyIssues) { return(true); } if (!showAddonContents) { pReport = (hasMeshes ? "OK" : "OK, no meshes"); if (demoMovies != null) { pReport += " (incl. Movies)"; } if (stockAssets != null) { pReport += " (incl. Stock assets)"; } string freeText = addonSignature.Free ? "" : " NOT FREE!"; pReport += $" [{addonSignature.Publisher}{freeText}]"; if (!appendToPackageSet) { return(true); } } string tempPath = Utils.GetTempDirectory(); AddonPackage package = new AddonPackage(archiver, pProcessingFlags, tempPath, ArchivedPath); if (showAddonContents) { pReport = package?.ToString(); } if (appendToPackageSet && (AddonPackageSet != null) && (package != null)) { if (package.HasIssues) { pReport += " >>> Not inserted/updated into Catalogue (has problems!)"; } else { if (AddonPackageSet.Append(package, pProcessingFlags.HasFlag(ProcessingFlags.AppendToAddonPackageSetForceRefresh))) { pReport += " >>> Inserted/updated into Catalogue"; } } } return(true); }