Initial commit
This commit is contained in:
38
GapMerger/GapMerger.cfg
Normal file
38
GapMerger/GapMerger.cfg
Normal file
@ -0,0 +1,38 @@
|
||||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
139
GapMerger/GapMerger.dof
Normal file
139
GapMerger/GapMerger.dof
Normal file
@ -0,0 +1,139 @@
|
||||
[FileVersion]
|
||||
Version=7.0
|
||||
[Compiler]
|
||||
A=8
|
||||
B=0
|
||||
C=1
|
||||
D=1
|
||||
E=0
|
||||
F=0
|
||||
G=1
|
||||
H=1
|
||||
I=1
|
||||
J=0
|
||||
K=0
|
||||
L=1
|
||||
M=0
|
||||
N=1
|
||||
O=1
|
||||
P=1
|
||||
Q=0
|
||||
R=0
|
||||
S=0
|
||||
T=0
|
||||
U=0
|
||||
V=1
|
||||
W=0
|
||||
X=1
|
||||
Y=1
|
||||
Z=1
|
||||
ShowHints=1
|
||||
ShowWarnings=1
|
||||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
NamespacePrefix=
|
||||
SymbolDeprecated=1
|
||||
SymbolLibrary=1
|
||||
SymbolPlatform=1
|
||||
UnitLibrary=1
|
||||
UnitPlatform=1
|
||||
UnitDeprecated=1
|
||||
HResultCompat=1
|
||||
HidingMember=1
|
||||
HiddenVirtual=1
|
||||
Garbage=1
|
||||
BoundsError=1
|
||||
ZeroNilCompat=1
|
||||
StringConstTruncated=1
|
||||
ForLoopVarVarPar=1
|
||||
TypedConstVarPar=1
|
||||
AsgToTypedConst=1
|
||||
CaseLabelRange=1
|
||||
ForVariable=1
|
||||
ConstructingAbstract=1
|
||||
ComparisonFalse=1
|
||||
ComparisonTrue=1
|
||||
ComparingSignedUnsigned=1
|
||||
CombiningSignedUnsigned=1
|
||||
UnsupportedConstruct=1
|
||||
FileOpen=1
|
||||
FileOpenUnitSrc=1
|
||||
BadGlobalSymbol=1
|
||||
DuplicateConstructorDestructor=1
|
||||
InvalidDirective=1
|
||||
PackageNoLink=1
|
||||
PackageThreadVar=1
|
||||
ImplicitImport=1
|
||||
HPPEMITIgnored=1
|
||||
NoRetVal=1
|
||||
UseBeforeDef=1
|
||||
ForLoopVarUndef=1
|
||||
UnitNameMismatch=1
|
||||
NoCFGFileFound=1
|
||||
MessageDirective=1
|
||||
ImplicitVariants=1
|
||||
UnicodeToLocale=1
|
||||
LocaleToUnicode=1
|
||||
ImagebaseMultiple=1
|
||||
SuspiciousTypecast=1
|
||||
PrivatePropAccessor=1
|
||||
UnsafeType=0
|
||||
UnsafeCode=0
|
||||
UnsafeCast=0
|
||||
[Linker]
|
||||
MapFile=0
|
||||
OutputObjs=0
|
||||
ConsoleApp=1
|
||||
DebugInfo=0
|
||||
RemoteSymbols=0
|
||||
MinStackSize=16384
|
||||
MaxStackSize=1048576
|
||||
ImageBase=4194304
|
||||
ExeDescription=
|
||||
[Directories]
|
||||
OutputDir=
|
||||
UnitOutputDir=
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=
|
||||
SearchPath=
|
||||
Packages=
|
||||
Conditionals=
|
||||
DebugSourceDirs=
|
||||
UsePackages=0
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=1033
|
||||
CodePage=1252
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
[HistoryLists\hlUnitAliases]
|
||||
Count=1
|
||||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
114
GapMerger/GapMerger.dpr
Normal file
114
GapMerger/GapMerger.dpr
Normal file
@ -0,0 +1,114 @@
|
||||
program GapMerger;
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
Windows,
|
||||
rbrConsTools in '..\rbrConsTools\rbrConsTools.pas';
|
||||
|
||||
const
|
||||
AppTitle: string = 'eMule Gap Merger';
|
||||
AppVersion: string = '1.0';
|
||||
|
||||
var
|
||||
OldConsTitle: PChar;
|
||||
infile1,infile2,outfile: file of char;
|
||||
Buf1, Buf2: array[1..64] of char;
|
||||
i,i1,i2,j: integer;
|
||||
WX,WY: integer;
|
||||
ct,bw,be: integer;
|
||||
ofs,ifs: longint;
|
||||
incon: longint;
|
||||
isempty: boolean;
|
||||
|
||||
begin
|
||||
try
|
||||
OldConsTitle := PChar(AllocMem(256));
|
||||
GetConsoleTitle(OldConsTitle,255);
|
||||
SetConsoleTitle(PChar(AppTitle+' '+AppVersion));
|
||||
TextColor(white);
|
||||
WriteLn('--==# '+AppTitle+' '+AppVersion+' #==--');
|
||||
TextColor(LightGray);
|
||||
WriteLn('(c)2003 by Markus Birth <mbirth@webwriters.de>');
|
||||
WriteLn;
|
||||
if (ParamCount<3) then begin
|
||||
TextColor(LightRed);
|
||||
WriteLn('Not enough actual parameters.');
|
||||
TextColor(LightGray);
|
||||
SetConsoleTitle(OldConsTitle);
|
||||
Halt(1);
|
||||
end;
|
||||
Write('Assigning files...');
|
||||
AssignFile(infile1,ParamStr(1));
|
||||
AssignFile(infile2,ParamStr(2));
|
||||
AssignFile(outfile,ParamStr(3));
|
||||
WriteLn('done.');
|
||||
Write('Opening files (existing output file will be overwritten)...');
|
||||
Reset(infile1);
|
||||
Reset(infile2);
|
||||
Rewrite(outfile);
|
||||
WriteLn('done.');
|
||||
if (FileSize(infile1)=FileSize(infile2)) then begin
|
||||
ifs := FileSize(infile1);
|
||||
WriteLn('Infiles are each ',ifs,' Bytes ~ ',ifs DIV 64,' Blocks');
|
||||
Write('Start merging...');
|
||||
WX := WhereX;
|
||||
WY := WhereY;
|
||||
ct := 0;
|
||||
bw := 0;
|
||||
be := 0;
|
||||
incon := 0;
|
||||
repeat
|
||||
BlockRead(infile1,Buf1,SizeOf(Buf1),i1);
|
||||
BlockRead(infile2,Buf2,SizeOf(Buf2),i2);
|
||||
if (i2>i1) then i := i2 else i := i1;
|
||||
isempty := true;
|
||||
for j:=1 to 64 do begin
|
||||
if (Ord(Buf1[j])=0) AND (Ord(Buf2[j])<>0) then Buf1[j] := Buf2[j];
|
||||
if (Ord(Buf2[j])<>0) AND (Buf1[j]<>Buf2[j]) then Inc(incon);
|
||||
if (Ord(Buf1[j])<>0) then isempty := false;
|
||||
end;
|
||||
BlockWrite(outfile,Buf1,i);
|
||||
Inc(bw);
|
||||
if isempty then Inc(be);
|
||||
Inc(ct);
|
||||
if (ct>=10000) then begin
|
||||
GotoXY(WX,WY);
|
||||
Write(bw,' Blocks written (',be,' empty)');
|
||||
ct := 0;
|
||||
end;
|
||||
until i=0;
|
||||
GotoXY(WX,WY);
|
||||
Write(bw,' Blocks written (',be,' empty)');
|
||||
WriteLn(' ... done.');
|
||||
ofs := FileSize(outfile);
|
||||
WriteLn('Outfile is ',ofs,' Bytes ~ ',ofs DIV 64,' Blocks');
|
||||
if (incon>0) then begin
|
||||
TextColor(LightRed);
|
||||
WriteLn('WARNING! Inconsistencies found! Output file may be corrupt!');
|
||||
WriteLn(incon,' inconsistent byte(s) found! (',incon*100/ofs:7:3,'%)');
|
||||
TextColor(LightGray);
|
||||
end;
|
||||
end else begin
|
||||
TextColor(lightred);
|
||||
WriteLn('!!ERROR!! Infiles have different sizes.');
|
||||
TextColor(lightgray);
|
||||
end;
|
||||
Write('Closing files...');
|
||||
CloseFile(infile1);
|
||||
CloseFile(infile2);
|
||||
CloseFile(outfile);
|
||||
WriteLn('done.');
|
||||
SetConsoleTitle(OldConsTitle);
|
||||
except
|
||||
on e: Exception do begin
|
||||
TextColor(LightRed+blink);
|
||||
WriteLn('error!');
|
||||
TextColor(LightRed);
|
||||
TextBackground(Black);
|
||||
WriteLn('Exception: '+e.Message);
|
||||
TextColor(LightGray);
|
||||
end;
|
||||
end;
|
||||
end.
|
||||
|
15
GapMerger/README.md
Normal file
15
GapMerger/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
GapMerger for eMule
|
||||
===================
|
||||
|
||||
Syntax: `GapMerger <infile1> <infile2> <outfile>`
|
||||
|
||||
|
||||
GapRemover parses both `<infilex>`s in 64Bytes-Blocks.
|
||||
It copies `<infile1>` to `<outfile>` except if a byte in `<infile1>` is 00h and the byte at the same position in `<infile2>` is NOT 00h.
|
||||
Then, the byte from `<infile2>` is written into `<outfile>`.
|
||||
|
||||
`<infile1>` and `<infile2>` have to be same size.
|
||||
|
||||
|
||||
I wrote this because I sometimes download the same file 2 times and both downloads have gaps at different parts of the file.
|
||||
This tool merges all data into one file.
|
Reference in New Issue
Block a user