Example #1
0
        public Amf3Array ReadArray()
        {
            int num = ReadInteger();

            if ((num & 1) == 0)
            {
                return((Amf3Array)GetTableEntry(objectTable, num >> 1));
            }

            num >>= 1;

            Amf3Array array = new Amf3Array();

            objectTable.Add(array);

            string key = ReadString();

            while (key != "")
            {
                object value = ReadNextObject();
                array.AssociativeArray[key] = value;

                key = ReadString();
            }

            while (num-- > 0)
            {
                array.DenseArray.Add(ReadNextObject());
            }

            return(array);
        }
Example #2
0
        private static object Resolve(Amf3Array root, string path)
        {
            int intKey;

            if (int.TryParse(path, out intKey))
            {
                return(root.DenseArray[intKey]);
            }

            object val;

            return(root.AssociativeArray.TryGetValue(path, out val) ? val : null);
        }
        public void TypelessWrite(Amf3Array array)
        {
            if (CheckObjectTable(array))
            {
                return;
            }

            objectTable[array] = objectTable.Count;

            TypelessWrite((array.DenseArray.Count << 1) | 1);

            WriteDictionary(array.AssociativeArray);

            foreach (object i in array.DenseArray)
            {
                Write(i);
            }
        }
 public void Write(Amf3Array array)
 {
     Write(Amf3TypeCode.Array);
     TypelessWrite(array);
 }