📄 adprotcl.pas
字号:
OldSkip : Boolean;
begin
if (NewOpt <> FZmodemFileOption) or Force then begin
{Disallow zfoWriteCrc, it's not supported yet}
if NewOpt = zfoWriteCrc then
Exit;
FZmodemFileOption := NewOpt;
with PData^ do begin
if aCurProtocol = Ord(ptZmodem) then begin
OldSkip := ZmodemSkipNoFile;
zFileMgmtOpts := Ord(NewOpt);
if OldSkip then
zFileMgmtOpts := zFileMgmtOpts or FileSkipMask;
end;
end;
end;
end;
function TApdCustomProtocol.GetZmodemRecover : Boolean;
{-Return the recovery option}
begin
if PData^.aCurProtocol = Ord(ptZmodem) then
FZmodemRecover := PData^.zReceiverRecover;
Result := FZmodemRecover;
end;
procedure TApdCustomProtocol.SetZmodemRecover(const NewRecover : Boolean);
{-Enable/disable Zmodem crash recovery}
begin
if (NewRecover <> FZmodemRecover) or Force then begin
FZmodemRecover := NewRecover;
if PData^.aCurProtocol = Ord(ptZmodem) then
PData^.zReceiverRecover := NewRecover;
end;
end;
function TApdCustomProtocol.GetZmodem8K : Boolean;
{-Return the state Zmodem's 8K mode}
begin
if PData^.aCurProtocol = Ord(ptZmodem) then
FZmodem8K := PData^.zUse8KBlocks;
Result := FZmodem8K;
end;
procedure TApdCustomProtocol.SetZmodem8K(const New8K : Boolean);
{-Enable/disable 8K blocks}
begin
if (New8K <> FZmodem8K) or Force then begin
FZmodem8K := New8K;
if PData^.aCurProtocol = Ord(ptZmodem) then
CheckException(Self, zpSetBigSubpacketOption(PData, New8K));
end;
end;
function TApdCustomProtocol.GetZmodemZRQINITValue : LongInt;
{-Return the Zmodem's ZRQINIT value}
begin
if PData^.aCurProtocol = Ord(ptZmodem) then
FZmodemZRQINITValue := PData^.zZRQINITValue;
Result := FZmodemZRQINITValue;
end;
procedure TApdCustomProtocol.SetZmodemZRQINITValue(const NewZRQINITValue : LongInt);
{-Set the Zmodem's ZRQINIT value}
begin
if (NewZRQINITValue <> FZmodemZRQINITValue) or Force then begin
FZmodemZRQINITValue := NewZRQINITValue;
if PData^.aCurProtocol = Ord(ptZmodem) then
PData^.zZRQINITValue := NewZRQINITValue;
end;
end;
function TApdCustomProtocol.GetZmodemFinishRetry : Cardinal;
{-Return the Zmodem finish retry count}
begin
if PData^.aCurProtocol = Ord(ptZmodem) then
FZmodemFinishRetry := PData^.zFinishRetry;
Result := FZmodemFinishRetry;
end;
procedure TApdCustomProtocol.SetZmodemFinishRetry(const NewRetry : Cardinal);
{-Enable/disable 8K blocks}
begin
if (NewRetry <> FZmodemFinishRetry) or Force then begin
FZmodemFinishRetry := NewRetry;
if PData^.aCurProtocol = Ord(ptZmodem) then
CheckException(Self,
zpSetZmodemFinishWait(PData, PData^.aFinishWait, FZmodemFinishRetry));
end;
end;
function TApdCustomProtocol.GetKermitMaxLen : Cardinal;
{-Return the max packet len (normal)}
begin
if PData^.aCurProtocol = Ord(ptKermit) then begin
FKermitMaxLen := PData^.kKermitOptions.MaxLongPacketLen;
if FKermitMaxLen = 0 then
FKermitMaxLen := PData^.kKermitOptions.MaxPacketLen;
end;
Result := FKermitMaxLen;
end;
procedure TApdCustomProtocol.SetKermitMaxLen(const NewLen : Cardinal);
{-Set a new max len}
begin
if (NewLen <> FKermitMaxLen) or Force then begin
if NewLen <= 94 then begin
FKermitMaxLen := NewLen;
if PData^.aCurProtocol = Ord(ptKermit) then begin
CheckException(Self, kpSetMaxPacketLen(PData, NewLen));
CheckException(Self, kpSetMaxLongPacketLen(PData, 0));
end;
end else begin
if NewLen > MaxKermitLongLen then
FKermitMaxLen := MaxKermitLongLen
else
FKermitMaxLen := NewLen;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetMaxLongPacketLen(PData, NewLen));
end;
end;
end;
function TApdCustomProtocol.GetKermitMaxWindows : Cardinal;
{-Return the maximum number of windows}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitMaxWindows := PData^.kKermitOptions.WindowSize;
Result := FKermitMaxWindows;
end;
procedure TApdCustomProtocol.SetKermitMaxWindows(const NewMax : Cardinal);
{-Set new max windows}
begin
if (NewMax <> FKermitMaxWindows) or Force then begin
if NewMax > MaxKermitWindows then
FKermitMaxWindows := MaxKermitWindows
else
FKermitMaxWindows := NewMax;
{If not really using windows then disable SWC}
if (NewMax = 0) or (NewMax = 1) then
FKermitMaxWindows := 0;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetMaxWindows(PData, FKermitMaxWindows));
end;
end;
function TApdCustomProtocol.GetKermitSWCTurnDelay : Cardinal;
{-Return the turn delay for when sliding windows are in use}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitSWCTurnDelay := PData^.kSWCTurnDelay;
Result := FKermitSWCTurnDelay;
end;
procedure TApdCustomProtocol.SetKermitSWCTurnDelay(const NewDelay : Cardinal);
{-Set new turn delay value for sliding windows}
begin
if (NewDelay <> FKermitSWCTurnDelay) or Force then begin
FKermitSWCTurnDelay := NewDelay;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetSWCTurnDelay(PData, NewDelay));
end;
end;
function TApdCustomProtocol.GetKermitTimeoutSecs : Cardinal;
{-Return the packet timeout, in seconds}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitTimeoutSecs := PData^.kKermitOptions.MaxTimeout;
Result := FKermitTimeoutSecs;
end;
procedure TApdCustomProtocol.SetKermitTimeoutSecs(const NewTimeout : Cardinal);
{-Set a new timeout value}
begin
if (NewTimeout <> FKermitTimeoutSecs) or Force then begin
FKermitTimeoutSecs := NewTimeout;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetMaxTimeoutSecs(PData, NewTimeout));
end;
end;
function TApdCustomProtocol.GetKermitPadCharacter : Char;
{-Return the new pad character}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitPadCharacter := PData^.kKermitOptions.PadChar;
Result := FKermitPadCharacter;
end;
procedure TApdCustomProtocol.SetKermitPadCharacter(NewChar : Char);
{-Set a new pad character}
begin
if (NewChar <> FKermitPadCharacter) or Force then begin
FKermitPadCharacter := NewChar;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self,
kpSetPacketPadding(PData, FKermitPadCharacter, FKermitPadCount));
end;
end;
function TApdCustomProtocol.GetKermitPadCount : Cardinal;
{-Return the pad count}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitPadCount := PData^.kKermitOptions.PadCount;
Result := FKermitPadCount;
end;
procedure TApdCustomProtocol.SetKermitPadCount(NewCount : Cardinal);
{-Set a new pad count}
begin
if (NewCount <> FKermitPadCount) or Force then begin
FKermitPadCount := NewCount;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self,
kpSetPacketPadding(PData, FKermitPadCharacter, FKermitPadCount));
end;
end;
function TApdCustomProtocol.GetKermitTerminator : Char;
{-Return the kermit terminator}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitTerminator := PData^.kKermitOptions.Terminator;
Result := FKermitTerminator;
end;
procedure TApdCustomProtocol.SetKermitTerminator(const NewTerminator : Char);
{-Set new terminator}
begin
if (NewTerminator <> FKermitTerminator) or Force then begin
FKermitTerminator := NewTerminator;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetTerminator(PData, NewTerminator));
end;
end;
function TApdCustomProtocol.GetKermitCtlPrefix : Char;
{-Return the control char prefix}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitCtlPrefix := PData^.kKermitOptions.CtlPrefix;
Result := FKermitCtlPrefix;
end;
procedure TApdCustomProtocol.SetKermitCtlPrefix(const NewPrefix : Char);
{-Set new ctrl char prefix}
begin
if (NewPrefix <> FKermitCtlPrefix) or Force then begin
FKermitCtlPrefix := NewPrefix;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetCtlPrefix(PData, NewPrefix));
end;
end;
function TApdCustomProtocol.GetKermitHighbitPrefix : Char;
{-Return the highbit prefix}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitHighbitPrefix := PData^.kKermitOptions.HibitPrefix;
Result := FKermitHighbitPrefix;
end;
procedure TApdCustomProtocol.SetKermitHighbitPrefix(const NewPrefix : Char);
{-Set new highbit prefix}
begin
if (NewPrefix <> FKermitHighbitPrefix) or Force then begin
FKermitHighbitPrefix := NewPrefix;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetHibitPrefix(PData, NewPrefix));
end;
end;
function TApdCustomProtocol.GetKermitRepeatPrefix : Char;
{-Return the repeat prefix}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
FKermitRepeatPrefix := PData^.kKermitOptions.RepeatPrefix;
Result := FKermitRepeatPrefix;
end;
procedure TApdCustomProtocol.SetKermitRepeatPrefix(const NewPrefix : Char);
{-Set a new repeat prefix}
begin
if (NewPrefix <> FKermitRepeatPrefix) or Force then begin
FKermitRepeatPrefix := NewPrefix;
if PData^.aCurProtocol = Ord(ptKermit) then
CheckException(Self, kpSetRepeatPrefix(PData, NewPrefix));
end;
end;
function TApdCustomProtocol.GetKermitWindowsTotal : Cardinal;
{-Return the total number of windows negotiated}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
Result := kpGetSWCSize(PData)
else
Result := KermitMaxWindows;
end;
function TApdCustomProtocol.GetKermitWindowsUsed : Cardinal;
{-Return the total number of windows filled with data}
begin
if PData^.aCurProtocol = Ord(ptKermit) then
Result := kpWindowsUsed(PData)
else
Result := 0;
end;
function TApdCustomProtocol.GetKermitLongBlocks : Boolean;
{-Return True if long blocks are requested or negotiated}
var
Dummy : Cardinal;
InUse : Bool;
begin
if PData^.aCurProtocol = Ord(ptKermit) then begin
kpGetLPStatus(PData, InUse, Dummy);
Result := InUse;
end else
Result := False;
end;
function TApdCustomProtocol.GetAsciiCharDelay : Cardinal;
{-Return the inter-char delay}
begin
if PData^.aCurProtocol = Ord(ptAscii) then
FAsciiCharDelay := PData^.sInterCharDelay;
Result := FAsciiCharDelay;
end;
procedure TApdCustomProtocol.SetAsciiCharDelay(const NewDelay : Cardinal);
{-Set a new inter-char delay}
begin
if (NewDelay <> FAsciiCharDelay) or Force then begin
FAsciiCharDelay := NewDelay;
if PData^.aCurProtocol = Ord(ptAscii) then
CheckException(Self,
spSetDelays(PData, FAsciiCharDelay, FAsciiLineDelay));
end;
end;
function TApdCustomProtocol.GetUpcaseFileNames : Boolean;
{-Return the UpcaseFileNames value}
begin
Result := PData^.aUpcaseFileNames;
end;
procedure TApdCustomProtocol.SetUpcaseFileNames(NewUpcase : Boolean);
{-Set a new UpcaseFileNames value}
begin
PData^.aUpcaseFileNames := NewUpcase;
end;
function TApdCustomProtocol.GetAsciiLineDelay : Cardinal;
{-Return the inter-line delay}
begin
if PData^.aCurProtocol = Ord(ptAscii) then
FAsciiLineDelay := PData^.sInterLineDelay;
Result :=
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -