2022-10-11 22:00:30 -06:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using BurnOutSharp.Interfaces;
|
2023-03-07 12:04:48 -05:00
|
|
|
|
using static BinaryObjectScanner.Utilities.Dictionary;
|
2022-10-11 22:00:30 -06:00
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.FileType
|
|
|
|
|
|
{
|
2022-12-08 21:32:52 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// PlayJ audio file
|
|
|
|
|
|
/// </summary>
|
2022-10-11 22:00:30 -06:00
|
|
|
|
public class PLJ : IScannable
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!File.Exists(file))
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
2022-12-22 22:03:32 -08:00
|
|
|
|
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
2022-10-11 22:00:30 -06:00
|
|
|
|
{
|
|
|
|
|
|
return Scan(scanner, fs, file);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
|
|
|
|
|
|
{
|
|
|
|
|
|
var protections = new ConcurrentDictionary<string, ConcurrentQueue<string>>();
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
byte[] magic = new byte[16];
|
|
|
|
|
|
stream.Read(magic, 0, 16);
|
|
|
|
|
|
|
2022-12-15 00:13:24 -08:00
|
|
|
|
if (Tools.Utilities.GetFileType(magic) == SupportedFileType.PLJ)
|
2022-10-11 22:00:30 -06:00
|
|
|
|
{
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "PlayJ Audio File");
|
2022-10-11 22:00:30 -06:00
|
|
|
|
return protections;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (scanner.IncludeDebug) Console.WriteLine(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|