Changed how mafiles are read

This commit is contained in:
Carson McManus 2016-08-22 13:50:43 -04:00
parent c7937c769b
commit c10b353fc9

View file

@ -224,14 +224,27 @@ public class Manifest
List<SteamAuth.SteamGuardAccount> accounts = new List<SteamAuth.SteamGuardAccount>(); List<SteamAuth.SteamGuardAccount> accounts = new List<SteamAuth.SteamGuardAccount>();
foreach (var entry in this.Entries) foreach (var entry in this.Entries)
{ {
string fileText = File.ReadAllText(Path.Combine(Program.SteamGuardPath, entry.Filename)); string fileText = "";
Stream stream = null;
FileStream fileStream = File.OpenRead(Path.Combine(Program.SteamGuardPath, entry.Filename));
if (this.Encrypted) if (this.Encrypted)
{ {
throw new NotSupportedException("Encrypted maFiles are not supported at this time.");
//string decryptedText = FileEncryptor.DecryptData(passKey, entry.Salt, entry.IV, fileText); //string decryptedText = FileEncryptor.DecryptData(passKey, entry.Salt, entry.IV, fileText);
//if (decryptedText == null) return new SteamGuardAccount[0];
//fileText = decryptedText;
} }
else
{
stream = fileStream;
}
byte[] b = new byte[1024];
StringBuilder sb = new StringBuilder();
while (stream.Read(b,0,b.Length) > 0)
{
sb.Append(Encoding.UTF8.GetString(b));
}
stream.Close();
fileText = sb.ToString();
var account = JsonConvert.DeserializeObject<SteamAuth.SteamGuardAccount>(fileText); var account = JsonConvert.DeserializeObject<SteamAuth.SteamGuardAccount>(fileText);
if (account == null) continue; if (account == null) continue;