Begin NodeSpy terminal

This commit is contained in:
mysticbbs 2012-09-22 20:43:29 -04:00
parent 14edb457b7
commit 6a49bd147d
2 changed files with 31 additions and 145 deletions

View File

@ -33,7 +33,6 @@ Uses
BaseUnix,
{$ENDIF}
DOS,
Math,
m_FileIO,
m_DateTime,
m_Strings,
@ -43,10 +42,7 @@ Uses
m_io_Base,
m_io_Sockets,
m_Term_Ansi,
m_MenuBox,
m_MenuInput;
{$I RECORDS.PAS}
NodeSpy_Common;
Const
HiddenNode = 255;
@ -89,14 +85,9 @@ Var
NodeInfo : Array[1..255] of PNodeInfo;
ChatFile : File of ChatRec;
Chat : ChatRec;
ConfigFile : File of RecConfig;
Config : RecConfig;
NodeFile : File of NodeMsgRec;
Msg : NodeMsgRec;
BasePath : String;
Screen : TOutput;
Keyboard : TInput;
Term : TTermAnsi;
{$I NODESPY_ANSI.PAS}
@ -167,133 +158,6 @@ Begin
New (NodeInfo[Count]);
End;
Function ShowMsgBox (BoxType: Byte; Str: String) : Boolean;
Var
Len : Byte;
Len2 : Byte;
Pos : Byte;
MsgBox : TMenuBox;
Offset : Byte;
SavedX : Byte;
SavedY : Byte;
SavedA : Byte;
Begin
ShowMsgBox := True;
SavedX := Screen.CursorX;
SavedY := Screen.CursorY;
SavedA := Screen.TextAttr;
MsgBox := TMenuBox.Create(TOutput(Screen));
Len := (80 - (Length(Str) + 2)) DIV 2;
Pos := 1;
MsgBox.FrameType := 6;
MsgBox.Header := ' Info ';
MsgBox.HeadAttr := 1 + 7 * 16;
MsgBox.Box3D := True;
If Screen.ScreenSize = 50 Then Offset := 12 Else Offset := 0;
If BoxType < 2 Then
MsgBox.Open (Len, 10 + Offset, Len + Length(Str) + 3, 15 + Offset)
Else
MsgBox.Open (Len, 10 + Offset, Len + Length(Str) + 3, 14 + Offset);
Screen.WriteXY (Len + 2, 12 + Offset, 112, Str);
Case BoxType of
0 : Begin
Len2 := (Length(Str) - 4) DIV 2;
Screen.WriteXY (Len + Len2 + 2, 14 + Offset, 30, ' OK ');
Repeat
Keyboard.ReadKey;
Until Not Keyboard.KeyPressed;
End;
1 : Repeat
Len2 := (Length(Str) - 9) DIV 2;
Screen.WriteXY (Len + Len2 + 2, 14 + Offset, 113, ' YES ');
Screen.WriteXY (Len + Len2 + 7, 14 + Offset, 113, ' NO ');
If Pos = 1 Then
Screen.WriteXY (Len + Len2 + 2, 14 + Offset, 30, ' YES ')
Else
Screen.WriteXY (Len + Len2 + 7, 14 + Offset, 30, ' NO ');
Case UpCase(Keyboard.ReadKey) of
#00 : Case Keyboard.ReadKey of
#75 : Pos := 1;
#77 : Pos := 0;
End;
#13 : Begin
ShowMsgBox := Boolean(Pos);
Break;
End;
#32 : If Pos = 0 Then Inc(Pos) Else Pos := 0;
'N' : Begin
ShowMsgBox := False;
Break;
End;
'Y' : Begin
ShowMsgBox := True;
Break;
End;
End;
Until False;
End;
If BoxType < 2 Then MsgBox.Close;
MsgBox.Free;
Screen.CursorXY (SavedX, SavedY);
Screen.TextAttr := SavedA;
End;
Function GetStr (Header, Text, Def: String; Len, MaxLen: Byte) : String;
Var
Box : TMenuBox;
Input : TMenuInput;
Offset : Byte;
Str : String;
WinSize : Byte;
Begin
WinSize := (80 - Max(Len, Length(Text)) + 2) DIV 2;
Box := TMenuBox.Create(TOutput(Screen));
Input := TMenuInput.Create(TOutput(Screen));
Box.FrameType := 6;
Box.Header := ' ' + Header + ' ';
Box.HeadAttr := 1 + 7 * 16;
Box.Box3D := True;
Input.Attr := 15 + 4 * 16;
Input.FillAttr := 7 + 4 * 16;
Input.LoChars := #13#27;
If Screen.ScreenSize = 50 Then Offset := 12 Else Offset := 0;
Box.Open (WinSize, 10 + Offset, WinSize + Max(Len, Length(Text)) + 2, 15 + Offset);
Screen.WriteXY (WinSize + 2, 12 + Offset, 112, Text);
Str := Input.GetStr(WinSize + 2, 13 + Offset, Len, MaxLen, 1, Def);
Box.Close;
If Input.ExitCode = #27 Then Str := '';
Input.Free;
Box.Free;
Result := Str;
End;
Procedure MakeChatRecord;
Begin
Assign (ChatFile, Config.DataPath + 'chat' + strI2S(HiddenNode) + '.dat');
@ -606,12 +470,12 @@ Var
Done : Boolean;
Ch : Char;
Begin
Screen.SetWindowTitle('NodeSpy/Local login');
Screen.SetWindowTitle('NodeSpy/Terminal');
Screen.TextAttr := 7;
Screen.ClearScreen;
Screen.WriteStr ('Telnet to 127.0.0.1... ');
Screen.WriteStr ('Connecting to 127.0.0.1... ');
Client := TIOSocket.Create;
@ -675,6 +539,28 @@ Begin
Screen.SetWindow (1, 1, 80, 25, True);
End;
Procedure Terminal;
Type
PhoneRec = Record
Name : String[40];
Address : String[60];
User : String[30];
Password : String[20];
StatusBar : Boolean;
End;
Var
Book : Array[1..200] of PhoneRec;
Begin
// create phonebook
// write phonebook
// load phonebook
// do directory
// name, address, user, password, statusbar, sysop, software
End;
Procedure UpdateOnlineStatus;
Var
Count : LongInt;

View File

@ -2,8 +2,8 @@ Procedure DrawNodeSpyScreen;
Const
IMAGEDATA_WIDTH=80;
IMAGEDATA_DEPTH=25;
IMAGEDATA_LENGTH=1110;
IMAGEDATA : array [1..1110] of Char = (
IMAGEDATA_LENGTH=1114;
IMAGEDATA : array [1..1114] of Char = (
#1,#16,'Ü','Ü',#25,#10, #8,'Ü','Ü',#25, #3, #7,'°', #0,#23,'²',#16,
#25,#23, #9,#26, #4,'Ü',#25, #9,#14,'±','Û','±', #7,'°', #0,#23,'²',
#16,#25, #8, #7,'°', #0,#23,'²', #8,#16,'g','j','!',#24,' ', #9,#17,
@ -65,11 +65,11 @@ Const
's',#25,#21, #9,'A', #7,'1','2','3','4','5','6','7','8','9','0','1',
#9,'P', #7,'1','2','3','4','5','6','7','8','9','0','1',' ',' ','S',
'M','T','W','T','F','S',' ',' ','J','F','M','A','M','J','J','A','S',
'O','N','D',#24,#24, #9,#17,'°',#25, #9,#15,'E','S','C', #7,'/',#15,
'O','N','D',#24,#24, #9,#17,'°',#25, #8,#15,'E','S','C', #7,'/',#15,
'Q','u','i','t',#25, #4,'A','R','R','O','W','S', #7,'/',#15,'S','e',
'l','e','c','t',#25, #4,'E','N','T','E','R', #7,'/',#15,'S','n','o',
'o','p',#25, #4,'S','P','A','C','E', #7,'/',#15,'L','o','c','a','l',
#25, #8, #9,'°',#24);
'l','e','c','t',#25, #4,'E','N','T','E','R', #7,'/',#15,'S','e','l',
'e','c','t',#25, #3,'S','P','A','C','E', #7,'/',#15,'T','e','r','m',
'i','n','a','l',#25, #6, #9,'°',#24);
Begin
Screen.LoadScreenImage(ImageData, ImageData_Length, ImageData_Width, 1, 1);
End;