Ejemplo n.º 1
0
        public void TestAMF3StringRefs()
        {
            AMFDataParser target = new AMFDataParser();
            target.DataBytes = new byte[0];
            target.WriteAMF3String("");
            target.WriteAMF3String("1111");
            target.WriteAMF3String("");
            target.WriteAMF3String("1111");

            AMFDataParser target2 = new AMFDataParser();
            target2.DataBytes = target.DataBytes;
            Assert.AreEqual("", target2.ReadAMF3String());
            Assert.AreEqual("1111", target2.ReadAMF3String());
            Assert.AreEqual("", target2.ReadAMF3String());
            Assert.AreEqual("1111", target2.ReadAMF3String());

            byte[] original_bytes = {
                0x1,
                0x9, 0x31, 0x31, 0x31, 0x31,
                0x1,
                0x0,
            };
            AssertBytes(original_bytes, target.DataBytes);
        }
Ejemplo n.º 2
0
        public void TestAMF3UTF8String()
        {
            AMFDataParser target = new AMFDataParser(); // TODO: Initialize to an appropriate value
            /* T:\mat\Research\Technology\AMF\Samples\farm-tr-fb.socialgamenet.com-22-request.bin (2/21/2012 1:09:42 PM)
               StartOffset: 000000B1, EndOffset: 000000DC, Length: 0000002C */
            byte[] original_bytes = {
                0x43,
                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.ReadAMF3String();

            Assert.IsTrue(parsed == original);

            byte[] pmNullData = {
            };

            target.DataBytes = pmNullData;
            target.WriteAMF3String(original);

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

            AssertBytes(target.DataBytes, original_bytes);
        }
Ejemplo n.º 3
0
        public void TestAMF3String()
        {
            AMFDataParser target = new AMFDataParser(); // TODO: Initialize to an appropriate value
            /* T:\mat\Research\Technology\AMF\Samples\farm-tr-fb.socialgamenet.com-22-request.bin (2/21/2012 1:09:42 PM)
               StartOffset: 000000B1, EndOffset: 000000DC, Length: 0000002C */
            byte[] original_bytes = {
                0x57, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x66, 0x61, 0x72, 0x6D,
                0x2D, 0x74, 0x72, 0x2D, 0x66, 0x62, 0x2E, 0x73, 0x6F, 0x63, 0x69, 0x61,
                0x6C, 0x67, 0x61, 0x6D, 0x65, 0x6E, 0x65, 0x74, 0x2E, 0x63, 0x6F, 0x6D,
                0x2F, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x2F
            };

            string original = "http://farm-tr-fb.socialgamenet.com/static/";

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

            Assert.IsTrue(parsed == original);

            byte[] pmNullData = {
            };

            target.DataBytes = pmNullData;
            target.WriteAMF3String(original);

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

            AssertBytes(target.DataBytes, original_bytes);
        }