コード例 #1
0
        public void TestAMF3Object()
        {
            AMFDataParser target = new AMFDataParser(); // TODO: Initialize to an appropriate value
            /* T:\mat\Research\Technology\AMF\Samples\farm-tr-fb.socialgamenet.com-20-request.bin (2/21/2012 1:35:38 PM)
              StartOffset: 00000028, EndOffset: 00000037, Length: 00000010 */

            byte[] original_bytes = {
                0x0b,0x01,0x0f,0x63,0x68,
                0x61,0x6e,0x6e,0x65,0x6c,0x06,0x13,0x73,0x61,0x76,0x65,0x5f,0x64,0x61,0x74,0x61,
                0x17,0x73,0x77,0x66,0x5f,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x04,0x4f,0x13,0x64,
                0x61,0x74,0x61,0x5f,0x68,0x61,0x73,0x68,0x06,0x41,0x61,0x66,0x63,0x39,0x62,0x39,
                0x35,0x33,0x31,0x63,0x30,0x65,0x36,0x31,0x64,0x31,0x31,0x63,0x65,0x34,0x35,0x37,
                0x36,0x66,0x35,0x64,0x36,0x30,0x62,0x38,0x66,0x63,0x0b,0x73,0x74,0x61,0x74,0x65,
                0x06,0x05,0x6f,0x6b,0x0f,0x63,0x61,0x6c,0x6c,0x5f,0x69,0x64,0x06,0x1b,0x31,0x33,
                0x32,0x39,0x38,0x35,0x32,0x37,0x36,0x33,0x31,0x30,0x36,0x13,0x66,0x65,0x65,0x64,
                0x5f,0x64,0x61,0x74,0x61,0x02,0x23,0x6f,0x62,0x6a,0x65,0x63,0x74,0x73,0x5f,0x74,
                0x6f,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x09,0x01,0x01,0x15,0x73,0x74,0x6f,0x72,
                0x79,0x5f,0x64,0x61,0x74,0x61,0x09,0x01,0x03,0x31,0x0a,0x01,0x05,0x31,0x35,0x06,
                0x03,0x34,0x05,0x31,0x37,0x04,0x00,0x01,0x03,0x32,0x0a,0x01,0x05,0x31,0x36,0x04,
                0x00,0x05,0x31,0x38,0x04,0x00,0x01,0x05,0x31,0x39,0x0a,0x01,0x05,0x31,0x30,0x04,
                0x00,0x01,0x01,0x01

            };
            //AMF3Object original;

            target.DataBytes = original_bytes;
            AMF3Object parsed = target.ReadAMF3Object();

            //TODO: Assert.IsTrue(parsed == original);

            byte[] pmNullData = {
            };

            target.DataBytes = pmNullData;

            target.WriteAMF3Object(parsed);

            Debug.WriteLine(String.Format("target.DataBytes.Length: 0x{0:X} vs Original Bytes Length: 0x{1:X}\r\n", target.DataBytes.Length, original_bytes.Length));

            DumpHex(original_bytes);
            DumpHex(target.DataBytes);
            AssertBytes(target.DataBytes, original_bytes);

            Debug.WriteLine(target.GetDebugMessage());
        }