public static bool Init() { try { logFilePath = SysUtil.GetTempPath("ShakeSocketController.log"); #if DEBUG _fs = new FileStream(logFilePath, FileMode.Create); #else _fs = new FileStream(LogFilePath, FileMode.Append); #endif _sw = new StreamWriterWithTimestamp(_fs); _sw.AutoFlush = true; Console.SetOut(_sw); #if !DEBUG Console.SetError(_sw); #endif return(true); } catch (IOException e) { Console.WriteLine(e.ToString()); return(false); } }