Ejemplo n.º 1
0
 void OnMissingNewFields(int decodedUpToVersion, int decodingVersion)
 {
     if (decodingVersion == 2)
     {
         _addedOptPointer = "Added1";
         _addedOptScalar = 2;
         _addedOptStructure = new SmallStructure();
         _addedOptStructure.Test = 3;
         _addedReqPointer = "Added4";
         _addedReqScalar = 5;
         _addedReqStructure = new SmallStructure();
         _addedReqStructure.Test = 6;
     }
 }
Ejemplo n.º 2
0
        public void TestDynamicDecodingWithTypes()
        {
            DynamicPincher pincher = new DynamicPincher(@"..\..\TestVersion3.pinch");

            TypesStructure sample = new TypesStructure();

            sample.ReqFloat32 = 1.2f;
            sample.ReqFloat64 = 3.4;
            sample.ReqInt8 = 5;
            sample.ReqInt16 = 6;
            sample.ReqInt32 = 7;
            sample.ReqInt64 = 8;
            sample.ReqDecimal = 9.10M;
            sample.ReqBool = true;
            sample.ReqString = "Eleven";
            sample.ReqBytes = new byte[] { 1, 2 };
            sample.ReqEnumeration = TypesEnumeration.B;
            sample.ReqStructure = new SmallStructure();
            sample.ReqStructure.Test = 13;

            SmallStructure firstSmall = new SmallStructure();
            firstSmall.Test = 14;

            SmallStructure secondSmall = new SmallStructure();
            secondSmall.Test = 15;

            sample.ReqListOfEnum.Add(firstSmall);
            sample.ReqListOfEnum.Add(secondSmall);

            byte[] data = Pincher.Encode(sample);

            DynamicStructure structure =
                pincher.Decode("Interlace.Pinch.TestsVersion3.TypesStructure", data);

            string structureText = structure.Dumped;
        }