58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using System.Linq;
|
|
|
|
namespace DataFileAnalyzer
|
|
{
|
|
public class OrphanDetectionOperation : UpdateOperation
|
|
{
|
|
public static string[] SkippedExtensions =
|
|
{
|
|
"isc",
|
|
"act",
|
|
"frt",
|
|
"wav",
|
|
"tfi",
|
|
"asc",
|
|
"pck",
|
|
"wwu",
|
|
};
|
|
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public OrphanDetectionOperation(FileUpdater _updater, string _filePath)
|
|
: base(_updater, _filePath)
|
|
{
|
|
}
|
|
|
|
public override void Run()
|
|
{
|
|
// Nothing to do.
|
|
SetProgress(States.WaitUpdate);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update the library with the computed dependencies
|
|
/// </summary>
|
|
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);
|
|
}
|
|
}
|
|
}
|