Reflection

This change eliminates the need to explicitly list out every single protection in the same way now that we have interfaces that we can rely on.
This commit is contained in:
Matt Nadareski
2021-03-02 15:10:52 -08:00
parent 2867ce2e9a
commit 633fe23b80
3 changed files with 69 additions and 480 deletions

View File

@@ -21,18 +21,21 @@ namespace BurnOutSharp.ProtectionType
/// <inheritdoc/>
public string CheckPath(string path, bool isDirectory, IEnumerable<string> files)
{
if (isDirectory)
{
if (files.Any(f => Path.GetFileName(f).Equals("Autorun.dat", StringComparison.OrdinalIgnoreCase)))
return "CopyKiller";
}
else
{
if (Path.GetFileName(path).Equals("Autorun.dat", StringComparison.OrdinalIgnoreCase))
return "CopyKiller";
}
return null;
// TODO: The following checks are overly broad and should be refined
//if (isDirectory)
//{
// if (files.Any(f => Path.GetFileName(f).Equals("Autorun.dat", StringComparison.OrdinalIgnoreCase)))
// return "CopyKiller";
//}
//else
//{
// if (Path.GetFileName(path).Equals("Autorun.dat", StringComparison.OrdinalIgnoreCase))
// return "CopyKiller";
//}
//return null;
}
}
}