Unit bbs_cfg_Archive; {$I M_OPS.PAS} Interface Procedure Configuration_ArchiveEditor; Implementation Uses m_FileIO, m_Strings, bbs_Common, bbs_Ansi_MenuBox, bbs_Ansi_MenuForm, bbs_cfg_Common; 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 Box : TAnsiMenuBox; List : TAnsiMenuList; F : TBufFile; Arc : RecArchive; Copied : RecArchive; HasCopy : Boolean = False; 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 '; 2 : OS := 'OSX '; 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; List.LoChars := #13#27#47; List.SearchY := 20; Box.Open (13, 5, 67, 20); WriteXY (15, 7, 112, 'Use Ext OSID Description'); WriteXY (15, 8, 112, strRep('Ä', 51)); WriteXY (15, 18, 112, strRep('Ä', 51)); WriteXY (29, 19, 112, cfgCommandList); Repeat MakeList; List.Open (13, 8, 67, 18); List.Close; Case List.ExitCode of '/' : Case GetCommandOption(10, 'I-Insert|D-Delete|C-Copy|P-Paste|') of '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); 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); MakeList; End; 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.