using System; using System.Collections.Concurrent; using System.Collections.Generic; using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; using BurnOutSharp.Tools; namespace BurnOutSharp.ProtectionType { public class Origin : IContentCheck, IPathCheck { /// public string CheckContents(string file, byte[] fileContent,bool includeDebug, PortableExecutable pex, NewExecutable nex) { // Get the sections from the executable, if possible var sections = pex?.SectionTable; if (sections == null) return null; string name = Utilities.GetFileDescription(pex); if (!string.IsNullOrWhiteSpace(name) && name.Equals("Origin", StringComparison.OrdinalIgnoreCase)) return "Origin"; name = Utilities.GetProductName(pex); if (!string.IsNullOrWhiteSpace(name) && name.Equals("Origin", StringComparison.OrdinalIgnoreCase)) return "Origin"; return null; } /// public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) { var matchers = new List { new PathMatchSet(new PathMatch("OriginSetup.exe", useEndsWith: true), "Origin"), }; return MatchUtil.GetAllMatches(files, matchers, any: true); } /// public string CheckFilePath(string path) { var matchers = new List { new PathMatchSet(new PathMatch("OriginSetup.exe", useEndsWith: true), "Origin"), }; return MatchUtil.GetFirstMatch(path, matchers, any: true); } } }