Log.cs

(完整代码) 1KB

using System;
using System.IO;
using System.Text;
using System.Configuration;

namespace DataObject
{
    /// <summary>
    /// 日志
    /// </summary>
    public sealed class Log
    {
        /// <summary>
        /// 文件名
        /// </summary>
        private static string FileName
        {
            get { return DateTime.Now.Date.ToString("yyyyMMdd") + ".txt"; }
        }

        /// <summary>
        /// 文件放置目录 
        /// </summary>
        private static string Path {
            get {
                string path = ConfigurationManager.AppSettings["log_path"] ?? "";
                return path.Length > 0 ? path : Environment.CurrentDirectory + "\\";
            }
        }

        /// <summary>
        /// 写数据
        /// </summary>
        /// <param name="rows">写入信息</param>
        public static void Write(params string[] rows)
        {
            FileIO.Write(Path + FileName, rows);
        }

        /// <summary>
        /// 读取内容
        /// </summary>
        /// <returns></returns>
        public static string Read()
        {
            return FileIO.Read(Path + FileName);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。