예제 #1
0
        public void ReadExternal(BinaryReader input)
        {
            _paramCount = Primitives.ReadU30(input);
            _returnType = Primitives.ReadU30(input);

            _paramType = new ArrayList(Capacity.Max(_paramCount));

            for (uint i = 0; i < _paramCount._value; ++i)
            {
                _paramType.Add(Primitives.ReadU30(input));
            }

            _name  = Primitives.ReadU30(input);
            _flags = input.ReadByte();

            if (HasFlag(HasOptional))
            {
                _optionInfo = new OptionInfo();
                _optionInfo.ReadExternal(input);
            }

            if (HasFlag(HasParamNames))
            {
                //param_info { u30 param_name[param_count] }
                _paramName = new ArrayList(Capacity.Max(_paramCount));

                for (uint i = 0; i < _paramCount._value; ++i)
                {
                    _paramName.Add(Primitives.ReadU30(input));
                }
            }
        }
예제 #2
0
파일: OptionInfo.cs 프로젝트: nguyenbs/as3c
        public void ReadExternal(BinaryReader input)
        {
            uint n = Primitives.ReadU30(input).Value;

            _optionDetail = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                OptionDetail detail = new OptionDetail();
                detail.ReadExternal(input);

                _optionDetail.Add(detail);
            }
        }
예제 #3
0
파일: ClassInfo.cs 프로젝트: nguyenbs/as3c
        public void ReadExternal(BinaryReader input)
        {
            _cinit = Primitives.ReadU30(input);

            uint n = Primitives.ReadU30(input).Value;

            _traits = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                TraitInfo ti = new TraitInfo();
                ti.ReadExternal(input);

                _traits.Add(ti);
            }
        }
예제 #4
0
        public void ReadExternal(BinaryReader input)
        {
            uint count = Primitives.ReadU30(input).Value;

            _ns = new ArrayList(Capacity.Max(count));

            for (uint i = 0; i < count; ++i)
            {
                U30 ns = Primitives.ReadU30(input);
                _ns.Add(ns);

                if (0 == ns.Value)
                {
                    throw new VerifyException("Namespace must not be 0.");
                }
            }
        }
예제 #5
0
        public void ReadExternal(BinaryReader input)
        {
            _name = Primitives.ReadU30(input);

            _superName = Primitives.ReadU30(input);

            _flags = input.ReadByte();

            if (ClassProtectedNs == (_flags & ClassProtectedNs))
            {
                _protectedNs = Primitives.ReadU30(input);
            }

            uint n = Primitives.ReadU30(input).Value;

            _interface = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                U30 iid = Primitives.ReadU30(input);

                if (0 == iid.Value)
                {
                    throw new VerifyException("Interface must not be 0.");
                }

                _interface.Add(iid);
            }

            _iinit = Primitives.ReadU30(input);

            n = Primitives.ReadU30(input).Value;

            _traits = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                TraitInfo ti = new TraitInfo();
                ti.ReadExternal(input);

                _traits.Add(ti);
            }
        }
예제 #6
0
        public void ReadExternal(BinaryReader input)
        {
            uint n;

            _method         = Primitives.ReadU30(input);
            _maxStack       = Primitives.ReadU30(input);
            _localCount     = Primitives.ReadU30(input);
            _initScopeDepth = Primitives.ReadU30(input);
            _maxScopeDepth  = Primitives.ReadU30(input);

            n     = Primitives.ReadU30(input).Value;
            _code = new byte[n];//the holy grail...finally...
            for (uint i = 0; i < n; ++i)
            {
                _code[i] = input.ReadByte();
            }


            n = Primitives.ReadU30(input).Value;
            _exceptionInfo = new ArrayList(Capacity.Max(n));
            for (uint i = 0; i < n; ++i)
            {
                ExceptionInfo ei = new ExceptionInfo();
                ei.ReadExternal(input);

                _exceptionInfo.Add(ei);
            }

            n = Primitives.ReadU30(input).Value;

            _traits = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                TraitInfo ti = new TraitInfo();
                ti.ReadExternal(input);

                _traits.Add(ti);
            }
        }
예제 #7
0
        public void ReadExternal(BinaryReader input)
        {
            _name = Primitives.ReadU30(input);

            if (0 == _name.Value)
            {
                throw new VerifyException("Name must not be 0.");
            }

            uint n = Primitives.ReadU30(input).Value;

            _items = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                ItemInfo itemInfo = new ItemInfo();

                itemInfo.key   = Primitives.ReadU30(input);
                itemInfo.value = Primitives.ReadU30(input);

                _items.Add(itemInfo);
            }
        }
예제 #8
0
파일: Abc46.cs 프로젝트: nguyenbs/as3c
        public void ReadExternal(BinaryReader input)
        {
            #region frame

            char chr;
            _name = "";

            while ((chr = (char)input.ReadByte()) != 0)
            {
                _name += chr;
            }

            #endregion

            #region version

            _minor = input.ReadUInt16();
            _major = input.ReadUInt16();

            if (_major > VERSION_MAJOR)
            {
                throw new Exception(String.Format("Unsupported .abc format {0}.{1}.", MajorVersion, MinorVersion));
            }

            #endregion

            #region cpool_info

            _cpool = new ConstantPool();
            _cpool.ReadExternal(input);

            #endregion

            #region method_info

            uint n = Primitives.ReadU30(input).Value;

            _methods = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                MethodInfo method = new MethodInfo();
                method.ReadExternal(input);

                _methods.Add(method);
            }

            #endregion

            #region metadata_info

            n = Primitives.ReadU30(input).Value;

            _metadata = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                MetadataInfo metadata = new MetadataInfo();
                metadata.ReadExternal(input);

                _metadata.Add(metadata);
            }

            #endregion

            #region instance_info

            n = Primitives.ReadU30(input).Value;

            _instanceInfo = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                InstanceInfo instanceInfo = new InstanceInfo();
                instanceInfo.ReadExternal(input);

                _instanceInfo.Add(instanceInfo);
            }

            #endregion

            #region class_info

            //n is same as for instance_info

            _classInfo = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                ClassInfo classInfo = new ClassInfo();
                classInfo.ReadExternal(input);

                _classInfo.Add(classInfo);
            }

            #endregion

            #region script_info

            n = Primitives.ReadU30(input).Value;

            _scriptInfo = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                ScriptInfo scriptInfo = new ScriptInfo();
                scriptInfo.ReadExternal(input);

                _scriptInfo.Add(scriptInfo);
            }

            #endregion

            #region method_body_info

            n = Primitives.ReadU30(input).Value;

            _methodBodyInfo = new ArrayList(Capacity.Max(n));

            for (uint i = 0; i < n; ++i)
            {
                MethodBodyInfo methodBodyInfo = new MethodBodyInfo();
                methodBodyInfo.ReadExternal(input);

                _methodBodyInfo.Add(methodBodyInfo);
            }

            #endregion
        }
예제 #9
0
        public void ReadExternal(BinaryReader input)
        {
            #region integer

            uint n = Primitives.ReadU30(input).Value;

            _intTable = new ArrayList(Capacity.Max(n));
            _intTable.Add(new S32());

            for (uint i = 1; i < n; ++i)
            {
                _intTable.Add(Primitives.ReadS32(input));
            }

            #endregion

            #region uinteger

            n = Primitives.ReadU30(input).Value;

            _uintTable = new ArrayList(Capacity.Max(n));
            _uintTable.Add(new U32());

            for (uint i = 1; i < n; ++i)
            {
                _uintTable.Add(Primitives.ReadU32(input));
            }

            #endregion

            #region double

            n = Primitives.ReadU30(input).Value;

            _doubleTable = new ArrayList(Capacity.Max(n));
            _doubleTable.Add(double.NaN);

            for (uint i = 1; i < n; ++i)
            {
                _doubleTable.Add(input.ReadDouble());
            }

            #endregion

            #region string_info

            n = Primitives.ReadU30(input).Value;

            _stringTable = new ArrayList(Capacity.Max(n));
            _stringTable.Add(new StringInfo());

            for (uint i = 1; i < n; ++i)
            {
                StringInfo stringInfo = new StringInfo();
                stringInfo.ReadExternal(input);

                _stringTable.Add(stringInfo);
            }

            #endregion

            #region namespace_info

            n = Primitives.ReadU30(input).Value;

            _namespaceTable = new ArrayList(Capacity.Max(n));
            _namespaceTable.Add(new NamespaceInfo());

            for (uint i = 1; i < n; ++i)
            {
                NamespaceInfo namespaceInfo = new NamespaceInfo();
                namespaceInfo.ReadExternal(input);

                _namespaceTable.Add(namespaceInfo);
            }

            #endregion

            #region ns_set_info

            n = Primitives.ReadU30(input).Value;

            _nsTable = new ArrayList(Capacity.Max(n));
            _nsTable.Add(new NamespaceSetInfo());

            for (uint i = 1; i < n; ++i)
            {
                NamespaceSetInfo nsInfo = new NamespaceSetInfo();
                nsInfo.ReadExternal(input);

                _nsTable.Add(nsInfo);
            }

            #endregion

            #region multiname_info

            n = Primitives.ReadU30(input).Value;

            _multinameTable = new ArrayList(Capacity.Max(n));
            _multinameTable.Add(new MultinameInfo());

            for (uint i = 1; i < n; ++i)
            {
                MultinameInfo multinameInfo = new MultinameInfo();
                multinameInfo.ReadExternal(input);

                _multinameTable.Add(multinameInfo);
            }

            #endregion
        }
예제 #10
0
파일: TraitInfo.cs 프로젝트: nguyenbs/as3c
        public void ReadExternal(BinaryReader input)
        {
            _name = Primitives.ReadU30(input);

            if (0 == (uint)_name)
            {
                throw new VerifyException("Name must not be 0.");
            }

            _kind = input.ReadByte();

            _type = (byte)(_kind & 0xf);
            _attr = (byte)((_kind >> 4) & 0xf);

            switch (_type)
            {
            case TraitSlot:
                _body = new TraitSlot(this);
                break;

            case TraitConst:
                _body = new TraitConst(this);
                break;

            case TraitClass:
                _body = new TraitClass(this);
                break;

            case TraitFunction:
                _body = new TraitFunction(this);
                break;

            case TraitMethod:
                _body = new TraitMethod(this);
                break;

            case TraitGetter:
                _body = new TraitGetter(this);
                break;

            case TraitSetter:
                _body = new TraitSetter(this);
                break;

            default:
                throw new VerifyException("Unexpected trait body.");
            }

            _body.ReadExternal(input);

            if (AttributeMetadata == (_attr & AttributeMetadata))
            {
                uint n = Primitives.ReadU30(input).Value;

                _metadata = new ArrayList(Capacity.Max(n));

                for (uint i = 0; i < n; ++i)
                {
                    _metadata.Add(Primitives.ReadU30(input));
                }
            }
        }