12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Text;
- namespace MAutoUpdate
- {
- public static class LogTool
- {
- static string temp = AppDomain.CurrentDomain.BaseDirectory + "/logs";
- public static void AddLog(String value)
- {
- try
- {
- Debug.WriteLine(value);
- if (Directory.Exists(Path.Combine(temp, @"update\")) == false)
- {
- DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(temp, @"update\"));
- directoryInfo.Create();
- }
- using (StreamWriter sw = File.AppendText(Path.Combine(temp, @"update\update.log")))
- {
- sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- sw.WriteLine(value);
- sw.WriteLine();
- }
- }
- catch
- {
- }
- }
- }
- }
|