From 5488eadb89274837fd3d5bc4ae5386a8018dedf3 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 8 Mar 2017 15:55:48 -0600 Subject: [PATCH] work on #816 --- BizHawk.Client.Common/movie/bk2/StringLogs.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/BizHawk.Client.Common/movie/bk2/StringLogs.cs b/BizHawk.Client.Common/movie/bk2/StringLogs.cs index 3125df524e..08c3e4b28e 100644 --- a/BizHawk.Client.Common/movie/bk2/StringLogs.cs +++ b/BizHawk.Client.Common/movie/bk2/StringLogs.cs @@ -65,18 +65,18 @@ namespace BizHawk.Client.Common BinaryReader br; bool mDisk; - Stream stream; + Stream stream; public StreamStringLog(bool disk) - { - mDisk = disk; - if (disk) - { - var path = TempFileCleaner.GetTempFilename("movieOnDisk"); - stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose); - } - else - { - stream = new AWEMemoryStream(); + { + mDisk = disk; + if (disk) + { + var path = TempFileCleaner.GetTempFilename("movieOnDisk"); + stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose); + } + else + { + stream = new AWEMemoryStream(); } bw = new BinaryWriter(stream); br = new BinaryReader(stream); @@ -105,7 +105,8 @@ namespace BizHawk.Client.Common } public void Add(string str) - { + { + stream.Position = stream.Length; Offsets.Add(stream.Position); bw.Write(str); bw.Flush(); @@ -134,7 +135,8 @@ namespace BizHawk.Client.Common } public void Insert(int index, string val) - { + { + stream.Position = stream.Length; Offsets.Insert(index, stream.Position); bw.Write(val); bw.Flush();