/// <summary> /// Decodes a stream and saves the result to disk /// </summary> /// <param name="stream"></param> /// <param name="filepath"></param> /// <returns></returns> public static void DecodeAndExport(Stream stream, string filepath) { using var bt = new BlockTableStreamReader(stream); using var fs = Helpers.Create(filepath); bt.Position = 0; bt.CopyTo(fs); }
/// <summary> /// Decodes a file and saves the result to disk /// </summary> /// <param name="inputPath"></param> /// <param name="outputPath"></param> /// <returns></returns> public static void DecodeAndExport(string inputPath, string outputPath) { using var bt = new BlockTableStreamReader(inputPath); using var fs = Helpers.Create(outputPath); bt.Position = 0; bt.CopyTo(fs); }
/// <summary> /// Decodes a byte array and saves the result to disk /// </summary> /// <param name="data"></param> /// <param name="filepath"></param> /// <returns></returns> public static void DecodeAndExport(byte[] data, string filepath) { using (var bt = new BlockTableStreamReader(data)) using (var fs = Helpers.Create(filepath)) { bt.Position = 0; bt.CopyTo(fs); } }
/// <summary> /// Decodes a byte array and saves the result to disk /// </summary> /// <param name="data"></param> /// <param name="filepath"></param> /// <returns></returns> public static void DecodeAndExport(byte[] data, string filepath) { using var bt = new BlockTableStreamReader(data); using var fs = Helpers.Create(filepath); bt.Position = 0; bt.CopyTo(fs); fs.Flush(true); fs.Dispose(); }