/// <summary> /// 添加日志内容(如果日志文件不存在则自动创建,否则在原有文件内容尾部追加日志) /// </summary> /// <param name="logContent"></param> public void Write(string newLogContent) { byte[] log = Encoding.Default.GetBytes(newLogContent); FileOperator.AppendContentToFile(log, this.filePath); }
/// <summary> /// 清除日志内容 /// </summary> public void ClearLog() { byte[] log = Encoding.Default.GetBytes(string.Empty); FileOperator.SaveFile(log, this.filePath, true); }
/// <summary> /// 保存文件指文件系统 /// </summary> /// <param name="content">文件内容</param> /// <param name="physicalSavePath">包含文件路径和文件名称的完整保存路径</param> public static void SaveFile(byte[] content, string physicalSavePath) { FileOperator.SaveFile(content, physicalSavePath, true); }