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);
Result := strReplace(Result, 'YYYY', YearStr);
Result := strReplace(Result, 'YY', Copy(YearStr, 3, 2));
Result := strReplace(Result, 'MM', strZero(DT.Month)) +
strReplace(Result, 'DD', strZero(DT.Day)) +
strReplace(Result, 'HH', strZero(DT.Hour)) +
strReplace(Result, 'II', strZero(DT.Min)) +
strReplace(Result, 'SS', strZero(DT.Sec)) +
strReplace(Result, 'NNN', MonthString[DT.Month]);
Result := strReplace(Result, 'MM', strZero(DT.Month));
Result := strReplace(Result, 'DD', strZero(DT.Day));
Result := strReplace(Result, 'HH', strZero(DT.Hour));
Result := strReplace(Result, 'II', strZero(DT.Min));
Result := strReplace(Result, 'SS', strZero(DT.Sec));
Result := strReplace(Result, 'NNN', MonthString[DT.Month]);
End;
End.

View File

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

View File

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

View File

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

View File

@ -1481,7 +1481,7 @@ Begin
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> File:' + FName); {$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]^.Status := QueueIntransit;