A30
This commit is contained in:
parent
709d049d03
commit
e13a0cf040
|
@ -4,6 +4,9 @@ Unit m_DateTime;
|
|||
|
||||
Interface
|
||||
|
||||
Uses
|
||||
DOS;
|
||||
|
||||
Const
|
||||
DayString : Array[0..6] of String[3] = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
||||
MonthString : Array[1..12] of String[3] = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||
|
@ -15,6 +18,7 @@ Function TimerSet (Secs: LongInt) : LongInt;
|
|||
Function TimerUp (Secs: LongInt) : Boolean;
|
||||
Function CurDateDos : LongInt;
|
||||
Function CurDateJulian : LongInt;
|
||||
Function CurDateDT : DateTime;
|
||||
Function DateDos2Str (Date: LongInt; Format: Byte) : String;
|
||||
Function DateJulian2Str (Date: LongInt; Format: Byte) : String;
|
||||
Function DateStr2Dos (Str: String) : LongInt;
|
||||
|
@ -36,7 +40,6 @@ Uses
|
|||
{$IFDEF UNIX}
|
||||
BaseUnix,
|
||||
{$ENDIF}
|
||||
DOS,
|
||||
m_Strings;
|
||||
|
||||
Const
|
||||
|
@ -141,6 +144,14 @@ Begin
|
|||
DateG2J(Date.Year, Date.Month, Date.Day, Result);
|
||||
End;
|
||||
|
||||
Function CurDateDT : DateTime;
|
||||
Var
|
||||
Temp : Word;
|
||||
Begin
|
||||
GetDate (Result.Year, Result.Month, Result.Day, Temp);
|
||||
GetTime (Result.Hour, Result.Min, Result.Sec, Temp);
|
||||
End;
|
||||
|
||||
Function TimerSeconds : LongInt;
|
||||
Var
|
||||
Hour,
|
||||
|
|
|
@ -43,6 +43,7 @@ Function FileRename (OldFN, NewFN: String) : Boolean;
|
|||
Function FileCopy (Source, Target: String) : Boolean;
|
||||
Function FileFind (FN: String) : String;
|
||||
Function FileByteSize (FN: String) : Int64;
|
||||
Function FileNewExt (FN, NewExt: String) : String;
|
||||
|
||||
{ GLOBAL FILEIO VARIABLES AND CONSTANTS }
|
||||
|
||||
|
@ -170,7 +171,7 @@ Begin
|
|||
ioCode := 5;
|
||||
|
||||
While (Count < ioRetries) and (ioCode = 5) Do Begin
|
||||
Seek (F, FPos);
|
||||
{$I-} Seek (F, FPos); {$I+}
|
||||
ioCode := IoResult;
|
||||
Inc (Count);
|
||||
If ioCode = 5 Then WaitMS(ioWaitTime);
|
||||
|
@ -221,7 +222,7 @@ Begin
|
|||
ioCode := 5;
|
||||
|
||||
While (Count < ioRetries) and (ioCode = 5) Do Begin
|
||||
BlockRead (F, Rec, 1);
|
||||
{$I-} BlockRead (F, Rec, 1); {$I+}
|
||||
ioCode := IoResult;
|
||||
Inc (Count);
|
||||
If ioCode = 5 Then WaitMS(ioWaitTime);
|
||||
|
@ -833,4 +834,17 @@ Begin
|
|||
FindClose (DirInfo);
|
||||
End;
|
||||
|
||||
Function FileNewExt (FN, NewExt: String) : String;
|
||||
Var
|
||||
Temp : Byte;
|
||||
Begin
|
||||
For Temp := Length(FN) DownTo 1 Do
|
||||
If FN[Temp] = '.' Then Begin
|
||||
Result := Copy(FN, 1, Temp) + NewExt;
|
||||
Exit;
|
||||
End;
|
||||
|
||||
Result := FN + '.' + NewExt;
|
||||
End;
|
||||
|
||||
End.
|
||||
|
|
|
@ -169,34 +169,25 @@ End;
|
|||
|
||||
Procedure TOutputWindows.ClearEOL;
|
||||
Var
|
||||
Buf : Array[1..80] of TCharInfo;
|
||||
Count : Byte;
|
||||
BufSize : TCoord;
|
||||
BufCoord : TCoord;
|
||||
Region : TSmallRect;
|
||||
Buf : Array[1..80] of TCharInfo;
|
||||
Count : Byte;
|
||||
Res : LongInt;
|
||||
Begin
|
||||
If Window.Right = Cursor.X Then Exit;
|
||||
|
||||
Count := 0;
|
||||
|
||||
While Count <= Window.Right - Cursor.X Do Begin
|
||||
Inc (Count);
|
||||
|
||||
Buf[Count].Attributes := TextAttr;
|
||||
Buf[Count].UnicodeChar := ' ';
|
||||
End;
|
||||
|
||||
Move(Buf[1], Buffer[Cursor.Y + 1][Cursor.X + 1], SizeOf(TCharInfo) * Count);
|
||||
|
||||
If Active Then Begin
|
||||
BufSize.X := Count;
|
||||
BufSize.Y := 1;
|
||||
BufCoord.X := 0;
|
||||
BufCoord.Y := 0;
|
||||
Region.Left := Cursor.X;
|
||||
Region.Top := Cursor.Y;
|
||||
Region.Right := Cursor.X + Count - 1;
|
||||
Region.Bottom := Cursor.Y;
|
||||
|
||||
WriteConsoleOutput(ConOut, @Buf, BufSize, BufCoord, Region);
|
||||
End;
|
||||
If Active Then
|
||||
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
|
||||
End;
|
||||
|
||||
Procedure TOutputWindows.ClearScreenNoUpdate;
|
||||
|
@ -264,6 +255,7 @@ Begin
|
|||
While Count <= Length(Text) Do Begin
|
||||
Buf[Count].Attributes := A;
|
||||
Buf[Count].UnicodeChar := Text[Count];
|
||||
|
||||
Inc (Count);
|
||||
End;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ Type
|
|||
TProtocolQueueRec = Record
|
||||
FilePath : String[QueueMaxPathSize];
|
||||
FileName : String[QueueMaxNameSize];
|
||||
FileNew : String[QueueMaxNameSize];
|
||||
FileSize : Int64;
|
||||
Status : Byte;
|
||||
End;
|
||||
|
@ -33,7 +34,7 @@ Type
|
|||
Constructor Create;
|
||||
Destructor Destroy; Override;
|
||||
|
||||
Function Add (fPath, fName: String) : Boolean;
|
||||
Function Add (fPath, fName, fNew: String) : Boolean;
|
||||
Procedure Delete (Idx: Word);
|
||||
Procedure Clear;
|
||||
Function Next : Boolean;
|
||||
|
@ -55,7 +56,7 @@ Begin
|
|||
Clear;
|
||||
End;
|
||||
|
||||
Function TProtocolQueue.Add (fPath, fName: String) : Boolean;
|
||||
Function TProtocolQueue.Add (fPath, fName, fNew: String) : Boolean;
|
||||
Var
|
||||
F : File;
|
||||
Begin
|
||||
|
@ -69,8 +70,12 @@ Begin
|
|||
|
||||
QData[QSize]^.FilePath := fPath;
|
||||
QData[QSize]^.FileName := fName;
|
||||
QData[QSize]^.FileNew := fNew;
|
||||
QData[Qsize]^.FileSize := 0;
|
||||
|
||||
If fNew = '' Then
|
||||
QData[QSize]^.FileNew := fName;
|
||||
|
||||
Assign (F, fPath + fName);
|
||||
|
||||
{$I-} Reset(F, 1); {$I+}
|
||||
|
|
|
@ -1481,7 +1481,7 @@ Begin
|
|||
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> File:' + FName); {$ENDIF}
|
||||
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> Size:' + strI2S(FSize)); {$ENDIF}
|
||||
|
||||
Queue.Add(ReceivePath, FName);
|
||||
Queue.Add(ReceivePath, FName, '');
|
||||
|
||||
Queue.QData[Queue.QSize]^.FileSize := FSize;
|
||||
Queue.QData[Queue.QSize]^.Status := QueueIntransit;
|
||||
|
|
|
@ -98,7 +98,7 @@ Begin
|
|||
If ServerStatus.Count > MaxStatusText Then
|
||||
ServerStatus.Delete(0);
|
||||
|
||||
Res := '(' + Copy(DateDos2Str(CurDateDos, 1), 1, 5) + ' ' + TimeDos2Str(CurDateDos, False) + ') ' + Str;
|
||||
Res := '(' + Copy(DateDos2Str(CurDateDos, 1), 1, 5) + ' ' + TimeDos2Str(CurDateDos, 0) + ') ' + Str;
|
||||
|
||||
If Length(Res) > 74 Then Begin
|
||||
ServerStatus.Add(Copy(Res, 1, 74));
|
||||
|
|
Loading…
Reference in New Issue