From 111c48ea036162b31a0a34a810ef10f9b2e20caa Mon Sep 17 00:00:00 2001 From: SmallChi <564952747@qq.com> Date: Fri, 8 Jun 2018 10:44:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E5=96=84=E8=BD=A6=E8=BE=86=E7=99=BB?= =?UTF-8?q?=E5=85=A5=E5=B0=81=E5=8C=85=E3=80=81=E8=A7=A3=E5=8C=85=202.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=E6=89=A9=E5=B1=95=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEPackageTest.cs | 7 ++++--- .../Extensions/NEExtensions.cs | 20 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) 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; } ///