using System; using System.Collections.Concurrent; using System.IO; using BurnOutSharp.Interfaces; namespace BurnOutSharp.FileType { /// /// BD+ SVM /// public class BDPlusSVM : IScannable { /// public ConcurrentDictionary> Scan(Scanner scanner, string file) { if (!File.Exists(file)) return null; using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)) { return Scan(scanner, fs, file); } } /// public ConcurrentDictionary> Scan(Scanner scanner, Stream stream, string file) { // If the BD+ file itself fails try { // Create the wrapper BinaryObjectScanner.Wrappers.BDPlusSVM svm = BinaryObjectScanner.Wrappers.BDPlusSVM.Create(stream); if (svm == null) return null; // Setup the output var protections = new ConcurrentDictionary>(); protections[file] = new ConcurrentQueue(); // Format the date string date = $"{svm.Year:0000}/{svm.Month:00}/{svm.Day:00}"; // Add and return the protection protections[file].Enqueue($"BD+ {date}"); return protections; } catch (Exception ex) { if (scanner.IncludeDebug) Console.WriteLine(ex); } return null; } } }