123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Uninpho.Tools.components
- {
-
-
-
- class LogGeneratorFun
- {
-
-
-
-
-
-
-
-
- public static void WriteLogJT(List<StaticLogClass> logdata ,string sFileName)
- {
- List<string> LogString = new List<string>();
- foreach (var log in logdata)
- {
- LogString.Add(log.Date + "\t" + log.Username + "\t" + log.Row.ToString() + "_" + log.Column.ToString() + "\t" + log.Oldvalue + "\t" + log.Newvalue);
- }
- WriteLog(sFileName, LogString);
- }
-
-
-
-
-
- private static void WriteLog(string path , List<string> LogString)
- {
- FileStream fs;
- StreamWriter sw;
- if (File.Exists(path))
-
- {
- fs = new FileStream(path, FileMode.Append, FileAccess.Write);
- }
- else
- {
- fs = new FileStream(path, FileMode.Create, FileAccess.Write);
- }
- sw = new StreamWriter(fs);
- foreach (var item in LogString)
- {
- sw.WriteLine(item);
- }
- sw.Close();
- fs.Close();
- }
- }
- public class StaticLogClass
- {
- public string Row { get; set; }
- public string Column { get; set; }
- public string Username { get; set; }
- public string Oldvalue { get; set; }
- public string Newvalue { get; set; }
- public string Date { get; set; }
- }
- }
|