mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-15 04:34:46 +00:00
Merge pull request #100 from PepperDash/hotfix/xsig-digital-token-fix
Fix XSigToken Indexing
This commit is contained in:
@@ -29,7 +29,7 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
public override byte[] GetBytes()
|
public override byte[] GetBytes()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
(byte)(0xC0 | ((Value & 0xC000) >> 10) | (Index >> 7)),
|
(byte)(0xC0 | ((Value & 0xC000) >> 10) | (Index - 1 >> 7)),
|
||||||
(byte)((Index - 1) & 0x7F),
|
(byte)((Index - 1) & 0x7F),
|
||||||
(byte)((Value & 0x3F80) >> 7),
|
(byte)((Value & 0x3F80) >> 7),
|
||||||
(byte)(Value & 0x7F)
|
(byte)(Value & 0x7F)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
public override byte[] GetBytes()
|
public override byte[] GetBytes()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
(byte)(0x80 | (Value ? 0 : 0x20) | (Index >> 7)),
|
(byte)(0x80 | (Value ? 0 : 0x20) | ((Index - 1) >> 7)),
|
||||||
(byte)((Index - 1) & 0x7F)
|
(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 serialBytes = String.IsNullOrEmpty(Value) ? new byte[0] : Encoding.GetEncoding(28591).GetBytes(Value);
|
||||||
|
|
||||||
var xsig = new byte[serialBytes.Length + 3];
|
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[1] = (byte)((Index - 1) & 0x7F);
|
||||||
xsig[xsig.Length - 1] = 0xFF;
|
xsig[xsig.Length - 1] = 0xFF;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user