zoukankan      html  css  js  c++  java
  • C#创建文件夹,往里追字符串。

      /// <summary>写文本日志</summary>
            /// <param name="StrMessage">日志消息</param>
            /// <param name="LogPath">默认指定文件路径</param>
            /// <param name="LogName">日志文本名(不含后缀/默认为当日时间)</param>
            /// <returns>写入成功</returns>
    
            static public bool WriteFile(String StrMessage, String LogPath = null, String LogName = null)
            {
                if (!string.IsNullOrEmpty(LogPath)) LogFilePath = LogPath;
                LogFileName = (LogName ?? DateTime.Now.ToString("yyyyMMdd")) + @".txt";
                var FullPath = LogFilePath + LogFileName;
                try
                {
                    if (!Directory.Exists(LogFilePath)) Directory.CreateDirectory(LogFilePath);
                    File.AppendAllText(FullPath, StrMessage, Encoding.UTF8);
                }
                catch (Exception ex)
                {
                    //LogHelper.WriteLogEx(typeof(TextFileMethod), ex);
                    return false;
                }
                return true;
            }
    

      这他妈的 失忆了,啥都不会了、标记一下。

    已经不记得从什么时候开始 “傻小子”最终变成了“丶神經病”
  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    ajax 几种提交方式
  • 原文地址:https://www.cnblogs.com/ChinaNebula/p/4649148.html
Copyright © 2011-2022 走看看