mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
fix indexing for tokens
This commit is contained in:
@@ -29,7 +29,7 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||
public override byte[] GetBytes()
|
||||
{
|
||||
return new[] {
|
||||
(byte)(0xC0 | ((Value & 0xC000) >> 10) | (Index >> 7)),
|
||||
(byte)(0xC0 | ((Value & 0xC000) >> 10) | (Index-1 >> 7)),
|
||||
(byte)((Index - 1) & 0x7F),
|
||||
(byte)((Value & 0x3F80) >> 7),
|
||||
(byte)(Value & 0x7F)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||
public override byte[] GetBytes()
|
||||
{
|
||||
return new[] {
|
||||
(byte)(0x80 | (Value ? 0 : 0x20) | (Index >> 7)),
|
||||
(byte)(0x80 | (Value ? 0 : 0x20) | ((Index - 1) >> 7)),
|
||||
(byte)((Index - 1) & 0x7F)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||
var serialBytes = String.IsNullOrEmpty(Value) ? new byte[0] : Encoding.GetEncoding(28591).GetBytes(Value);
|
||||
|
||||
var xsig = new byte[serialBytes.Length + 3];
|
||||
xsig[0] = (byte)(0xC8 | (Index >> 7));
|
||||
xsig[0] = (byte)(0xC8 | (Index-1 >> 7));
|
||||
xsig[1] = (byte)((Index - 1) & 0x7F);
|
||||
xsig[xsig.Length - 1] = 0xFF;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user