//this file is part of BurnOut
//Copyright (C)2005-2010 Gernot Knippen
//Ported code with augments Copyright (C)2018 Matt Nadareski
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You can get a copy of the GNU General Public License
//by writing to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using LibMSPackN;
using UnshieldSharp;
namespace BurnOutSharp
{
public static class ProtectionFind
{
///
/// Scan a path to find any known copy protection(s)
///
/// Path to scan for protection(s)
/// Optional progress indicator that will return a float in the range from 0 to 1
/// Dictionary of filename to protection mappings, if possible
///
/// TODO: Sector scanning?
/// The following protections are known, but not detected:
/// - Alcatraz (http://www.kdg-mt.com/1/product_d_6.html)
/// - AlphaAudio (http://settec.net/eng/pro_cd.html)
/// - CopyLok / CodeLok (http://web.archive.org/web/20041215075727/http://www.panlok.com/codelok2.htm)
/// - CrypKey (http://www.crypkey.com/products/cdlock/cdmain.html)
/// - DBB (http://web.archive.org/web/20040604233815/www.wkit.com/sites/wkit/setup/eng/index.asp)
/// - FADE (http://www.codemasters.com/news/displayarticles.php?showarticle=500)
/// - LockBlocks (https://www.cdmediaworld.com/hardware/cdrom/cd_protections_lockblocks.shtml)
/// - MusicGuard (http://web.archive.org/web/20020606000647/http://www.musicguard.com)
/// - Phenoprotect (https://www.cdmediaworld.com/hardware/cdrom/cd_protections_phenoprotect.shtml)
/// - Roxxe (http://web.archive.org/web/20050309084802/http://www.roxxe.cz)
/// - SAFEAUDIO (https://www.cdmediaworld.com/hardware/cdrom/cd_protections_safeaudio.shtml)
/// - The Bongle (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
/// - The Copy-Protected CD (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
///
public static Dictionary Scan(string path, IProgress