public void DecryptVideo(IStream currentStream, string newPath) { currentStream.Stat(out STATSTG stat, 0); IntPtr myPtr = (IntPtr)0; int streamSize = (int)stat.cbSize; byte[] streamInfo = new byte[streamSize]; currentStream.Read(streamInfo, streamSize, myPtr); File.WriteAllBytes(newPath, streamInfo); }
public void TestWriteAllBytes() { var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append("filename.ext").ToString(); var expected = new byte[] { 3, 4, 1, 5, 9, 2, 6, 5 }; File.WriteAllBytes(tempLongPathFilename, expected); try { Assert.IsTrue(expected.SequenceEqual(File.ReadAllBytes(tempLongPathFilename))); } finally { File.Delete(tempLongPathFilename); } }
public static void WriteAllBytes(string path, byte[] bytes) { File.WriteAllBytes(path, bytes); }