using System.Linq; namespace DataFileAnalyzer { public class OrphanDetectionOperation : UpdateOperation { public static string[] SkippedExtensions = { "isc", "act", "frt", "wav", "tfi", "asc", "pck", "wwu", }; /// /// Constructor /// public OrphanDetectionOperation(FileUpdater _updater, string _filePath) : base(_updater, _filePath) { } public override void Run() { // Nothing to do. SetProgress(States.WaitUpdate); } /// /// Update the library with the computed dependencies /// public override void UpdateLibrary() { string extension = UAF.PathUtils.GetExtension(NormalizedFilePath); if (!SkippedExtensions.Contains(extension)) { DataFile dataFile = m_library.GetFile(NormalizedFilePath); if (dataFile != null) { if (dataFile.Parents.Count == 0) { dataFile.AddWarning(DataFileError.Codes.Orphan); } else { dataFile.RemoveWarning(DataFileError.Codes.Orphan); } } } SetProgress(States.Finished); } } }