2012-02-13 16:50:48 -08:00
|
|
|
|
Unit bbs_cfg_Protocol;
|
|
|
|
|
|
|
|
|
|
{$I M_OPS.PAS}
|
|
|
|
|
|
|
|
|
|
Interface
|
|
|
|
|
|
|
|
|
|
Procedure Configuration_ProtocolEditor;
|
|
|
|
|
|
|
|
|
|
Implementation
|
|
|
|
|
|
|
|
|
|
Uses
|
|
|
|
|
m_FileIO,
|
|
|
|
|
m_Strings,
|
|
|
|
|
bbs_Common,
|
2013-08-28 15:31:33 -07:00
|
|
|
|
bbs_dataBase,
|
2012-02-13 16:50:48 -08:00
|
|
|
|
bbs_ansi_MenuBox,
|
2012-02-17 23:17:49 -08:00
|
|
|
|
bbs_ansi_MenuForm,
|
|
|
|
|
bbs_cfg_Common;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Procedure EditProtocol (Var Prot: RecProtocol);
|
|
|
|
|
Var
|
|
|
|
|
Box : TAnsiMenuBox;
|
|
|
|
|
Form : TAnsiMenuForm;
|
|
|
|
|
Begin
|
|
|
|
|
Box := TAnsiMenuBox.Create;
|
|
|
|
|
Form := TAnsiMenuForm.Create;
|
|
|
|
|
|
|
|
|
|
Form.HelpSize := 0;
|
|
|
|
|
|
|
|
|
|
Box.Header := ' Protocol Editor: ' + Prot.Desc + ' ';
|
|
|
|
|
|
|
|
|
|
Box.Open (6, 5, 75, 15);
|
|
|
|
|
|
|
|
|
|
VerticalLine (22, 7, 13);
|
|
|
|
|
|
|
|
|
|
Form.AddBol ('A', ' Active ' , 14, 7, 24, 7, 8, 3, @Prot.Active, '');
|
2013-08-28 18:01:55 -07:00
|
|
|
|
Form.AddTog ('O', ' OS ' , 18, 8, 24, 8, 4, 7, 0, 4, 'Windows Linux OSX All OS/2', @Prot.OSType, '');
|
2012-02-13 16:50:48 -08:00
|
|
|
|
Form.AddBol ('B', ' Batch ' , 15, 9, 24, 9, 7, 3, @Prot.Batch, '');
|
|
|
|
|
Form.AddChar ('K', ' Hot Key ' , 13, 10, 24, 10, 9, 1, 254, @Prot.Key, '');
|
|
|
|
|
Form.AddStr ('D', ' Description ' , 9, 11, 24, 11, 13, 40, 40, @Prot.Desc, '');
|
|
|
|
|
Form.AddStr ('S', ' Send Command ', 8, 12, 24, 12, 14, 50, 100, @Prot.SendCmd, '');
|
|
|
|
|
Form.AddStr ('R', ' Recv Command ', 8, 13, 24, 13, 14, 50, 100, @Prot.RecvCmd, '');
|
|
|
|
|
|
|
|
|
|
Form.Execute;
|
|
|
|
|
Box.Close;
|
|
|
|
|
|
|
|
|
|
Form.Free;
|
|
|
|
|
Box.Free;
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
Procedure Configuration_ProtocolEditor;
|
|
|
|
|
Var
|
2013-05-08 23:12:55 -07:00
|
|
|
|
Box : TAnsiMenuBox;
|
|
|
|
|
List : TAnsiMenuList;
|
|
|
|
|
ProtFile : File of RecProtocol;
|
|
|
|
|
Prot : RecProtocol;
|
|
|
|
|
Copied : RecProtocol;
|
|
|
|
|
HasCopy : Boolean = False;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Procedure MakeList;
|
|
|
|
|
Var
|
|
|
|
|
OS : String;
|
|
|
|
|
Begin
|
|
|
|
|
List.Clear;
|
|
|
|
|
|
2013-05-08 23:12:55 -07:00
|
|
|
|
ioReset (ProtFile, SizeOf(RecProtocol), fmRWDN);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
2013-05-08 23:12:55 -07:00
|
|
|
|
While Not EOF(ProtFile) Do Begin
|
|
|
|
|
Read (ProtFile, Prot);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Case Prot.OSType of
|
|
|
|
|
0 : OS := 'Windows';
|
|
|
|
|
1 : OS := 'Linux ';
|
|
|
|
|
2 : OS := 'OSX';
|
2012-08-11 11:58:58 -07:00
|
|
|
|
3 : OS := 'All';
|
2012-02-13 16:50:48 -08:00
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
//'Active OSID Batch Key Description');
|
|
|
|
|
|
|
|
|
|
List.Add (strPadR(strYN(Prot.Active), 6, ' ') + ' ' + strPadR(OS, 7, ' ') + ' ' + strPadR(strYN(Prot.Batch), 5, ' ') + ' ' + strPadR(Prot.Key, 4, ' ') + Prot.Desc, 0);
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
List.Add ('', 2);
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
Begin
|
2013-08-28 15:31:33 -07:00
|
|
|
|
Assign (ProtFile, bbsCfg.DataPath + 'protocol.dat');
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
2013-05-08 23:12:55 -07:00
|
|
|
|
If Not ioReset(ProtFile, SizeOf(RecProtocol), fmRWDN) Then
|
|
|
|
|
If Not ioReWrite(ProtFile, SizeOf(RecProtocol), fmRWDN) Then
|
|
|
|
|
Exit;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Box := TAnsiMenuBox.Create;
|
|
|
|
|
List := TAnsiMenuList.Create;
|
|
|
|
|
|
|
|
|
|
Box.Header := ' Protocol Editor ';
|
|
|
|
|
List.NoWindow := True;
|
2012-02-17 23:17:49 -08:00
|
|
|
|
List.LoChars := #13#27#47;
|
2012-08-04 16:18:48 -07:00
|
|
|
|
List.SearchY := 20;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Box.Open (13, 5, 67, 20);
|
|
|
|
|
|
2012-02-17 23:17:49 -08:00
|
|
|
|
WriteXY (15, 7, 112, 'Active OSID Batch Key Description');
|
|
|
|
|
WriteXY (15, 8, 112, strRep('<27>', 51));
|
2012-02-13 16:50:48 -08:00
|
|
|
|
WriteXY (15, 18, 112, strRep('<27>', 51));
|
2012-02-26 03:51:59 -08:00
|
|
|
|
WriteXY (29, 19, 112, cfgCommandList);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
|
MakeList;
|
|
|
|
|
|
2012-02-17 23:17:49 -08:00
|
|
|
|
List.Open (13, 8, 67, 18);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
List.Close;
|
|
|
|
|
|
|
|
|
|
Case List.ExitCode of
|
2012-02-24 08:47:28 -08:00
|
|
|
|
'/' : Case GetCommandOption(10, 'I-Insert|D-Delete|C-Copy|P-Paste|') of
|
2012-02-17 23:17:49 -08:00
|
|
|
|
'I' : Begin
|
2013-05-08 23:12:55 -07:00
|
|
|
|
AddRecord (ProtFile, List.Picked, SizeOf(RecProtocol));
|
2012-02-17 23:17:49 -08:00
|
|
|
|
|
|
|
|
|
Prot.OSType := OSType;
|
|
|
|
|
Prot.Desc := 'New protocol';
|
|
|
|
|
Prot.Key := '!';
|
|
|
|
|
Prot.Active := False;
|
|
|
|
|
Prot.Batch := False;
|
|
|
|
|
Prot.SendCmd := '';
|
|
|
|
|
Prot.RecvCmd := '';
|
|
|
|
|
|
2013-05-08 23:12:55 -07:00
|
|
|
|
Write (ProtFile, Prot);
|
2012-02-17 23:17:49 -08:00
|
|
|
|
|
|
|
|
|
MakeList;
|
|
|
|
|
End;
|
|
|
|
|
'D' : If List.Picked < List.ListMax Then
|
|
|
|
|
If ShowMsgBox(1, 'Delete this entry?') Then Begin
|
2013-05-08 23:12:55 -07:00
|
|
|
|
KillRecord (ProtFile, List.Picked, SizeOf(RecProtocol));
|
2012-02-17 23:17:49 -08:00
|
|
|
|
MakeList;
|
|
|
|
|
End;
|
2012-02-24 08:47:28 -08:00
|
|
|
|
'C' : If List.Picked <> List.ListMax Then Begin
|
2013-05-08 23:12:55 -07:00
|
|
|
|
Seek (ProtFile, List.Picked - 1);
|
|
|
|
|
Read (ProtFile, Copied);
|
2012-02-24 08:47:28 -08:00
|
|
|
|
|
|
|
|
|
HasCopy := True;
|
|
|
|
|
End;
|
|
|
|
|
'P' : If HasCopy Then Begin
|
2013-05-08 23:12:55 -07:00
|
|
|
|
AddRecord (ProtFile, List.Picked, SizeOf(RecProtocol));
|
|
|
|
|
Write (ProtFile, Copied);
|
2012-02-24 08:47:28 -08:00
|
|
|
|
|
|
|
|
|
MakeList;
|
|
|
|
|
End;
|
|
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
|
End;
|
|
|
|
|
#13 : If List.Picked <> List.ListMax Then Begin
|
2013-05-08 23:12:55 -07:00
|
|
|
|
Seek (ProtFile, List.Picked - 1);
|
|
|
|
|
Read (ProtFile, Prot);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
EditProtocol(Prot);
|
|
|
|
|
|
2013-05-08 23:12:55 -07:00
|
|
|
|
Seek (ProtFile, List.Picked - 1);
|
|
|
|
|
Write (ProtFile, Prot);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
End;
|
|
|
|
|
#27 : Break;
|
|
|
|
|
End;
|
|
|
|
|
Until False;
|
|
|
|
|
|
2013-05-08 23:12:55 -07:00
|
|
|
|
Close (ProtFile);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
|
|
Box.Close;
|
|
|
|
|
List.Free;
|
|
|
|
|
Box.Free;
|
|
|
|
|
End;
|
|
|
|
|
|
2012-02-17 23:17:49 -08:00
|
|
|
|
End.
|