// ========================================================================================= // 讀取檔案 // ========================================================================================= /// <summary> /// 讀取檔案 </summary> /// <param name="filePath"> </param> /// <returns> 檔案內容 </returns> /// <exception cref="IOException"> </exception> public string ReadFileContent(string filePath, Encoding encoding = null) { var fileInfo = new ZlpFileInfo(filePath); if (encoding == null) { return(fileInfo.ReadAllText()); } else { return(fileInfo.ReadAllText(encoding)); } }
public static string[] ReadAllLinesFromFileUsingZetaLongPaths(string filePath) { string[] r = null; ZetaLongPaths.ZlpFileInfo fi = new ZlpFileInfo(filePath); r = fi.ReadAllText().Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.None); return(r); }