Explorar o código

现有log输出,无法区分是哪个串口的。

sat23 %!s(int64=3) %!d(string=hai) anos
pai
achega
94f8bfbf8e
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      SCBC Factory Tools/LogHelper/Writelog.cs

+ 5 - 1
SCBC Factory Tools/LogHelper/Writelog.cs

@@ -61,7 +61,11 @@ namespace SXLibrary
 
                     Monitor.Enter(FileLock);
 
-                    string _path = FilePath + msg.Substring(0, 5).Trim() + "\\" + DateTime.Now.ToString("yyyy-MM");
+                    string _path;
+                    if ( msg.StartsWith("COM") )
+                        _path = FilePath + msg.Substring(0, 10).Trim() + "\\" + DateTime.Now.ToString("yyyy-MM");
+                    else
+                        _path = FilePath + msg.Substring(0, 5).Trim() + "\\" + DateTime.Now.ToString("yyyy-MM");
 
                     if (!Directory.Exists(_path))
                     {