diff --git a/src/GBNewEnergy.Protocol.Test/NEPackageTest.cs b/src/GBNewEnergy.Protocol.Test/NEPackageTest.cs index 4b2a93c..7faa257 100644 --- a/src/GBNewEnergy.Protocol.Test/NEPackageTest.cs +++ b/src/GBNewEnergy.Protocol.Test/NEPackageTest.cs @@ -68,8 +68,8 @@ namespace GBNewEnergy.Protocol.Test public void NELoginUpStreamConstructor3_1() { // "23 23 01 FE 4C 47 48 43 34 56 31 44 33 48 45 32 30 32 36 35 32 01 00 1F" - // "06 07 12 37 02 00 00 01 36 34 37 34 33 30 36 36 34 30 35 00 00 00 00 00 00 00 00 00 01 01 31" - // "23 23 01 FE 4C 47 48 43 34 56 31 44 33 48 45 32 30 32 36 35 32 01 00 1F 06 07 12 37 02 00 00 01 36 34 37 34 33 30 36 36 34 30 35 00 00 00 00 00 00 00 00 00 01 01 31 EC" + // "12 06 08 0A 26 2E 00 01 36 34 37 34 33 30 36 36 34 30 35 00 00 00 00 00 00 00 00 00 01 01 31" + // "23 23 01 FE 4C 47 48 43 34 56 31 44 33 48 45 32 30 32 36 35 32 01 00 1F 12 06 08 0A 26 2E 00 01 36 34 37 34 33 30 36 36 34 30 35 00 00 00 00 00 00 00 00 00 01 01 31 D4" NELoginUpStream nELoginUpStream = new NELoginUpStream("LGHC4V1D3HE202652", "64743066405", 1, 1, new string[] { "1" }); NEPackage nEPackage = new NEPackage("LGHC4V1D3HE202652", Enums.MsgId.login, Enums.AskId.cmd, nELoginUpStream, EncryptMethod.None); string headerHex = nEPackage.Header.ToHexString(); @@ -81,10 +81,11 @@ namespace GBNewEnergy.Protocol.Test public void NELoginUpStreamConstructor3_2() { byte[] header = "23 23 01 FE 4C 47 48 43 34 56 31 44 33 48 45 32 30 32 36 35 32 01 00 1F".ToHexBytes(); - byte[] body = "06 07 12 37 02 00 00 01 36 34 37 34 33 30 36 36 34 30 35 00 00 00 00 00 00 00 00 00 01 01 31 EC".ToHexBytes(); + byte[] body = "12 06 08 0A 26 2E 00 01 36 34 37 34 33 30 36 36 34 30 35 00 00 00 00 00 00 00 00 00 01 01 31 D4".ToHexBytes(); NEPackage nEPackage = new NEPackage(header, body); string headerHex = nEPackage.Header.ToHexString(); string bodiesHex = nEPackage.Bodies.Buffer.ToHexString(); + string packageHex = nEPackage.Buffer.ToHexString(); } } } diff --git a/src/GBNewEnergy.Protocol/Extensions/NEExtensions.cs b/src/GBNewEnergy.Protocol/Extensions/NEExtensions.cs index b9687c4..683c47f 100644 --- a/src/GBNewEnergy.Protocol/Extensions/NEExtensions.cs +++ b/src/GBNewEnergy.Protocol/Extensions/NEExtensions.cs @@ -16,11 +16,11 @@ namespace GBNewEnergy.Protocol.Extensions { return new DateTime( read[offset] + DateLimitYear, - read[offset++], - read[offset++], - read[offset++], - read[offset++], - read[offset++]); + read[++offset], + read[++offset], + read[++offset], + read[++offset], + read[++offset]); } public static ushort ReadUShortH2LLittle(this byte[] read, int offset, int len) @@ -85,11 +85,11 @@ namespace GBNewEnergy.Protocol.Extensions public static void WriteLittle(this byte[] write, DateTime date, int offset,int len) { write[offset] = (byte)(date.Year - DateLimitYear); - write[offset++] = (byte)date.Month; - write[offset++] = (byte)date.Day; - write[offset++] = (byte)date.Hour; - write[offset++] = (byte)date.Minute; - write[offset++] = (byte)date.Second; + write[++offset] = (byte)date.Month; + write[++offset] = (byte)date.Day; + write[++offset] = (byte)date.Hour; + write[++offset] = (byte)date.Minute; + write[++offset] = (byte)date.Second; } ///