This commit is contained in:
mysticbbs 2013-04-06 23:58:33 -04:00
parent 709d049d03
commit e13a0cf040
6 changed files with 46 additions and 24 deletions

View File

@ -4,6 +4,9 @@ Unit m_DateTime;
Interface Interface
Uses
DOS;
Const Const
DayString : Array[0..6] of String[3] = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); 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'); 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 TimerUp (Secs: LongInt) : Boolean;
Function CurDateDos : LongInt; Function CurDateDos : LongInt;
Function CurDateJulian : LongInt; Function CurDateJulian : LongInt;
Function CurDateDT : DateTime;
Function DateDos2Str (Date: LongInt; Format: Byte) : String; Function DateDos2Str (Date: LongInt; Format: Byte) : String;
Function DateJulian2Str (Date: LongInt; Format: Byte) : String; Function DateJulian2Str (Date: LongInt; Format: Byte) : String;
Function DateStr2Dos (Str: String) : LongInt; Function DateStr2Dos (Str: String) : LongInt;
@ -36,7 +40,6 @@ Uses
{$IFDEF UNIX} {$IFDEF UNIX}
BaseUnix, BaseUnix,
{$ENDIF} {$ENDIF}
DOS,
m_Strings; m_Strings;
Const Const
@ -141,6 +144,14 @@ Begin
DateG2J(Date.Year, Date.Month, Date.Day, Result); DateG2J(Date.Year, Date.Month, Date.Day, Result);
End; 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; Function TimerSeconds : LongInt;
Var Var
Hour, Hour,

View File

@ -43,6 +43,7 @@ Function FileRename (OldFN, NewFN: String) : Boolean;
Function FileCopy (Source, Target: String) : Boolean; Function FileCopy (Source, Target: String) : Boolean;
Function FileFind (FN: String) : String; Function FileFind (FN: String) : String;
Function FileByteSize (FN: String) : Int64; Function FileByteSize (FN: String) : Int64;
Function FileNewExt (FN, NewExt: String) : String;
{ GLOBAL FILEIO VARIABLES AND CONSTANTS } { GLOBAL FILEIO VARIABLES AND CONSTANTS }
@ -170,7 +171,7 @@ Begin
ioCode := 5; ioCode := 5;
While (Count < ioRetries) and (ioCode = 5) Do Begin While (Count < ioRetries) and (ioCode = 5) Do Begin
Seek (F, FPos); {$I-} Seek (F, FPos); {$I+}
ioCode := IoResult; ioCode := IoResult;
Inc (Count); Inc (Count);
If ioCode = 5 Then WaitMS(ioWaitTime); If ioCode = 5 Then WaitMS(ioWaitTime);
@ -221,7 +222,7 @@ Begin
ioCode := 5; ioCode := 5;
While (Count < ioRetries) and (ioCode = 5) Do Begin While (Count < ioRetries) and (ioCode = 5) Do Begin
BlockRead (F, Rec, 1); {$I-} BlockRead (F, Rec, 1); {$I+}
ioCode := IoResult; ioCode := IoResult;
Inc (Count); Inc (Count);
If ioCode = 5 Then WaitMS(ioWaitTime); If ioCode = 5 Then WaitMS(ioWaitTime);
@ -833,4 +834,17 @@ Begin
FindClose (DirInfo); FindClose (DirInfo);
End; 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. End.

View File

@ -169,34 +169,25 @@ End;
Procedure TOutputWindows.ClearEOL; Procedure TOutputWindows.ClearEOL;
Var Var
Buf : Array[1..80] of TCharInfo; Buf : Array[1..80] of TCharInfo;
Count : Byte; Count : Byte;
BufSize : TCoord; Res : LongInt;
BufCoord : TCoord;
Region : TSmallRect;
Begin Begin
If Window.Right = Cursor.X Then Exit;
Count := 0; Count := 0;
While Count <= Window.Right - Cursor.X Do Begin While Count <= Window.Right - Cursor.X Do Begin
Inc (Count); Inc (Count);
Buf[Count].Attributes := TextAttr; Buf[Count].Attributes := TextAttr;
Buf[Count].UnicodeChar := ' '; Buf[Count].UnicodeChar := ' ';
End; End;
Move(Buf[1], Buffer[Cursor.Y + 1][Cursor.X + 1], SizeOf(TCharInfo) * Count); Move(Buf[1], Buffer[Cursor.Y + 1][Cursor.X + 1], SizeOf(TCharInfo) * Count);
If Active Then Begin If Active Then
BufSize.X := Count; FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
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;
End; End;
Procedure TOutputWindows.ClearScreenNoUpdate; Procedure TOutputWindows.ClearScreenNoUpdate;
@ -264,6 +255,7 @@ Begin
While Count <= Length(Text) Do Begin While Count <= Length(Text) Do Begin
Buf[Count].Attributes := A; Buf[Count].Attributes := A;
Buf[Count].UnicodeChar := Text[Count]; Buf[Count].UnicodeChar := Text[Count];
Inc (Count); Inc (Count);
End; End;

View File

@ -20,6 +20,7 @@ Type
TProtocolQueueRec = Record TProtocolQueueRec = Record
FilePath : String[QueueMaxPathSize]; FilePath : String[QueueMaxPathSize];
FileName : String[QueueMaxNameSize]; FileName : String[QueueMaxNameSize];
FileNew : String[QueueMaxNameSize];
FileSize : Int64; FileSize : Int64;
Status : Byte; Status : Byte;
End; End;
@ -33,7 +34,7 @@ Type
Constructor Create; Constructor Create;
Destructor Destroy; Override; Destructor Destroy; Override;
Function Add (fPath, fName: String) : Boolean; Function Add (fPath, fName, fNew: String) : Boolean;
Procedure Delete (Idx: Word); Procedure Delete (Idx: Word);
Procedure Clear; Procedure Clear;
Function Next : Boolean; Function Next : Boolean;
@ -55,7 +56,7 @@ Begin
Clear; Clear;
End; End;
Function TProtocolQueue.Add (fPath, fName: String) : Boolean; Function TProtocolQueue.Add (fPath, fName, fNew: String) : Boolean;
Var Var
F : File; F : File;
Begin Begin
@ -69,8 +70,12 @@ Begin
QData[QSize]^.FilePath := fPath; QData[QSize]^.FilePath := fPath;
QData[QSize]^.FileName := fName; QData[QSize]^.FileName := fName;
QData[QSize]^.FileNew := fNew;
QData[Qsize]^.FileSize := 0; QData[Qsize]^.FileSize := 0;
If fNew = '' Then
QData[QSize]^.FileNew := fName;
Assign (F, fPath + fName); Assign (F, fPath + fName);
{$I-} Reset(F, 1); {$I+} {$I-} Reset(F, 1); {$I+}

View File

@ -1481,7 +1481,7 @@ Begin
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> File:' + FName); {$ENDIF} {$IFDEF ZDEBUG} ZLog('ZRecvFile -> File:' + FName); {$ENDIF}
{$IFDEF ZDEBUG} ZLog('ZRecvFile -> Size:' + strI2S(FSize)); {$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]^.FileSize := FSize;
Queue.QData[Queue.QSize]^.Status := QueueIntransit; Queue.QData[Queue.QSize]^.Status := QueueIntransit;

View File

@ -98,7 +98,7 @@ Begin
If ServerStatus.Count > MaxStatusText Then If ServerStatus.Count > MaxStatusText Then
ServerStatus.Delete(0); 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 If Length(Res) > 74 Then Begin
ServerStatus.Add(Copy(Res, 1, 74)); ServerStatus.Add(Copy(Res, 1, 74));