public int[] Encoded(int number = 1) { var encoder = new Encoder7BitClass(); encoder.startBinaryWrite(); for(int i = 0; i < number; i++) { encoder.writeBinary(0x28); encoder.writeBinary(0x7B); encoder.writeBinary(0x3E); encoder.writeBinary(0x5E); encoder.writeBinary(0x06); encoder.writeBinary(0x00); encoder.writeBinary(0x00); encoder.writeBinary(0x44); } encoder.endBinaryWrite(); return encoder.Buffer.Select(b => (int)b).ToArray(); }
public void TwoAddressesRoundTripAlternate() { var encoder = new Encoder7BitClass(); encoder.startBinaryWrite(); encoder.writeBinary(0x28); encoder.writeBinary(0x7B); encoder.writeBinary(0x3E); encoder.writeBinary(0x5E); encoder.writeBinary(0x06); encoder.writeBinary(0x00); encoder.writeBinary(0x00); encoder.writeBinary(0x44); encoder.writeBinary(0x28); encoder.writeBinary(0x6C); encoder.writeBinary(0x36); encoder.writeBinary(0x5E); encoder.writeBinary(0x06); encoder.writeBinary(0x00); encoder.writeBinary(0x00); encoder.writeBinary(0x24); // Weird as f**k, 0x44 is encoded as 0x24 encoder.endBinaryWrite(); var buffer = encoder.Buffer; var result = Encoder7BitClass.ReadBinary(16, buffer); Assert.AreEqual("287B3E5E06000044286C365E06000024", Dump(result)); }