kopia lustrzana https://github.com/njcrawford/EmbroideryReader
Read bytes instead of characters when checking PES format markers, and cast bytes to characters before adding to strings
rodzic
db7902970f
commit
7b024e7f27
|
@ -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))
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue