public void TestSegEmpty()
        {
            byte[] n = new byte[0];

            byte[] bData = SD.Seg(n);
            Assert.AreEqual(bData.Length, 1);
            Assert.AreEqual(bData[0], 0x00);
        }
        public void TestDataDesegWithID()
        {
            //public static byte[] tableThree = { 5, 1, 2, 3, 4, 5, 2, 12, 2, 1, 0 };
            byte[] b1 = SD.DesegWithIdFromTable(tableThree, 0);
            byte[] b2 = SD.DesegWithIdFromTable(tableThree, 1);
            byte[] b3 = SD.DesegWithIdFromTable(tableThree, 2);

            byte[] seg = SD.Seg(tableThree);
            byte[] b4  = SD.DesegWithIdFromSeg(seg, 1);

            Assert.AreEqual(b1, new byte[] { 1, 2, 3, 4, 5 });
            Assert.AreEqual(b2, new byte[] { 12, 2 });
            Assert.AreEqual(b3, new byte[] { 0 });
            Assert.AreEqual(b4, new byte[] { 12, 2 });
        }
 public void TestSeg()
 {
     Assert.AreEqual(SD.Seg(body5), seg5);
     Assert.AreEqual(SD.Seg(body300), seg302);
     Assert.AreEqual(SD.Seg(body255), seg257);
 }
Beispiel #4
0
 // Customized Serialization for Card.
 // The Class Neunity.Tools.SD Manages Serialization/Deserialization.
 public static byte[] Card2Bytes(Card card) => SD.JoinSegs2Seg(
     SD.SegInt(card.type),
     SD.Seg(card.lvls),
     SD.SegInt(card.birthBlock),
     SD.SegString(card.name)
     );