Read bytes instead of characters when checking PES format markers, and cast bytes to characters before adding to strings

Branch_2.1.x
Nathan Crawford 2016-03-28 23:23:14 -04:00
rodzic db7902970f
commit 7b024e7f27
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -128,7 +128,8 @@ namespace PesFile
string startFileSig = "";
for (int i = 0; i < 4; i++) // 4 bytes
{
startFileSig += fileIn.ReadChar();
// This needs to be read as a byte, since characters can be multiple bytes depending on encoding
startFileSig += (char)fileIn.ReadByte();
}
if (startFileSig != "#PES")
{
@ -140,7 +141,8 @@ namespace PesFile
string versionString = "";
for (int i = 0; i < 4; i++) // 4 bytes
{
versionString += fileIn.ReadChar();
// This needs to be read as a byte, since characters can be multiple bytes depending on encoding
versionString += (char)fileIn.ReadByte();
}
if (!UInt16.TryParse(versionString, out pesVersion))
{