Exemplo n.º 1
0
        private int?ClassIndex(AMFClass obj)
        {
            int idx;

            if (classes.TryGetValue(obj, out idx))
            {
                return(idx);
            }
            else
            {
                classes.Add(obj, classes.Count);
                return(null);
            }
        }
Exemplo n.º 2
0
        private AMFValue ReadObject()
        {
            var idx = ReadUI29();

            if ((idx & 0x01) == 0)
            {
                return(GetRegisteredObject(idx >> 1));
            }
            AMFClass klass;

            if (((idx >> 1) & 0x01) == 0)
            {
                klass = classes[idx >> 2];
            }
            else
            {
                if (((idx >> 2) & 0x01) == 1)
                {
                    var class_name = ReadString();
                    throw new NotImplementedException();
                }
                else
                {
                    var is_dynamic = ((idx >> 3) & 0x01) == 1;
                    var cnt        = idx >> 4;
                    var class_name = ReadString();
                    klass = new AMFClass(class_name, is_dynamic, Enumerable.Range(0, cnt).Select(i => ReadString()).ToArray());
                    classes.Add(klass);
                }
            }
            var dic = new Dictionary <string, AMFValue>();

            foreach (var trait in klass.Traits)
            {
                dic[trait] = ReadValue();
            }
            if (klass.IsDynamic)
            {
                var name = ReadString();
                while (!String.IsNullOrEmpty(name))
                {
                    dic[name] = ReadValue();
                    name      = ReadString();
                }
            }
            return(RegisterObject(new AMFValue(new AMFObject(klass, dic))));
        }
Exemplo n.º 3
0
 public AMFObject(AMFClass amfclass, IDictionary <string, AMFValue> data)
 {
     this.Class = amfclass;
     this.Data  = data;
 }