1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
// This file is part of par2cmdline (a PAR 2.0 compatible file verification and
// repair tool). See http://parchive.sourceforge.net for details of PAR 2.0.
//
// Copyright (c) 2003 Peter Brian Clements
// Copyright (c) 2011 Andreas Moog
//
// par2cmdline 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.
//
// par2cmdline 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, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "libpar2.h"
LibPar2::LibPar2(CommandLine* commandline) {
commandLine = commandline;
switch (commandLine->GetVersion())
{
case CommandLine::verPar1:
{
par1Repairer = new Par1Repairer;
/* repairer->sig_filename.connect( sigc::mem_fun(*this,&MainWindow::signal_filename));
repairer->sig_progress.connect( sigc::mem_fun(*this,&MainWindow::signal_progress));*/
}
break;
case CommandLine::verPar2:
{
par2Repairer = new Par2Repairer;
par2Repairer->sig_filename.
connect( sigc::mem_fun(*this, &LibPar2::signal_filename));
par2Repairer->sig_progress.
connect( sigc::mem_fun(*this,&LibPar2::signal_progress));
par2Repairer->sig_headers.
connect( sigc::mem_fun(*this,&LibPar2::signal_headers));
par2Repairer->sig_done.
connect( sigc::mem_fun(*this,&LibPar2::signal_done));
//par2Repairer->
}
break;
case CommandLine::opNone:
break;
}
}
LibPar2::~LibPar2(void) {
delete par1Repairer;
delete par2Repairer;
}
Result LibPar2::PreProcess() {
Result result = eSuccess;
switch (commandLine->GetVersion())
{
case CommandLine::verPar1:
{
//result = par1Repairer->PreProcess(*commandLine);
}
break;
case CommandLine::verPar2:
{
result = par2Repairer->PreProcess(*commandLine);
}
break;
case CommandLine::opNone:
break;
}
return result;
}
Result LibPar2::Process(bool dorepair) {
Result result = eSuccess;
switch (commandLine->GetVersion())
{
case CommandLine::verPar1:
{
result = par1Repairer->Process(*commandLine, dorepair);
}
break;
case CommandLine::verPar2:
{
result = par2Repairer->Process(*commandLine, dorepair);
}
break;
case CommandLine::opNone:
break;
}
return result;
}
void LibPar2::signal_filename(std::string str) {
sig_filename.emit(str);
};
void LibPar2::signal_progress(double value) {
sig_progress.emit(value);
};
void LibPar2::signal_headers(ParHeaders* headers) {
sig_headers.emit(headers);
}
void LibPar2::signal_done(std::string filename, int blocks_available,
int blocks_total) {
sig_done.emit(filename, blocks_available, blocks_total);
}
|