Initial import of new utility
This commit is contained in:
parent
4e59c0619f
commit
f0c72d25ea
|
@ -0,0 +1,153 @@
|
|||
Program MUTIL;
|
||||
|
||||
// ====================================================================
|
||||
// Mystic BBS Software Copyright 1997-2012 By James Coyle
|
||||
// ====================================================================
|
||||
//
|
||||
// This file is part of Mystic BBS.
|
||||
//
|
||||
// Mystic BBS is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Mystic BBS is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mystic BBS. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
{$I M_OPS.PAS}
|
||||
|
||||
// MBBSUTIL replacement WIP
|
||||
//
|
||||
// Eventually all of MBBSUTIL stuff will be incorporated into this program.
|
||||
// MBBSUTIL and MYSTPACK will be phased out in favor of this program.
|
||||
//
|
||||
// The goal of this program is to have basically everything under the sun
|
||||
// all in one utility. Eventually it may even have a full blown FIDO-style
|
||||
// tosser too. TOP 10 generators, etc. It's all planned for MUTIL.
|
||||
|
||||
Uses
|
||||
INIFiles,
|
||||
m_Output,
|
||||
m_DateTime,
|
||||
m_Strings,
|
||||
m_FileIO,
|
||||
mutil_Common,
|
||||
mutil_Status,
|
||||
mutil_ImportNA;
|
||||
|
||||
{$I MUTIL_ANSI.PAS}
|
||||
|
||||
Function CheckProcess (pName: String) : Boolean;
|
||||
Begin
|
||||
Result := False;
|
||||
|
||||
If strUpper(INI.ReadString(Header_General, pName, 'FALSE')) = 'TRUE' Then Begin
|
||||
Result := True;
|
||||
|
||||
Inc (ProcessTotal);
|
||||
End;
|
||||
End;
|
||||
|
||||
Procedure ApplicationShutdown;
|
||||
Begin
|
||||
If Assigned(Console) Then Begin
|
||||
Console.SetWindow (1, 1, 80, 25, False);
|
||||
Console.CursorXY (3, 22);
|
||||
|
||||
Console.TextAttr := 15;
|
||||
Console.WriteLine('> Execution complete');
|
||||
Console.TextAttr := 7;
|
||||
End;
|
||||
|
||||
BarOne.Free;
|
||||
BarAll.Free;
|
||||
INI.Free;
|
||||
Console.Free;
|
||||
End;
|
||||
|
||||
Procedure ApplicationStartup;
|
||||
Var
|
||||
FN : String;
|
||||
CF : File of RecConfig;
|
||||
Begin
|
||||
ExitProc := @ApplicationShutdown;
|
||||
Console := TOutput.Create(True);
|
||||
|
||||
DrawStatusScreen;
|
||||
|
||||
Console.SetWindow(5, 14, 76, 21, True);
|
||||
|
||||
If FileExist(ParamStr(1)) Then
|
||||
FN := ParamStr(1)
|
||||
Else
|
||||
If FileExist('mutil.cfg') Then
|
||||
FN := 'mutil.cfg'
|
||||
Else Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('Missing file');
|
||||
ProcessResult (rFATAL, True);
|
||||
|
||||
Halt(1);
|
||||
End;
|
||||
|
||||
INI := TINIFile.Create(FN);
|
||||
|
||||
Console.WriteXY (26, 10, 8, FN);
|
||||
|
||||
Assign (CF, INI.ReadString(Header_GENERAL, 'mystic_directory', 'mystic.dat'));
|
||||
|
||||
{$I-} Reset(CF); {$I+}
|
||||
|
||||
If IoResult <> 0 Then Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('Missing MYSTIC.DAT');
|
||||
ProcessResult (rFATAL, True);
|
||||
|
||||
Halt(1);
|
||||
End;
|
||||
|
||||
Read (CF, bbsConfig);
|
||||
Close (CF);
|
||||
|
||||
If bbsConfig.DataChanged <> mysDataChanged Then Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('Version mismatch');
|
||||
ProcessResult (rFATAL, True);
|
||||
|
||||
Halt(1);
|
||||
End;
|
||||
|
||||
BarOne := TStatusBar.Create(3);
|
||||
BarAll := TStatusBar.Create(6);
|
||||
End;
|
||||
|
||||
Var
|
||||
DoImportNA : Boolean;
|
||||
Begin
|
||||
ApplicationStartup;
|
||||
|
||||
// Build process list
|
||||
|
||||
DoImportNA := CheckProcess(Header_IMPORTNA);
|
||||
|
||||
// Exit with an error if nothing is configured
|
||||
|
||||
If ProcessTotal = 0 Then Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('No processes are configured!');
|
||||
ProcessResult (rFATAL, True);
|
||||
|
||||
Halt(1);
|
||||
End;
|
||||
|
||||
// We're good lets execute this stuff!
|
||||
|
||||
If DoImportNA Then uImportNA;
|
||||
End.
|
|
@ -0,0 +1,23 @@
|
|||
[?7h[40m[2J[0;34mÜÜ[11C[1;30mÜÜ [0m°[30;47m˛[2C[1;40mÜ[8CÜ[12C˛ÜÜ[17Cܲ °ą˛ÜÜÜ °Ü
|
||||
[34;44mŢ[40mŰ[44mÜ[0;34mÜ[5C[1;30mţ ß Ý [0;34m°°[1m°[44mŢ[1C[30;40m˛ßßßßßßßßß ßßßßßßßßßßß ßßßßßßßßßßßßßßßßßß[7Cßßßß۲
|
||||
[34m°Ű[36mŰŰ[34;44mÜ[0;34mÜ[6C[1;30mÜß[0;34mÜ[1;44mÜŰŰŰŢ[30;40m°Ý[51C% °ą
|
||||
[36;47mß[1C[34;40m˛ŰŰŰŰ[44mÜ[0;34mÜ[1;30mßŰ[47m˛[40mß[0;34mÜ[1;44mŰŰ[36;40mŰ[34;44mŰŰ[40m˛[44mŢ[57C[30;40m˛
|
||||
[47m˛[1C[34;40mą[44m˛˛˛[40mŰß[44mßŰ[40mÜÜ[44mŰß[40mß[44m۲˛˛[40mą[0;34mŢ[1;30m°ţúÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Äú °˛Ű
|
||||
ß [0;34mŰ[1;44m°°°[0;34mŰ ß[1;44mßß[0;34mß Ű[1;44m°°°[0;34mŰ[54C[1;30m% °˛
|
||||
[0;34m°°˛ŰŰŰŰ [1;30;44m˛[40mÜÜÜܲ [0;34mŰŰŰŰŰ [1;30mąÝ[55C˛
|
||||
ÜÜţ [0;34mß߲ [1;30mą °°˛ÜÜÜÜÜÜܲÜÜÜÜÜÜÜÜÜÜܲ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜÜ Ü ÜÜÜÜÜÜÜ Ü˛Ű
|
||||
[8C° m[0mUTIL v[5C[1;30mÜß[11Cß[17Cßß[9C° ß[10C°
|
||||
[0;34m°[15C[1;30mß ÜÜß
|
||||
|
||||
Ţ [37mProcess [30mÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Ä [37mStatus [30mÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ [37mResult [30mÄÄÄÄú
|
||||
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄłÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄłÄÄÄÄÄÄÄÄÄÄÄÄż
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ŔÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄŮ
|
||||
|
||||
[0m[255D
|
|
@ -0,0 +1,39 @@
|
|||
Procedure DrawStatusScreen;
|
||||
Const
|
||||
IMAGEDATA_WIDTH=80;
|
||||
IMAGEDATA_DEPTH=23;
|
||||
IMAGEDATA_LENGTH=475;
|
||||
IMAGEDATA : array [1..475] of Char = (
|
||||
#1,#16,'Ü','Ü',#25,#10, #8,'Ü','Ü',#25, #3, #7,'°', #0,#23,'²',#16,
|
||||
' ',' ', #8,'Ü',#25, #7,'Ü',#25,#11,'²','Ü','Ü',#25,#16,'Ü','²',' ',
|
||||
'°','±','²','Ü','Ü','Ü',#25, #2,'°','Ü',#24,' ', #9,#17,'Þ',#16,'Û',
|
||||
#17,'Ü', #1,#16,'Ü',#25, #4, #8,'þ',' ','ß',' ',' ','Ý',' ', #1,'°',
|
||||
'°', #9,'°',#17,'Þ',#16,' ', #8,'²',#26, #8,'ß',' ',#26,#10,'ß',#25,
|
||||
#3,#26,#17,'ß',#25, #6,#26, #3,'ß','Û','²',#24,' ', #9,'°','Û',#11,
|
||||
'Û','Û', #9,#17,'Ü', #1,#16,'Ü',#25, #5, #8,'Ü','ß', #1,'Ü', #9,#17,
|
||||
'Ü','Û','Û','Û','Þ', #8,#16,'°','Ý',#25,'2','%',' ',' ','°','±',#24,
|
||||
#11,#23,'ß',#16,' ', #9,'²',#26, #3,'Û',#17,'Ü', #1,#16,'Ü', #8,'ß',
|
||||
'Û',#23,'²',#16,'ß', #1,'Ü', #9,#17,'Û','Û',#11,#16,'Û', #9,#17,'Û',
|
||||
'Û',#16,'²',#17,'Þ',#16,#25,'8', #8,'²',#24,#23,'²',#16,' ', #9,'±',
|
||||
#17,'²','²','²',#16,'Û','ß',#17,'ß','Û',#16,'Ü','Ü',#17,'Û','ß',#16,
|
||||
'ß',#17,'Û','²','²','²',#16,'±', #1,'Þ', #8,'°','þ','ú',#26,',','Ä',
|
||||
' ','Ä','ú',#25, #3,'°','²','Û',#24,'ß',' ', #1,'Û', #9,#17,'°','°',
|
||||
'°', #1,#16,'Û',' ',' ','ß', #9,#17,'ß','ß', #1,#16,'ß',' ',' ','Û',
|
||||
#9,#17,'°','°','°', #1,#16,'Û',#25,'5', #8,'%',' ',' ','°','²',#24,
|
||||
#1,'°','°','²',#26, #3,'Û',' ', #8,#17,'²',#16,#26, #3,'Ü','²',' ',
|
||||
#1,#26, #4,'Û',' ', #8,'±','Ý',#25,'6','²',#24,'Ü','Ü','þ',' ', #1,
|
||||
'ß','ß','²',' ', #8,'±',' ',' ','°','°','²',#26, #6,'Ü','²',#26,#10,
|
||||
'Ü','²',' ',#26,#17,'Ü',' ',' ',#26, #7,'Ü',' ',' ','Ü',' ',' ',#26,
|
||||
#6,'Ü',' ','Ü','²','Û',#24,#25, #7,'°',' ','m', #7,'U','T','I','L',
|
||||
' ','v',#25, #4, #8,'Ü','ß',#25,#10,'ß',#25,#16,'ß','ß',#25, #8,'°',
|
||||
' ',' ','ß',#25, #9,'°',#24,' ',' ', #1,'°',#25,#14, #8,'ß',' ','Ü',
|
||||
'Ü','ß',#24,#24,' ',' ','Þ',' ',#15,'P','r','o','c','e','s','s',' ',
|
||||
#8,#26,#16,'Ä',' ','Ä',' ',#15,'S','t','a','t','u','s',' ', #8,#26,
|
||||
#24,'Ä',' ',#15,'R','e','s','u','l','t',' ', #8,#26, #3,'Ä','ú',#24,
|
||||
' ',' ','Ú',#26,#26,'Ä','³',#26,#31,'Ä','³',#26,#11,'Ä','¿',#24,#24,
|
||||
#24,#24,#24,#24,#24,#24,' ',' ','À',#26,'H','Ä','Ù',#24,#24,#24);
|
||||
|
||||
Begin
|
||||
Console.LoadScreenImage(ImageData, ImageData_Length, ImageData_Width, 1, 1);
|
||||
Console.WriteXY (18, 9, 15, Copy(mysVersion, 1, 4));
|
||||
End;
|
|
@ -0,0 +1,32 @@
|
|||
Unit MUTIL_Common;
|
||||
|
||||
{$I M_OPS.PAS}
|
||||
|
||||
Interface
|
||||
|
||||
Uses
|
||||
INIFiles,
|
||||
m_Output,
|
||||
mutil_Status;
|
||||
|
||||
{$I RECORDS.PAS}
|
||||
|
||||
Var
|
||||
Console : TOutput;
|
||||
INI : TINIFile;
|
||||
BarOne : TStatusBar;
|
||||
BarAll : TStatusBar;
|
||||
ProcessTotal : Byte = 0;
|
||||
ProcessPos : Byte = 0;
|
||||
bbsConfig : RecConfig;
|
||||
|
||||
Const
|
||||
Header_GENERAL = 'General';
|
||||
Header_IMPORTNA = 'Import_FIDONET.NA';
|
||||
|
||||
Implementation
|
||||
|
||||
Uses
|
||||
m_Strings;
|
||||
|
||||
End.
|
|
@ -0,0 +1,62 @@
|
|||
Unit MUTIL_ImportNA;
|
||||
|
||||
{$I M_OPS.PAS}
|
||||
|
||||
Interface
|
||||
|
||||
Procedure uImportNA;
|
||||
|
||||
Implementation
|
||||
|
||||
Uses
|
||||
m_Strings,
|
||||
mutil_Common,
|
||||
mutil_Status;
|
||||
|
||||
Procedure uImportNA;
|
||||
Var
|
||||
CreatedBases : LongInt = 0;
|
||||
InFile : Text;
|
||||
Str : String;
|
||||
Buffer : Array[1..2048] of Byte;
|
||||
TagName : String;
|
||||
BaseName : String;
|
||||
Begin
|
||||
ProcessName ('Import FIDONET.NA', True);
|
||||
ProcessResult (rWORKING, False);
|
||||
|
||||
Assign (InFile, INI.ReadString(Header_IMPORTNA, 'filename', 'fidonet.na'));
|
||||
SetTextBuf (InFile, Buffer);
|
||||
|
||||
{$I-} Reset(InFile); {$I+}
|
||||
|
||||
If IoResult <> 0 Then Begin
|
||||
ProcessStatus ('Cannot find NA file');
|
||||
ProcessResult (rWARN, True);
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
While Not Eof(InFile) Do Begin
|
||||
ReadLn(InFile, Str);
|
||||
|
||||
Str := strStripB(Str, ' ');
|
||||
|
||||
If (Str[1] = ';') or (Str = '') Then Continue;
|
||||
|
||||
TagName := strWordGet(1, Str, ' ');
|
||||
BaseName := strStripB(strWordGet(2, Str, ' '), ' ');
|
||||
|
||||
ProcessStatus (BaseName);
|
||||
End;
|
||||
|
||||
Close (InFile);
|
||||
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)');
|
||||
ProcessResult (rDONE, True);
|
||||
|
||||
BarOne.Update(100, 100);
|
||||
BarAll.Update(ProcessPos, ProcessTotal);
|
||||
End;
|
||||
|
||||
End.
|
|
@ -0,0 +1,101 @@
|
|||
Unit MUTIL_Status;
|
||||
|
||||
{$I M_OPS.PAS}
|
||||
|
||||
Interface
|
||||
|
||||
Type
|
||||
TStatusBar = Class
|
||||
LastPercent : Byte;
|
||||
LinePosition : Byte;
|
||||
|
||||
Constructor Create (LinePos: Byte);
|
||||
Destructor Destroy; Override;
|
||||
|
||||
Procedure Reset;
|
||||
Procedure Update (Part, Whole: LongInt);
|
||||
End;
|
||||
|
||||
TProcessResult = (rDONE, rWARN, rWORKING, rFATAL);
|
||||
|
||||
Procedure ProcessName (Str: String; Start: Boolean);
|
||||
Procedure ProcessStatus (Str: String);
|
||||
Procedure ProcessResult (Res: TProcessResult; Done: Boolean);
|
||||
|
||||
Implementation
|
||||
|
||||
Uses
|
||||
m_Strings,
|
||||
mutil_Common;
|
||||
|
||||
Procedure ProcessName (Str: String; Start: Boolean);
|
||||
Begin
|
||||
Console.WriteXYPipe (5, Console.CursorY, 7, 26, Str);
|
||||
|
||||
If Start Then Inc (ProcessPos);
|
||||
End;
|
||||
|
||||
Procedure ProcessStatus (Str: String);
|
||||
Begin
|
||||
Console.WriteXYPipe (33, Console.CursorY, 7, 31, Str);
|
||||
End;
|
||||
|
||||
Procedure ProcessResult (Res: TProcessResult; Done: Boolean);
|
||||
Begin
|
||||
Case Res of
|
||||
rDONE : Console.WriteXYPipe(66, Console.CursorY, 10, 11, 'DONE');
|
||||
rWARN : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'WARNING');
|
||||
rWORKING : Console.WriteXYPipe(66, Console.CursorY, 15, 11, 'WORKING');
|
||||
rFATAL : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'FATAL');
|
||||
End;
|
||||
|
||||
If Done Then Console.WriteLine('');
|
||||
End;
|
||||
|
||||
Procedure TStatusBar.Reset;
|
||||
Begin
|
||||
Console.WriteXY (24, LinePosition, 8, strRep(#176, 50));
|
||||
Console.WriteXY (24, LinePosition + 1, 8, strRep(#176, 50));
|
||||
|
||||
Console.WriteXY (75, LinePosition + 1, 7, '0 ');
|
||||
|
||||
LastPercent := 0;
|
||||
End;
|
||||
|
||||
Procedure TStatusBar.Update (Part, Whole: LongInt);
|
||||
Var
|
||||
Percent : Byte;
|
||||
PerStr : String;
|
||||
Begin
|
||||
Percent := Round(Part / Whole * 100);
|
||||
|
||||
If Percent <> LastPercent Then Begin
|
||||
LastPercent := Percent;
|
||||
|
||||
If Percent >= 2 Then Begin
|
||||
PerStr := strRep(' ', (Percent DIV 2) - 1) + #222;
|
||||
|
||||
Console.WriteXY (24, LinePosition, 25, PerStr);
|
||||
Console.WriteXY (24, LinePosition + 1, 25, PerStr);
|
||||
End;
|
||||
|
||||
Console.WriteXY (75, LinePosition + 1, 7, strPadR(strI2S(Percent), 3, ' '));
|
||||
End;
|
||||
End;
|
||||
|
||||
Constructor TStatusBar.Create (LinePos: Byte);
|
||||
Begin
|
||||
Inherited Create;
|
||||
|
||||
LinePosition := LinePos;
|
||||
|
||||
Reset;
|
||||
End;
|
||||
|
||||
Destructor TStatusBar.Destroy;
|
||||
Begin
|
||||
Inherited Destroy;
|
||||
End;
|
||||
|
||||
|
||||
End.
|
Loading…
Reference in New Issue