2
0
Эх сурвалжийг харах

[console] coutSL single line

Exilon 4 жил өмнө
parent
commit
9c4abdd6f9
1 өөрчлөгдсөн 20 нэмэгдсэн , 0 устгасан
  1. 20 0
      Quick.Console.pas

+ 20 - 0
Quick.Console.pas

@@ -169,6 +169,7 @@ type
   procedure cout(const cMsg : Double; cEventType : TLogEventType); overload;
   procedure cout(const cMsg : string; cEventType : TLogEventType); overload;
   procedure cout(const cMsg : string; cColor : TConsoleColor); overload;
+  procedure coutSL(const cMsg : string; cColor : TConsoleColor);
   procedure cout(const cMsg : string; params : array of const; cEventType : TLogEventType); overload;
   procedure coutXY(x,y : Integer; const cMsg : string; cEventType : TLogEventType); overload;
   procedure coutXY(x,y : Integer; const cMsg : string; cColor : TConsoleColor); overload;
@@ -327,6 +328,25 @@ begin
   end;
 end;
 
+procedure coutSL(const cMsg : string; cColor : TConsoleColor);
+begin
+  EnterCriticalSection(CSConsole);
+  try
+    {$IFDEF MSWINDOWS}
+      if hStdOut <> 0 then
+    {$ENDIF}
+    begin
+      TextColor(cColor);
+      {$I-}
+      Write(cMsg{$IFDEF LINUX} +#13{$ENDIF});
+      {$I+}
+      TextColor(LastMode);
+    end;
+  finally
+    LeaveCriticalSection(CSConsole);
+  end;
+end;
+
 procedure cout(const cMsg : string; params : array of const; cEventType : TLogEventType);
 begin
   cout(Format(cMsg,params),cEventType);