Updated for 1.10

This commit is contained in:
mysticbbs 2012-02-27 17:52:40 -05:00
parent 7d65434f36
commit 30d8153781
1 changed files with 98 additions and 96 deletions

View File

@ -32,129 +32,131 @@ Uses
{$I RECORDS.PAS} {$I RECORDS.PAS}
Var Var
inFile : Text; InFile : Text;
desFile : File; DesFile : File;
FDirFile : File of FDirRec; FDirFile : File of RecFileList;
FDir : FDirRec; FDir : RecFileList;
Desc : Array[1..99] of String[50]; Desc : Array[1..99] of String[50];
Str : String = ''; Str : String = '';
A : Byte; A : Byte;
Total : Integer; Total : Integer;
NoSave : Boolean; NoSave : Boolean;
DupeCheck : Boolean; DupeCheck : Boolean;
D : DirStr;
D: DirStr; N : NameStr;
N: NameStr; E : ExtStr;
E: ExtStr;
Function IsDupeFile (FN : String) : Boolean; Function IsDupeFile (FN : String) : Boolean;
Begin Begin
IsDupeFile := False; IsDupeFile := False;
If Not DupeCheck Then Exit; If Not DupeCheck Then Exit;
Reset (FDirFile); Reset (FDirFile);
While Not Eof(FDirFile) Do Begin While Not Eof(FDirFile) Do Begin
Read (FDirFile, FDir); Read (FDirFile, FDir);
If FDir.Flags and FDirDeleted <> 0 Then Continue; If FDir.Flags and FDirDeleted <> 0 Then Continue;
{$IFDEF FS_SENSITIVE} {$IFDEF FS_SENSITIVE}
If FDir.FileName = FN Then Begin If FDir.FileName = FN Then Begin
{$ELSE} {$ELSE}
If strUpper(FDir.FileName) = strUpper(FN) Then Begin If strUpper(FDir.FileName) = strUpper(FN) Then Begin
{$ENDIF} {$ENDIF}
IsDupeFile := True; Result := True;
Exit; Exit;
End; End;
End; End;
End; End;
Begin Begin
WriteLn; WriteLn;
WriteLn ('PCB2MBBS : PCBoard to Mystic BBS File Base Converter'); WriteLn ('PCB2MBBS : PCBoard to Mystic BBS File Base Converter');
WriteLn ('Copyright (C) 1998-2012 By James Coyle. All Rights Reserved'); WriteLn ('Copyright (C) 1998-2012 By James Coyle. All Rights Reserved');
WriteLn; WriteLn;
WriteLn ('Compiled for Mystic BBS v' + mysVersion); WriteLn ('Compiled for Mystic BBS v' + mysVersion);
WriteLn; WriteLn;
If ParamCount < 2 Then Begin If ParamCount < 2 Then Begin
WriteLn ('Usage: [PCBoard File] [Mystic BBS File] -DUPE'); WriteLn ('Usage: [PCBoard File] [Mystic BBS File] -DUPE');
Halt(1); Halt(1);
End; End;
DupeCheck := strUpper(ParamStr(3)) = '-DUPE'; DupeCheck := strUpper(ParamStr(3)) = '-DUPE';
Assign (inFile, ParamStr(1)); Assign (InFile, ParamStr(1));
{$I-} Reset(inFile); {$I+} {$I-} Reset(InFile); {$I+}
If IoResult <> 0 Then Begin
WriteLn ('ERROR: PCBoard file listing (', ParamStr(1), ') not found.');
Halt(1);
End;
FSplit (ParamStr(2), D, N, E); If IoResult <> 0 Then Begin
WriteLn ('ERROR: PCBoard file listing (', ParamStr(1), ') not found.');
Halt (1);
End;
Assign (FDirFile, D + N + '.dir'); FSplit (ParamStr(2), D, N, E);
{$I-} Reset (FDirFile); {$I+}
If IoResult <> 0 Then ReWrite (FDirFile);
Assign (desFile, D + N + '.des'); Assign (FDirFile, D + N + '.dir');
{$I-} Reset (desFile, 1); {$I+} {$I-} Reset (FDirFile); {$I+}
If IoResult <> 0 Then ReWrite (desFile, 1);
Total := 0; If IoResult <> 0 Then ReWrite (FDirFile);
Write ('Processing: '); Assign (DesFile, D + N + '.des');
{$I-} Reset (DesFile, 1); {$I+}
While Not Eof(inFile) Do Begin If IoResult <> 0 Then ReWrite (DesFile, 1);
If (Str[26] = '-') and (Str[29] = '-') Then Begin
If IsDupeFile(Copy(Str, 1, Pos(' ', Str) - 1)) Then Total := 0;
NoSave := True
Else Begin
NoSave := False;
Inc (Total); Write ('Processing: ');
GotoXY (13, WhereY);
Write (Total, ' files ... ');
End;
FDir.FileName := Copy(Str, 1, Pos(' ', Str) - 1); While Not Eof(inFile) Do Begin
FDir.Size := strS2I(Copy(Str, 13, 9)); If (Str[26] = '-') and (Str[29] = '-') Then Begin
FDir.DateTime := DateStr2Dos(Copy(Str, 24, 8)); If IsDupeFile(Copy(Str, 1, Pos(' ', Str) - 1)) Then
FDir.Uploader := 'PCB2MBBS'; NoSave := True
FDir.Flags := 0; Else Begin
FDir.DLs := 0; NoSave := False;
FDir.Lines := 1;
FDir.Pointer := FileSize(desFile);
Desc[1] := Copy(Str, 34, Length(Str)); Inc (Total);
GotoXY (13, WhereY);
Write (Total, ' files ... ');
End;
Repeat FillChar (FDir, SizeOf(FDir), #0);
ReadLn (inFile, Str);
If Str[32] = '|' Then Begin
Inc (FDir.Lines);
Desc[FDir.Lines] := Copy(Str, 34, Length(Str));
End;
Until (Str[32] <> '|') or Eof(inFile);
If Not NoSave Then Begin FDir.FileName := Copy(Str, 1, Pos(' ', Str) - 1);
Write (FDirFile, FDir); FDir.Size := strS2I(Copy(Str, 13, 9));
Seek (desFile, FDir.Pointer); FDir.DateTime := DateStr2Dos(Copy(Str, 24, 8));
FDir.Uploader := 'PCB2MBBS';
FDir.DescLines := 1;
FDir.DescPtr := FileSize(DesFile);
For A := 1 to FDir.Lines Do Begin Desc[1] := Copy(Str, 34, Length(Str));
BlockWrite (desFile, Desc[A][0], 1);
BlockWrite (desFile, Desc[A][1], Ord(Desc[A][0]));
End;
End;
End Else
If Not Eof(InFile) Then ReadLn (inFile, Str);
End;
Close (inFile); Repeat
Close (FDirFile); ReadLn (inFile, Str);
Close (desFile);
WriteLn ('DONE.'); If Str[32] = '|' Then Begin
Inc (FDir.DescLines);
Desc[FDir.DescLines] := Copy(Str, 34, Length(Str));
End;
Until (Str[32] <> '|') or Eof(inFile);
If Not NoSave Then Begin
Write (FDirFile, FDir);
Seek (DesFile, FDir.DescPtr);
For A := 1 to FDir.DescLines Do Begin
BlockWrite (desFile, Desc[A][0], 1);
BlockWrite (desFile, Desc[A][1], Ord(Desc[A][0]));
End;
End;
End Else
If Not Eof(InFile) Then ReadLn (inFile, Str);
End;
Close (InFile);
Close (FDirFile);
Close (DesFile);
WriteLn ('DONE.');
End. End.