/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : Checksum.cs
Version : 1.0
Author(s) : Natalia Portillo
Component : Verbs.
Revision : $Revision$
Last change by : $Author$
Date : $Date$
--[ Description ] ----------------------------------------------------------
Implements the 'checksum' verb.
--[ License ] --------------------------------------------------------------
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 3 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 should have received a copy of the GNU General Public License
along with this program. If not, see .
----------------------------------------------------------------------------
Copyright (C) 2011-2014 Claunia.com
****************************************************************************/
//$Id$
using System;
using DiscImageChef.ImagePlugins;
using DiscImageChef.Checksums;
using System.Collections.Generic;
using DiscImageChef.Console;
namespace DiscImageChef.Commands
{
public static class Checksum
{
public static void doChecksum(ChecksumSubOptions options)
{
DicConsole.DebugWriteLine("Checksum command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Checksum command", "--verbose={0}", options.Verbose);
DicConsole.DebugWriteLine("Checksum command", "--separated-tracks={0}", options.SeparatedTracks);
DicConsole.DebugWriteLine("Checksum command", "--whole-disc={0}", options.WholeDisc);
DicConsole.DebugWriteLine("Checksum command", "--input={0}", options.InputFile);
DicConsole.DebugWriteLine("Checksum command", "--adler32={0}", options.DoAdler32);
DicConsole.DebugWriteLine("Checksum command", "--crc16={0}", options.DoCRC16);
DicConsole.DebugWriteLine("Checksum command", "--crc32={0}", options.DoCRC32);
DicConsole.DebugWriteLine("Checksum command", "--crc64={0}", options.DoCRC64);
DicConsole.DebugWriteLine("Checksum command", "--md5={0}", options.DoMD5);
DicConsole.DebugWriteLine("Checksum command", "--ripemd160={0}", options.DoRIPEMD160);
DicConsole.DebugWriteLine("Checksum command", "--sha1={0}", options.DoSHA1);
DicConsole.DebugWriteLine("Checksum command", "--sha256={0}", options.DoSHA256);
DicConsole.DebugWriteLine("Checksum command", "--sha384={0}", options.DoSHA384);
DicConsole.DebugWriteLine("Checksum command", "--sha512={0}", options.DoSHA512);
DicConsole.DebugWriteLine("Checksum command", "--spamsum={0}", options.DoSpamSum);
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
if (inputFormat == null)
{
DicConsole.ErrorWriteLine("Unable to recognize image format, not checksumming");
return;
}
inputFormat.OpenImage(options.InputFile);
if (options.SeparatedTracks)
{
try
{
List