This commit is contained in:
mysticbbs 2013-05-26 20:52:36 -04:00
parent 79d94e90c7
commit 07ec32d1b0
5 changed files with 30 additions and 24 deletions

View File

@ -364,12 +364,12 @@ Begin
YearStr := strI2S(DT.Year); YearStr := strI2S(DT.Year);
Result := strReplace(Result, 'YYYY', YearStr); Result := strReplace(Result, 'YYYY', YearStr);
Result := strReplace(Result, 'YY', Copy(YearStr, 3, 2)); Result := strReplace(Result, 'YY', Copy(YearStr, 3, 2));
Result := strReplace(Result, 'MM', strZero(DT.Month)) + Result := strReplace(Result, 'MM', strZero(DT.Month));
strReplace(Result, 'DD', strZero(DT.Day)) + Result := strReplace(Result, 'DD', strZero(DT.Day));
strReplace(Result, 'HH', strZero(DT.Hour)) + Result := strReplace(Result, 'HH', strZero(DT.Hour));
strReplace(Result, 'II', strZero(DT.Min)) + Result := strReplace(Result, 'II', strZero(DT.Min));
strReplace(Result, 'SS', strZero(DT.Sec)) + Result := strReplace(Result, 'SS', strZero(DT.Sec));
strReplace(Result, 'NNN', MonthString[DT.Month]); Result := strReplace(Result, 'NNN', MonthString[DT.Month]);
End; End;
End. End.

View File

@ -396,7 +396,7 @@ End;
procedure AbstractProtocol.PrepareReceivePart; procedure AbstractProtocol.PrepareReceivePart;
{-Parent-level inits for derived protocols} {-Parent-level inits for derived protocols}
begin begin
GotOneFile := False; GotOneFile := False;
ProtocolStatus := ecOk; ProtocolStatus := ecOk;
end; end;
@ -412,13 +412,14 @@ End;
State : ProtocolStateType; State : ProtocolStateType;
begin begin
PrepareReceivePart; PrepareReceivePart;
if ProtocolStatus <> ecOk then
Exit; if ProtocolStatus <> ecOk then exit;
repeat repeat
State := ProtocolReceivePart; State := ProtocolReceivePart;
aport.bufflush; aport.bufflush;
until State = psFinished; until (State = psFinished) or not aport.connected;
end; end;
procedure AbstractProtocol.apResetStatus; procedure AbstractProtocol.apResetStatus;

View File

@ -704,7 +704,7 @@ Hex:
begin begin
ProtocolStatus := ecNoHeader; ProtocolStatus := ecNoHeader;
while APort.DataWaiting do begin while aport.connected and APort.DataWaiting do begin
{Only get the next char if we don't know the header type yet} {Only get the next char if we don't know the header type yet}
case HeaderState of case HeaderState of
hsNone, hsGotZPad, hsGotZDle : hsNone, hsGotZPad, hsGotZDle :
@ -1095,7 +1095,7 @@ Begin
StatusTimer := TimerSet(StatusInterval); StatusTimer := TimerSet(StatusInterval);
APort.PurgeInputdata(0); APort.PurgeInputData(0);
HeaderType := ZrInit; HeaderType := ZrInit;
ZmodemState := rzRqstFile; ZmodemState := rzRqstFile;
@ -1131,7 +1131,7 @@ Begin
rzWaitFile, rzWaitFile,
rzStartData, rzStartData,
rzWaitEof : Begin rzWaitEof : Begin
If Not APort.DataWaiting Then If Not APort.DataWaiting {And APort.Connected} Then
APort.WaitForData(1000); APort.WaitForData(1000);
If APort.DataWaiting Then Begin If APort.DataWaiting Then Begin
@ -1202,9 +1202,11 @@ Begin
ZmodemState := rzError; ZmodemState := rzError;
end else if TimerUp(ReplyTimer) then begin end else if TimerUp(ReplyTimer) then begin
Inc(BlockErrors); Inc(BlockErrors);
if BlockErrors < HandshakeRetry then begin if BlockErrors < HandshakeRetry then begin
PutHexHeader(ZNak); PutHexHeader(ZNak);
ReplyTimer := TimerSet(HandshakeWait);
ReplyTimer := TimerSet(HandshakeWait);
ZmodemState := rzWaitFile; ZmodemState := rzWaitFile;
HeaderState := hsNone; HeaderState := hsNone;
end else end else
@ -1362,9 +1364,12 @@ Begin
end; end;
else begin {Fatal error opening file} else begin {Fatal error opening file}
SaveStatus := ProtocolStatus; SaveStatus := ProtocolStatus;
CancelTransfer; CancelTransfer;
ProtocolStatus := SaveStatus; ProtocolStatus := SaveStatus;
ZModemState := rzError; ZModemState := rzError;
goto ExitPoint; goto ExitPoint;
end; end;
end; end;
@ -1681,7 +1686,7 @@ Begin
end; end;
ExitPoint: ExitPoint:
{Set function result}
case ZmodemState of case ZmodemState of
rzRqstFile, rzRqstFile,
rzSendInit, rzSendInit,
@ -2485,7 +2490,7 @@ Begin
If ConvertToLower Then If ConvertToLower Then
PacketStr := strLower(PacketStr); PacketStr := strLower(PacketStr);
PacketStr := PacketStr + #0 + strI2S(SrcFileLen); PacketStr := PacketStr + #0 + strI2S(SrcFileLen) + #0;
PacketLen := Length(PacketStr); PacketLen := Length(PacketStr);
Move(PacketStr[1], DataBlock^, PacketLen); Move(PacketStr[1], DataBlock^, PacketLen);

View File

@ -34,7 +34,7 @@ Type
Constructor Create; Constructor Create;
Destructor Destroy; Override; Destructor Destroy; Override;
Function Add (fPath, fName, fNew: String) : Boolean; Function Add (CheckValid: Boolean; fPath, fName, fNew: String) : Boolean;
Procedure Delete (Idx: Word); Procedure Delete (Idx: Word);
Procedure Clear; Procedure Clear;
Function Next : Boolean; Function Next : Boolean;
@ -56,7 +56,7 @@ Begin
Clear; Clear;
End; End;
Function TProtocolQueue.Add (fPath, fName, fNew: String) : Boolean; Function TProtocolQueue.Add (CheckValid: Boolean; fPath, fName, fNew: String) : Boolean;
Var Var
F : File; F : File;
Begin Begin
@ -87,14 +87,14 @@ Begin
Inc (QFSize, QData[QSize]^.FileSize); Inc (QFSize, QData[QSize]^.FileSize);
Close(F); Close(F);
End Else Begin End Else
If CheckValid Then Begin
Dispose (QData[QSize]); Dispose (QData[QSize]);
Dec (QSize); Dec (QSize);
Exit; Exit;
End Else
// QData[QSize]^.Status := QueueNoFile; QData[QSize]^.Status := QueueNoFile;
End;
Result := True; Result := True;
End; End;

View File

@ -1481,7 +1481,7 @@ Begin
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> File:' + FName); {$ENDIF} {$IFDEF ZDEBUG} ZLog('ZRecvFile -> File:' + FName); {$ENDIF}
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> Size:' + strI2S(FSize)); {$ENDIF} {$IFDEF ZDEBUG} ZLog('ZRecvFile -> Size:' + strI2S(FSize)); {$ENDIF}
Queue.Add(ReceivePath, FName, ''); Queue.Add(False, ReceivePath, FName, '');
Queue.QData[Queue.QSize]^.FileSize := FSize; Queue.QData[Queue.QSize]^.FileSize := FSize;
Queue.QData[Queue.QSize]^.Status := QueueIntransit; Queue.QData[Queue.QSize]^.Status := QueueIntransit;