예제 #1
0
        public void TestAMF0UTF8String()
        {
            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 = {
                0x00, 0x21,
                0xC2, 0xA9, 0xE4, 0xB8, 0xAD, 0xE3, 0x82, 0xAC,
                0xE3, 0x81, 0x82, 0xCE, 0xB8, 0xE3, 0x89, 0xA0,
                0xE3, 0x84, 0xB1, 0xCE, 0xB1, 0xCE, 0xBD, 0xD0,
                0xB0, 0xD0, 0xBB, 0xD1, 0x87, 0xF0, 0x9F, 0x98,
                0x83
            };
            string original = "©中ガあθ㉠ㄱανалч😃";

            target.DataBytes = original_bytes;
            string parsed = target.ReadAMF0String();

            Assert.IsTrue(parsed == original);

            byte[] pmNullData = {
            };

            target.DataBytes = pmNullData;

            target.WriteAMF0String(original);

            Debug.WriteLine(String.Format("target.DataBytes.Length: 0x{0:X}\r\n", target.DataBytes.Length));
            DumpHex(target.DataBytes);
            AssertBytes(target.DataBytes, original_bytes);
        }
예제 #2
0
        public void TestAMF0String()
        {
            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 = {
                0x00, 0x0D, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x5F, 0x62, 0x61,
                0x74, 0x63, 0x68
            };
            string original = "execute_batch";

            target.DataBytes = original_bytes;
            string parsed = target.ReadAMF0String();

            Assert.IsTrue(parsed == original);

            byte[] pmNullData = {
            };

            target.DataBytes = pmNullData;

            target.WriteAMF0String(original);

            Debug.WriteLine(String.Format("target.DataBytes.Length: 0x{0:X}\r\n", target.DataBytes.Length));
            DumpHex(target.DataBytes);
            AssertBytes(target.DataBytes, original_bytes);
        }