fixed extra text at the end when writing to a previously encrypted maFile

This commit is contained in:
Carson McManus 2016-08-23 14:49:07 -04:00
parent c8a863f098
commit 64797e77a9

View file

@ -368,7 +368,11 @@ public class Manifest
} }
else 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)) using (StreamWriter writer = new StreamWriter(stream))