From 8330cf8550186d155216692f9da12026c320d917 Mon Sep 17 00:00:00 2001 From: hank <hank@7fafa455-2d8e-8247-9248-17d0fe17a33f> Date: Mon, 24 Aug 2015 11:03:19 +0800 Subject: [PATCH] CT-1 蘇迪勒颱風:雲林CCSTRACE颱風期間掛點問 --- CCSTrace/CCS/CCSMain.cs | 19 ++++++++++++++++--- CCSTrace/CCS/RecordLog.cs | 5 ++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CCSTrace/CCS/CCSMain.cs b/CCSTrace/CCS/CCSMain.cs index aeefa73..fe5162b 100644 --- a/CCSTrace/CCS/CCSMain.cs +++ b/CCSTrace/CCS/CCSMain.cs @@ -415,11 +415,24 @@ return _Record; } - RecordLog _PLog = new RecordLog(CCS.LocalVariable.CCS_ListPath + "MAIN.txt"); private void Log(String message) { - _PLog.Error(message); - _PLog.Close(); + RecordLog _PLog = null; + try + { + _PLog = new RecordLog(CCS.LocalVariable.CCS_ListPath + "MAIN.txt"); + _PLog.Error(message); + } + catch + { + } + finally + { + if (_PLog != null) + { + _PLog.Close(); + } + } } } diff --git a/CCSTrace/CCS/RecordLog.cs b/CCSTrace/CCS/RecordLog.cs index d8d47da..e528624 100644 --- a/CCSTrace/CCS/RecordLog.cs +++ b/CCSTrace/CCS/RecordLog.cs @@ -10,9 +10,9 @@ namespace CCSTrace.CCS { - public class RecordLog + public class RecordLog { - private System.IO.StreamWriter _SWriter; + private System.IO.StreamWriter _SWriter = null; public RecordLog(String FilePath) { @@ -48,6 +48,5 @@ { _SWriter.Close(); } - } } -- Gitblit v0.0.0-SNAPSHOT