I had to replace Open(MemoryStream) with the more general Stream type.
There was only one additional change needed in WriteToTemporaryFile()
Old:
There was only one additional change needed in WriteToTemporaryFile()
Old:
File.WriteAllBytes(path, stream.ToArray());
New: byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
File.WriteAllBytes(path, buffer);