using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace UAS_DXFORM { class LogManager { public static string LogAddress = SystemInf.LogFolder; /// /// 记录操作 /// /// public static void DoLog(string Message) { try { StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt"); sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n"); sw.WriteLine("【消息】" + Message + "\n"); sw.WriteLine("---------------------------------------------------------------------------------------------------------------"); sw.Close(); } catch (Exception) { } } /// /// 记录操作 /// /// public static void DoLog(List Message,string info) { try { StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt"); sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n"); sw.WriteLine("【消息】" + info + "\n"); foreach (string mes in Message) { sw.WriteLine(mes + "\n"); } //int T = Message.Count; //for (int i = 0; i < T; i++) //{ // sw.WriteLine(Message[i].ToString() + "\n"); //} sw.WriteLine("---------------------------------------------------------------------------------------------------------------"); sw.Close(); } catch (Exception) { } } } }