コード例 #1
0
ファイル: BxlDocument.cs プロジェクト: issus/BxlSharp
 /// <summary>
 /// Decodes BXL's adaptive huffman encoded data from file and returns its text representation.
 /// </summary>
 public static async Task <string> DecodeFileAsync(string fileName, BxlFileType fileType = BxlFileType.FromExtension)
 {
     if (IsBinary(fileName, fileType))
     {
         return(DecodeBxl(await File.ReadAllBytesAsync(fileName)));
     }
     else
     {
         return(await File.ReadAllTextAsync(fileName));
     }
 }
コード例 #2
0
ファイル: BxlDocument.cs プロジェクト: issus/BxlSharp
 /// <summary>
 /// Decodes BXL's adaptive huffman encoded data from file and returns its text representation.
 /// </summary>
 public static string DecodeFile(string fileName, BxlFileType fileType = BxlFileType.FromExtension)
 {
     if (IsBinary(fileName, fileType))
     {
         return(DecodeBxl(File.ReadAllBytes(fileName)));
     }
     else
     {
         return(File.ReadAllText(fileName));
     }
 }
コード例 #3
0
ファイル: BxlDocument.cs プロジェクト: issus/BxlSharp
        /// <summary>
        /// Returns a BxlDocument from parsing a BXL file.
        /// </summary>
        /// <param name="fileName">File to be read.</param>
        /// <param name="fileType">Indicates the file type.</param>
        /// <param name="progress">Allows reporting progress for large files.</param>
        public static async Task <BxlDocument> ReadFromFileAsync(string fileName, BxlFileType fileType = BxlFileType.FromExtension, IProgress <int> progress = null)
        {
            var text = await DecodeFileAsync(fileName, fileType);

            return(ReadFromText(text, fileName, progress));
        }
コード例 #4
0
ファイル: BxlDocument.cs プロジェクト: issus/BxlSharp
 /// <summary>
 /// Returns a BxlDocument from parsing a BXL file.
 /// </summary>
 /// <param name="fileName">File to be read.</param>
 /// <param name="fileType">Indicates the file type.</param>
 /// <param name="progress">Allows reporting progress for large files.</param>
 public static BxlDocument ReadFromFile(string fileName, BxlFileType fileType = BxlFileType.FromExtension, IProgress <int> progress = null)
 {
     return(ReadFromFile(fileName, fileType, out _, progress));
 }
コード例 #5
0
ファイル: BxlDocument.cs プロジェクト: issus/BxlSharp
        /// <summary>
        /// Returns a BxlDocument from parsing a BXL file.
        /// </summary>
        /// <param name="fileName">File to be read.</param>
        /// <param name="fileType">Indicates the file type.</param>
        /// <param name="logs">Information gathered during the parsing process, including errors.</param>
        /// <param name="progress">Allows reporting progress for large files.</param>
        public static BxlDocument ReadFromFile(string fileName, BxlFileType fileType, out Logs logs, IProgress <int> progress = null)
        {
            var text = DecodeFile(fileName, fileType);

            return(ReadFromText(text, fileName, out logs, progress));
        }
コード例 #6
0
ファイル: BxlDocument.cs プロジェクト: issus/BxlSharp
 private static bool IsBinary(string fileName, BxlFileType fileType = BxlFileType.FromExtension)
 {
     // assume possible binary BXL if the extension is DIFFERENT from .XLR
     return(fileType == BxlFileType.Binary ||
            (fileType == BxlFileType.FromExtension && Path.GetExtension(fileName) != ".xlr"));
 }