Fixed bug in Float/Double I/O.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 35s
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 35s
This commit is contained in:
parent
e79ef4b4e2
commit
6b83c4d198
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@
|
||||
REQUEST_IQ_SCAN,
|
||||
REQUEST_GET_SIGNAL_EX_EX,
|
||||
REQUEST_SKYSCRAPER_ENGINE_NAME,
|
||||
REQUEST_SKYSCRAPER_ENGINE_VERSION
|
||||
}
|
||||
REQUEST_SKYSCRAPER_ENGINE_VERSION,
|
||||
REQUEST_RF_SCAN_2
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ namespace skyscraper5.Skyscraper.IO
|
||||
return result;
|
||||
}
|
||||
|
||||
public static double ReadDouble(this Stream stream)
|
||||
public static double ReadDoubleLE(this Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[8];
|
||||
if (stream.Read(buffer, 0, 8) != 8)
|
||||
@ -198,7 +198,17 @@ namespace skyscraper5.Skyscraper.IO
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
Array.Reverse(buffer, 0, 8);
|
||||
return BitConverter.ToDouble(buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static double ReadDoubleBE(this Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[8];
|
||||
if (stream.Read(buffer, 0, 8) != 8)
|
||||
throw new EndOfStreamException();
|
||||
if (BitConverter.IsLittleEndian)
|
||||
Array.Reverse(buffer, 0, 8);
|
||||
return BitConverter.ToDouble(buffer, 0);
|
||||
}
|
||||
|
||||
public static void WriteUInt8(this Stream stream, byte value)
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ namespace skyscraper5.Skyscraper.Net.Sockets
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
public static void WriteDouble(this NetworkStream stream, double value)
|
||||
public static void WriteDoubleBE(this NetworkStream stream, double value)
|
||||
{
|
||||
byte[] buffer = BitConverter.GetBytes(value);
|
||||
if (BitConverter.IsLittleEndian)
|
||||
@ -160,7 +160,7 @@ namespace skyscraper5.Skyscraper.Net.Sockets
|
||||
stream.Write(buffer, 0, 8);
|
||||
}
|
||||
|
||||
public static double ReadDouble(this NetworkStream stream)
|
||||
public static double ReadDoubleBE(this NetworkStream stream)
|
||||
{
|
||||
byte[] buffer = new byte[8];
|
||||
if (stream.Read(buffer,0,8) != 8)
|
||||
@ -170,7 +170,7 @@ namespace skyscraper5.Skyscraper.Net.Sockets
|
||||
return BitConverter.ToDouble(buffer, 0);
|
||||
}
|
||||
|
||||
public static void WriteFloat(this NetworkStream stream, float value)
|
||||
public static void WriteFloatBE(this NetworkStream stream, float value)
|
||||
{
|
||||
byte[] buffer = BitConverter.GetBytes(value);
|
||||
if (BitConverter.IsLittleEndian)
|
||||
@ -178,7 +178,7 @@ namespace skyscraper5.Skyscraper.Net.Sockets
|
||||
stream.Write(buffer, 0, 4);
|
||||
}
|
||||
|
||||
public static float ReadFloat(this NetworkStream stream)
|
||||
public static float ReadFloatBE(this NetworkStream stream)
|
||||
{
|
||||
byte[] buffer = new byte[4];
|
||||
if (stream.Read(buffer, 0, 4) != 4)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user