From 64797e77a9a533bd93ddfe178cc977150505edfc Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Tue, 23 Aug 2016 14:49:07 -0400 Subject: [PATCH] fixed extra text at the end when writing to a previously encrypted maFile --- Manifest.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Manifest.cs b/Manifest.cs index bb250ba..c71a01f 100644 --- a/Manifest.cs +++ b/Manifest.cs @@ -368,7 +368,11 @@ public class Manifest } else { - stream = File.OpenWrite(Path.Combine(Program.SteamGuardPath, newEntry.Filename)); + // An unencrypted maFile is shorter than the encrypted version, + // so when an unencrypted maFile gets written this way, the file does not get wiped + // leaving encrypted text after the final } bracket. Deleting and recreating the file fixes this. + File.Delete(Path.Combine(Program.SteamGuardPath, newEntry.Filename)); + stream = File.OpenWrite(Path.Combine(Program.SteamGuardPath, newEntry.Filename)); // open or create } using (StreamWriter writer = new StreamWriter(stream))