Beispiel #1
0
        /// <see cref="SwfOp.ByteCode.Actions.BaseAction.Compile"/>
        public override void Compile(BinaryWriter w)
        {
            base.Compile(w);

            byte flags = (byte)0;

            if (catchesInReg)
            {
                flags += (byte)0x04;
            }
            if (hasFinally)
            {
                flags += (byte)0x02;
            }
            if (hasCatch)
            {
                flags += (byte)0x01;
            }

            w.Write(flags);
            w.Write(trySize);
            w.Write(catchSize);
            w.Write(finallySize);

            if (catchesInReg)
            {
                w.Write(catchReg);
            }
            else
            {
                BinaryStringRW.WriteString(w, catchVar);
            }
        }
        /// <see cref="SwfOp.ByteCode.Actions.BaseAction.Compile"/>/// <see cref="SwfOp.ByteCode.Actions.BaseAction.Compile"/>
        public override void Compile(BinaryWriter w)
        {
            base.Compile(w);
            w.Write(Convert.ToUInt16(ConstantList.Count));

            foreach (object c in ConstantList)
            {
                string stringToWrite = (string)c;
                BinaryStringRW.WriteString(w, stringToWrite);
            }
        }
        /// <summary>
        /// compile push type and value (but not action code), so method can
        /// be used by <see cref="SwfOp.ByteCode.Actions.ActionPushList">ActionPushList</see> as well
        /// </summary>
        public void CompileBody(BinaryWriter w)
        {
            w.Write(Convert.ToByte(Type));

            switch ((PushType)Type)
            {
            case PushType.String:
                string stringToWrite = (string)Value;
                BinaryStringRW.WriteString(w, stringToWrite);
                break;

            case PushType.Float:
                w.Write(Convert.ToSingle(Value));
                break;

            case PushType.Register:
                w.Write(Convert.ToByte(Value));
                break;

            case PushType.Boolean:
                w.Write((bool)Value);
                break;

            case PushType.Double:
                byte[] b = BitConverter.GetBytes((double)Value);
                for (int i = 0; i < 4; i++)
                {
                    byte temp = b[i];
                    b[i]     = b[4 + i];
                    b[4 + i] = temp;
                }
                w.Write(b);
                break;

            case PushType.Int:
                w.Write((int)Value);
                break;

            case PushType.Constant8:
                w.Write(Convert.ToByte(Value));
                break;

            case PushType.Constant16:
                w.Write(Convert.ToUInt16(Value));
                break;
            }
        }
        /// <see cref="SwfOp.ByteCode.Actions.BaseAction.Compile"/>
        public override void Compile(BinaryWriter w)
        {
            w.Write(Convert.ToByte(Code));
            w.Write(Convert.ToUInt16(ByteCount - innerByteCount - 3));
            BinaryStringRW.WriteString(w, Name);

            w.Write(Convert.ToUInt16(ParameterList.Length));
            foreach (string str in ParameterList)
            {
                BinaryStringRW.WriteString(w, str);
            }

            w.Write(Convert.ToUInt16(innerByteCount));
            foreach (object a in ActionRecord)
            {
                BaseAction action = (BaseAction)a;
                action.Compile(w);
            }
        }
        /// <see cref="SwfOp.ByteCode.Actions.BaseAction.Compile"/>
        public override void Compile(BinaryWriter w)
        {
            w.Write(Convert.ToByte(Code));
            w.Write(Convert.ToUInt16(ByteCount - InnerByteCount - 3));
            BinaryStringRW.WriteString(w, Name);

            w.Write(Convert.ToUInt16(ParameterList.Length));
            w.Write(Convert.ToByte(RegisterCount));
            w.Write(flags.Bytecode);

            foreach (RegParamPair rp in ParameterList)
            {
                w.Write(Convert.ToByte(rp.Register));
                BinaryStringRW.WriteString(w, rp.Parameter);
            }

            w.Write(Convert.ToUInt16(InnerByteCount));

            foreach (object a in ActionRecord)
            {
                BaseAction action = (BaseAction)a;
                action.Compile(w);
            }
        }
 /// <see cref="SwfOp.ByteCode.Actions.BaseAction.Compile"/>
 public override void Compile(BinaryWriter w)
 {
     base.Compile(w);
     BinaryStringRW.WriteString(w, target);
 }