Default protocol support

This commit is contained in:
mysticbbs 2012-08-08 02:32:31 -04:00
parent 2f6fc90ab4
commit a0f902afb4
1 changed files with 67 additions and 40 deletions

View File

@ -42,8 +42,8 @@ Type
Constructor Create (Var Owner: Pointer); Constructor Create (Var Owner: Pointer);
Destructor Destroy; Override; Destructor Destroy; Override;
Procedure dszGetFile (Var LogFile: Text; Var FName: String; Var Res: Boolean); Procedure DszGetFile (Var LogFile: Text; Var FName: String; Var Res: Boolean);
Function dszSearch (FName: String) : Boolean; Function DszSearch (FName: String) : Boolean;
Procedure GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte); Procedure GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte);
Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
Procedure ExecuteProtocol (Send: Boolean; FName: String); Procedure ExecuteProtocol (Send: Boolean; FName: String);
@ -57,7 +57,7 @@ Type
Procedure BatchDelete; Procedure BatchDelete;
Procedure SetFileScan; Procedure SetFileScan;
Procedure GetFileScan; Procedure GetFileScan;
Function SelectProtocol (Batch : Boolean) : Char; Function SelectProtocol (UseDefault, Batch: Boolean) : Char;
Function WildcardMatch (Wildcard, FName: String) : Boolean; Function WildcardMatch (Wildcard, FName: String) : Boolean;
Procedure CheckFileNameLength (FPath : String; Var FName : String); Procedure CheckFileNameLength (FPath : String; Var FName : String);
Procedure GetFileDescription (FN: String); Procedure GetFileDescription (FN: String);
@ -406,7 +406,7 @@ Begin
If Not FileExist(Data) Then Exit; If Not FileExist(Data) Then Exit;
If SelectProtocol(False) = 'Q' Then Exit; If SelectProtocol(True, False) = 'Q' Then Exit;
ExecuteProtocol(True, Data); ExecuteProtocol(True, Data);
@ -934,52 +934,78 @@ Begin
Result := True; Result := True;
End; End;
Function TFileBase.SelectProtocol (Batch: Boolean) : Char; Function TFileBase.SelectProtocol (UseDefault, Batch: Boolean) : Char;
Function LoadByKey (Key: Char) : Boolean;
Begin
Result := False;
If Key = 'Q' Then Exit;
Reset (ProtocolFile);
While Not Eof(ProtocolFile) Do Begin
Read (ProtocolFile, Protocol);
If ((Protocol.Active) And (Key = Protocol.Key) And (Protocol.Batch = Batch) And (Protocol.OSType = OSType)) Then Begin
Result := True;
Break;
End;
End;
Close(ProtocolFile);
End;
Var Var
Keys : String; SavedP1 : String;
OldP1 : String; SavedP2 : String;
Ch : Char; Keys : String;
Begin Begin
OldP1 := Session.io.PromptInfo[1]; SavedP1 := Session.io.PromptInfo[1];
Result := 'Q'; SavedP2 := Session.io.PromptInfo[2];
Keys := 'Q'; Result := Session.User.ThisUser.Protocol;
Session.io.OutFullLn(Session.GetPrompt(359)); If Not LoadByKey(Result) Then Begin
Keys := 'Q';
Reset (ProtocolFile); Session.io.OutFullLn(Session.GetPrompt(359));
While Not Eof(ProtocolFile) Do Begin Reset (ProtocolFile);
Read (ProtocolFile, Protocol);
If Protocol.Active And (Protocol.Batch = Batch) And (Protocol.OSType = OSTYpe) Then Begin
Keys := Keys + Protocol.Key;
Session.io.PromptInfo[1] := Protocol.Key; While Not Eof(ProtocolFile) Do Begin
Session.io.PromptInfo[2] := Protocol.Desc; Read (ProtocolFile, Protocol);
Session.io.OutFullLn (Session.GetPrompt(61)); If Protocol.Active And (Protocol.Batch = Batch) And (Protocol.OSType = OSTYpe) Then Begin
Keys := Keys + Protocol.Key;
Session.io.PromptInfo[1] := Protocol.Key;
Session.io.PromptInfo[2] := Protocol.Desc;
Session.io.OutFullLn (Session.GetPrompt(61));
End;
End;
Close (ProtocolFile);
Session.io.OutFull (Session.GetPrompt(62));
Result := Session.io.OneKey(Keys, True);
If Result = 'Q' Then Begin
Session.io.PromptInfo[1] := SavedP1;
Session.io.PromptInfo[2] := SavedP2;
Exit;
End; End;
End; End;
Close (ProtocolFile); LoadByKey(Result);
Session.io.OutFull (Session.GetPrompt(62)); Session.io.PromptInfo[1] := Protocol.Desc;
Session.io.PromptInfo[1] := OldP1;
Ch := Session.io.OneKey(Keys, True);
If Ch = 'Q' Then Exit;
Reset (ProtocolFile);
While Not Eof(ProtocolFile) Do Begin
Read(ProtocolFile, Protocol);
If ((Protocol.Active) And (Ch = Protocol.Key) And (Protocol.Batch = Batch) And (Protocol.OSType = OSType)) Then Break;
End;
Close(ProtocolFile);
Session.io.OutFullLn (Session.GetPrompt(65)); Session.io.OutFullLn (Session.GetPrompt(65));
Result := Ch; Session.io.PromptInfo[1] := SavedP1;
End; End;
Procedure TFileBase.ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); Procedure TFileBase.ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
@ -1132,7 +1158,8 @@ Begin
Exit; Exit;
End; End;
Session.io.OutFull (Session.GetPrompt(47)); Session.io.OutFull (Session.GetPrompt(47));
FName := Session.io.GetInput(70, 70, 11, ''); FName := Session.io.GetInput(70, 70, 11, '');
If FName = '' Then Exit; If FName = '' Then Exit;
@ -2548,7 +2575,7 @@ Begin
FileName := FBase.Path + FileName; FileName := FBase.Path + FileName;
End; End;
If SelectProtocol(Blind) = 'Q' Then Begin If SelectProtocol(True, Blind) = 'Q' Then Begin
FBase := OLD; FBase := OLD;
Exit; Exit;
End; End;
@ -2842,7 +2869,7 @@ Begin
Session.io.OutFullLn (Session.GetPrompt(79)); Session.io.OutFullLn (Session.GetPrompt(79));
If SelectProtocol(True) = 'Q' Then Exit; If SelectProtocol(True, True) = 'Q' Then Exit;
Assign (FL, Session.TempPath + 'file.lst'); Assign (FL, Session.TempPath + 'file.lst');
ReWrite (FL); ReWrite (FL);
@ -2874,7 +2901,7 @@ Begin
For A := 1 to BatchNum Do Begin For A := 1 to BatchNum Do Begin
Session.io.PromptInfo[1] := JustFile(Batch[A].FileName); Session.io.PromptInfo[1] := JustFile(Batch[A].FileName);
If dszSearch (Batch[A].FileName) Then Begin If DszSearch (Batch[A].FileName) Then Begin
Session.SystemLog ('Download: ' + Batch[A].FileName); Session.SystemLog ('Download: ' + Batch[A].FileName);
Session.io.OutFullLn (Session.GetPrompt(385)); Session.io.OutFullLn (Session.GetPrompt(385));