Files
BinaryObjectScanner/BinaryObjectScanner/Protection/CDX.cs

44 lines
1.6 KiB
C#
Raw Normal View History

2023-11-22 12:22:01 -05:00
#if NET40_OR_GREATER || NETCOREAPP
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
2023-09-16 22:08:18 -04:00
using SabreTools.Matching;
namespace BinaryObjectScanner.Protection
{
2021-02-26 00:32:09 -08:00
public class CDX : IPathCheck
{
2021-02-26 00:32:09 -08:00
/// <inheritdoc/>
2023-11-22 12:22:01 -05:00
#if NET20 || NET35
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
#else
2023-09-18 14:58:33 -04:00
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
2023-11-22 12:22:01 -05:00
#endif
{
2021-03-19 15:41:49 -07:00
// TODO: Verify if these are OR or AND
2021-03-22 23:02:01 -07:00
var matchers = new List<PathMatchSet>
{
2023-11-22 13:28:13 -05:00
new(new FilePathMatch("CHKCDX16.DLL"), "CD-X (Unconfirmed - Please report to us on Github)"),
new(new FilePathMatch("CHKCDX32.DLL"), "CD-X (Unconfirmed - Please report to us on Github)"),
new(new FilePathMatch("CHKCDXNT.DLL"), "CD-X (Unconfirmed - Please report to us on Github)"),
2021-03-22 23:02:01 -07:00
};
2021-03-19 15:41:49 -07:00
2023-11-14 16:10:10 -05:00
return MatchUtil.GetAllMatches(files, matchers, any: true);
2021-03-19 15:41:49 -07:00
}
/// <inheritdoc/>
2023-09-17 22:37:01 -04:00
public string? CheckFilePath(string path)
2021-03-19 15:41:49 -07:00
{
2021-03-22 23:02:01 -07:00
var matchers = new List<PathMatchSet>
{
2023-11-22 13:28:13 -05:00
new(new FilePathMatch("CHKCDX16.DLL"), "CD-X (Unconfirmed - Please report to us on Github)"),
new(new FilePathMatch("CHKCDX32.DLL"), "CD-X (Unconfirmed - Please report to us on Github)"),
new(new FilePathMatch("CHKCDXNT.DLL"), "CD-X (Unconfirmed - Please report to us on Github)"),
2021-03-22 23:02:01 -07:00
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}