Esempio n. 1
0
        public DefineFunction2(SwfReader r, ConstantPool cp)
        {
            this.cp      = cp;
            FunctionName = r.GetString();
            uint paramCount = r.GetUI16();

            RegisterCount = (uint)r.GetByte();

            Preloads = PreloadFlags.Empty;
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Parent;
            }
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Root;
            }

            SuppressSuperFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Super;
            }

            SuppressArgumentsFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Arguments;
            }

            SuppressThisFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.This;
            }

            r.GetBits(7);             // reserved

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Global;
            }

            for (int i = 0; i < paramCount; i++)
            {
                uint   reg  = r.GetByte();
                string name = r.GetString();
                Parameters.Add(reg, name);
            }
            CodeSize = r.GetUI16();
        }
Esempio n. 2
0
        public DefineFunction2(SwfReader r, ConstantPool cp)
        {
            this.cp = cp;
            FunctionName = r.GetString();
            uint paramCount = r.GetUI16();
            RegisterCount = (uint)r.GetByte();

            Preloads = PreloadFlags.Empty;
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Parent;
            }
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Root;
            }

            SuppressSuperFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Super;
            }

            SuppressArgumentsFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Arguments;
            }

            SuppressThisFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.This;
            }

            r.GetBits(7); // reserved

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Global;
            }

            for (int i = 0; i < paramCount; i++)
            {
                uint reg = r.GetByte();
                string name = r.GetString();
                Parameters.Add(reg, name);
            }
            CodeSize = r.GetUI16();
        }
Esempio n. 3
0
        public static string PreloadFlagToString(PreloadFlags flag)
        {
            string result;

            switch (flag)
            {
            case PreloadFlags.This:
                result = "this";
                break;

            case PreloadFlags.Arguments:
                result = "arguments";
                break;

            case PreloadFlags.Super:
                result = "super";
                break;

            case PreloadFlags.Root:
                result = "_root";
                break;

            case PreloadFlags.Parent:
                result = "_parent";
                break;

            case PreloadFlags.Global:
                result = "_global";
                break;

            default:
                result = "";
                break;
            }
            return(result);
        }
Esempio n. 4
0
 public static string PreloadFlagToString(PreloadFlags flag)
 {
     string result;
     switch (flag)
     {
         case PreloadFlags.This:
             result = "this";
             break;
         case PreloadFlags.Arguments:
             result = "arguments";
             break;
         case PreloadFlags.Super:
             result = "super";
             break;
         case PreloadFlags.Root:
             result = "_root";
             break;
         case PreloadFlags.Parent:
             result = "_parent";
             break;
         case PreloadFlags.Global:
             result = "_global";
             break;
         default:
             result = "";
             break;
     }
     return result;
 }