private static void WriteFile(WmaWriter wmaOutput, WmaStreamReader wmaInput, byte[] buffer, long stopPosition) { if (stopPosition == -1) { stopPosition = wmaInput.Length + 1; } int read; //Read the file until we hit our stop position, or the end of the file. while (wmaInput.Position < stopPosition && (read = wmaInput.Read(buffer, 0, buffer.Length)) > 0) { wmaOutput.Write(buffer, 0, read); } }
public Stream GetEncodedStream() { var encodedStream = new MemoryStream(); var writer = new WmaWriter(encodedStream, Format, Profile); Seek(0, SeekOrigin.Begin); var buffer = new byte[writer.OptimalBufferSize * 50]; int read; while (Position < Length && (read = Read(buffer, 0, buffer.Length)) > 0) { writer.Write(buffer, 0, read); } writer.Close(); return(encodedStream); }
public Stream GetEncodedStream() { var encodedStream = new MemoryStream(); var writer = new WmaWriter(encodedStream, Format, Profile); Seek(0, SeekOrigin.Begin); var buffer = new byte[writer.OptimalBufferSize * 50]; int read; while (Position < Length && (read = Read(buffer, 0, buffer.Length)) > 0) { writer.Write(buffer, 0, read); } writer.Close(); return encodedStream; }
private static void WriteFile(WmaWriter wmaOutput, WmaStreamReader wmaInput, byte[] buffer, long stopPosition) { if (stopPosition == -1) { stopPosition = wmaInput.Length + 1; } int read; //Read the file until we hit our stop position, or the end of the file. while (wmaInput.Position < stopPosition && (read = wmaInput.Read(buffer, 0, buffer.Length)) > 0) { wmaOutput.Write(buffer, 0, read); } }