2022-10-11 22:00:30 -06:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using BurnOutSharp.Interfaces;
|
|
|
|
|
|
using BurnOutSharp.Tools;
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
using (var fs = File.OpenRead(file))
|
|
|
|
|
|
{
|
|
|
|
|
|
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-08 21:46:22 -08:00
|
|
|
|
if (Utilities.GetFileType(magic) == SupportedFileType.PLJ)
|
2022-10-11 22:00:30 -06:00
|
|
|
|
{
|
|
|
|
|
|
Utilities.AppendToDictionary(protections, file, "PlayJ Audio File");
|
|
|
|
|
|
return protections;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (scanner.IncludeDebug) Console.WriteLine(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|