178 lines
4.5 KiB
C#
178 lines
4.5 KiB
C#
using System;
|
||
using System.IO;
|
||
using System.Windows.Forms;
|
||
|
||
namespace HxBusiness
|
||
{
|
||
// Token: 0x0200000D RID: 13
|
||
public class WriteTxt
|
||
{
|
||
// Token: 0x06000058 RID: 88 RVA: 0x00002FDC File Offset: 0x000011DC
|
||
public static void SaveLog1(string fileMsg, string filename = "插件日志", string Assembly_name = "插件日志")
|
||
{
|
||
object obj = WriteTxt.obj_saveLog1;
|
||
lock (obj)
|
||
{
|
||
try
|
||
{
|
||
using (FileStream fileStream = new FileStream(WriteTxt.GetFilePath1(filename, Assembly_name), FileMode.Append, FileAccess.Write))
|
||
{
|
||
using (StreamWriter streamWriter = new StreamWriter(fileStream))
|
||
{
|
||
streamWriter.WriteLine(WriteTxt.GetCurrentTimeString() + fileMsg);
|
||
streamWriter.Close();
|
||
fileStream.Close();
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
WriteTxt.SaveLog1(fileMsg, filename, Assembly_name);
|
||
}
|
||
}
|
||
}
|
||
|
||
// Token: 0x06000059 RID: 89 RVA: 0x000030A4 File Offset: 0x000012A4
|
||
public static void SaveLog4(string fileMsg, string filename, string Assembly_name)
|
||
{
|
||
object obj = WriteTxt.obj_saveLog4;
|
||
lock (obj)
|
||
{
|
||
try
|
||
{
|
||
using (FileStream fileStream = new FileStream(WriteTxt.GetFilePath1(filename, Assembly_name), FileMode.Append, FileAccess.Write))
|
||
{
|
||
using (StreamWriter streamWriter = new StreamWriter(fileStream))
|
||
{
|
||
streamWriter.WriteLine(WriteTxt.GetCurrentTimeString() + fileMsg);
|
||
streamWriter.Close();
|
||
fileStream.Close();
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
WriteTxt.SaveLog1(fileMsg, filename, Assembly_name);
|
||
}
|
||
}
|
||
}
|
||
|
||
// Token: 0x0600005A RID: 90 RVA: 0x0000316C File Offset: 0x0000136C
|
||
private static string GetCurrentTimeString()
|
||
{
|
||
return "[" + DateTime.Now.ToLongTimeString() + "]:";
|
||
}
|
||
|
||
// Token: 0x0600005B RID: 91 RVA: 0x0000319C File Offset: 0x0000139C
|
||
private static string GetFilePath1(string str, string Assembly_Name)
|
||
{
|
||
string path = string.Concat(new string[]
|
||
{
|
||
Application.StartupPath,
|
||
"\\log\\",
|
||
DateTime.Now.ToString("yyyyMMdd"),
|
||
"\\",
|
||
Assembly_Name
|
||
});
|
||
bool flag = !Directory.Exists(path);
|
||
if (flag)
|
||
{
|
||
Directory.CreateDirectory(path);
|
||
}
|
||
string text = string.Concat(new string[]
|
||
{
|
||
Application.StartupPath,
|
||
"\\log\\",
|
||
DateTime.Now.ToString("yyyyMMdd"),
|
||
"\\",
|
||
Assembly_Name
|
||
});
|
||
bool flag2 = !Directory.Exists(text);
|
||
if (flag2)
|
||
{
|
||
Directory.CreateDirectory(text);
|
||
}
|
||
return text + "\\" + str + "_.log";
|
||
}
|
||
|
||
// Token: 0x0600005C RID: 92 RVA: 0x0000326C File Offset: 0x0000146C
|
||
public static void SaveLog2(string fileMsg)
|
||
{
|
||
object obj = WriteTxt.obj_saveLog2;
|
||
lock (obj)
|
||
{
|
||
try
|
||
{
|
||
bool flag2 = !Directory.Exists("c:\\pathlog\\");
|
||
if (flag2)
|
||
{
|
||
Directory.CreateDirectory("c:\\pathlog\\");
|
||
}
|
||
using (FileStream fileStream = new FileStream("c:\\pathlog\\" + DateTime.Now.ToString("yyyyMMdd") + "_.log", FileMode.Append, FileAccess.Write))
|
||
{
|
||
using (StreamWriter streamWriter = new StreamWriter(fileStream))
|
||
{
|
||
streamWriter.WriteLine(WriteTxt.GetCurrentTimeString() + fileMsg);
|
||
streamWriter.Close();
|
||
fileStream.Close();
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
WriteTxt.SaveLog2(fileMsg);
|
||
}
|
||
}
|
||
}
|
||
|
||
// Token: 0x0600005D RID: 93 RVA: 0x00003370 File Offset: 0x00001570
|
||
public static void SaveLog3(string fileMsg, string id)
|
||
{
|
||
object obj = WriteTxt.obj_saveLog3;
|
||
lock (obj)
|
||
{
|
||
try
|
||
{
|
||
bool flag2 = !Directory.Exists("c:\\neclog\\" + DateTime.Now.ToString("yyyyMMdd"));
|
||
if (flag2)
|
||
{
|
||
Directory.CreateDirectory("c:\\neclog\\" + DateTime.Now.ToString("yyyyMMdd"));
|
||
}
|
||
using (FileStream fileStream = new FileStream(string.Concat(new string[]
|
||
{
|
||
"c:\\neclog\\",
|
||
DateTime.Now.ToString("yyyyMMdd"),
|
||
"\\",
|
||
id,
|
||
"_.log"
|
||
}), FileMode.Append, FileAccess.Write))
|
||
{
|
||
using (StreamWriter streamWriter = new StreamWriter(fileStream))
|
||
{
|
||
streamWriter.WriteLine(WriteTxt.GetCurrentTimeString() + fileMsg);
|
||
streamWriter.Close();
|
||
fileStream.Close();
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
WriteTxt.SaveLog3(fileMsg, id);
|
||
}
|
||
}
|
||
}
|
||
|
||
// Token: 0x0400002A RID: 42
|
||
private static object obj_saveLog1 = new object();
|
||
|
||
// Token: 0x0400002B RID: 43
|
||
private static object obj_saveLog4 = new object();
|
||
|
||
// Token: 0x0400002C RID: 44
|
||
private static object obj_saveLog2 = new object();
|
||
|
||
// Token: 0x0400002D RID: 45
|
||
private static object obj_saveLog3 = new object();
|
||
}
|
||
}
|