mysticbbs/mystic/bbs_cfg_archive.pas

165 lines
4.1 KiB
ObjectPascal
Raw Normal View History

2012-02-13 16:50:48 -08:00
Unit bbs_cfg_Archive;
{$I M_OPS.PAS}
Interface
Procedure Configuration_ArchiveEditor;
Implementation
Uses
m_FileIO,
m_Strings,
bbs_Common,
bbs_Ansi_MenuBox,
2012-02-15 21:26:55 -08:00
bbs_Ansi_MenuForm,
bbs_cfg_Common;
2012-02-13 16:50:48 -08:00
Procedure EditArchive (Var Arc: RecArchive);
Var
Box : TAnsiMenuBox;
Form : TAnsiMenuForm;
Topic : String;
Begin
Topic := '';
Box := TAnsiMenuBox.Create;
Form := TAnsiMenuForm.Create;
Box.Header := ' Archive Editor: ' + Arc.Desc + ' ';
Box.Open (13, 5, 67, 15);
Form.HelpSize := 0;
VerticalLine (28, 7, 13);
Form.AddBol ('A', ' Active ' , 20, 7, 30, 7, 8, 3, @Arc.Active, '');
Form.AddStr ('X', ' Extension ' , 17, 8, 30, 8, 11, 4, 4, @Arc.Ext, '');
Form.AddTog ('O', ' OS ' , 24, 9, 30, 9, 4, 7, 0, 2, 'Windows Linux OSX', @Arc.OSType, '');
Form.AddStr ('D', ' Description ' , 15, 10, 30, 10, 13, 30, 30, @Arc.Desc, '');
Form.AddStr ('P', ' Pack Cmd ' , 18, 11, 30, 11, 10, 35, 80, @Arc.Pack, '');
Form.AddStr ('U', ' Unpack Cmd ' , 16, 12, 30, 12, 12, 35, 80, @Arc.Unpack, '');
Form.AddStr ('V', ' View Cmd ' , 18, 13, 30, 13, 10, 35, 80, @Arc.View, '');
Form.Execute;
Box.Close;
Form.Free;
Box.Free;
End;
Procedure Configuration_ArchiveEditor;
Var
2012-02-24 08:47:28 -08:00
Box : TAnsiMenuBox;
List : TAnsiMenuList;
F : TBufFile;
Arc : RecArchive;
Copied : RecArchive;
HasCopy : Boolean = False;
2012-02-13 16:50:48 -08:00
Procedure MakeList;
Var
OS : String;
Begin
List.Clear;
F.Reset;
While Not F.Eof Do Begin
F.Read (Arc);
Case Arc.OSType of
0 : OS := 'Windows';
1 : OS := 'Linux ';
2012-02-15 21:57:04 -08:00
2 : OS := 'OSX ';
2012-02-13 16:50:48 -08:00
End;
List.Add (strPadR(YesNoStr[Arc.Active], 5, ' ') + strPadR(Arc.Ext, 7, ' ') + OS + ' ' + Arc.Desc, 0);
End;
List.Add ('', 2);
End;
Begin
F := TBufFile.Create(SizeOf(RecArchive));
F.Open (Config.DataPath + 'archive.dat', fmOpenCreate, fmReadWrite + fmDenyNone, SizeOf(RecArchive));
Box := TAnsiMenuBox.Create;
List := TAnsiMenuList.Create;
Box.Header := ' Archive Editor ';
List.NoWindow := True;
2012-02-15 21:26:55 -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-15 21:26:55 -08:00
WriteXY (15, 7, 112, 'Use Ext OSID 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-15 21:26:55 -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-15 21:26:55 -08:00
'I' : Begin
F.RecordInsert (List.Picked);
Arc.OSType := OSType;
Arc.Active := False;
Arc.Desc := 'New archive';
Arc.Ext := 'NEW';
Arc.Pack := '';
Arc.Unpack := '';
Arc.View := '';
F.Write (Arc);
MakeList;
End;
'D' : If ShowMsgBox(1, 'Delete this entry?') Then Begin
F.RecordDelete (List.Picked);
2012-02-24 08:47:28 -08:00
MakeList;
End;
'C' : If List.Picked <> List.ListMax Then Begin
F.Seek (List.Picked - 1);
F.Read (Copied);
HasCopy := True;
End;
'P' : If HasCopy Then Begin
F.RecordInsert (List.Picked);
F.Write (Copied);
2012-02-15 21:26:55 -08:00
MakeList;
End;
2012-02-13 16:50:48 -08:00
End;
#13 : If List.Picked <> List.ListMax Then Begin
F.Seek (List.Picked - 1);
F.Read (Arc);
EditArchive(Arc);
F.Seek (List.Picked - 1);
F.Write (Arc);
End;
#27 : Break;
End;
Until False;
F.Close;
F.Free;
Box.Close;
List.Free;
Box.Free;
End;
End.