IDAL/iFileLog.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;
namespace IDAL
{
public class iFileLog // 下载于www.51aspx.com
{
private string log_path;
private string log_directory;
private string path = "FileLog\\"; //日子都放到日志文件夹,
//日志文件夹中有每一个窗体的文件夹日志,
string strLog = DateTime.Now.ToString("yyyyMM")+".log";//里面有按日期的日志 每月一个文件
//只是生产文件log日志
public void WriteLog(string strWindow, string strResult)
{
ClsLog(path, strWindow, strLog);// 判断路径,是否已经存在,不存在就生成
Store(strResult);//讲数据写入log日志中
return;
}
//判断并创建地址
public void ClsLog(string Path, string DetailPath, string FileName)
{
if (!Directory.Exists(Path))
Directory.CreateDirectory(Path);
if (!Directory.Exists(Path + DetailPath))
Directory.CreateDirectory(Path + DetailPath);
log_path = Path + DetailPath + "\\" + FileName;
log_directory = Path + DetailPath + "\\";
return;
}
//将Result写入log中
public bool Store(string Contents)
{
try
{
StreamWriter pStream = new StreamWriter(log_path, true);
pStream.WriteLine(Write(Contents));
pStream.Close();
Debug.WriteLine(Write(Contents));
return true;
}
catch // Try Again 再试一次
{
后面还有 31 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。