Пример #1
0
 public void ToFlashAsm(IndentedTextWriter w)
 {
     w.WriteLine("function '" + FunctionName + "' " + ActionRecords.GetLabel((int)CodeSize));             // todo: function end code label
     ActionRecords.CurrentConstantPool = cp;
     for (int i = 0; i < Statements.Count; i++)
     {
         ActionRecords.AutoLineLabel(w);
         Statements[i].ToFlashAsm(w);
     }
 }
Пример #2
0
 public void Dump(IndentedTextWriter w)
 {
     w.WriteLine(Enum.GetName(typeof(ActionKind), this.ActionId));
     ActionRecords.CurrentConstantPool = cp;
     for (int i = 0; i < Statements.Count; i++)
     {
         ActionRecords.AutoLineLabel(w);
         Statements[i].Dump(w);
     }
 }
Пример #3
0
        public DefineButton(SwfReader r)
        {
            ButtonId = r.GetByte();
            while (r.PeekByte() != 0)
            {
                Characters.Add(new ButtonRecord(r, TagType.DefineButton));
            }
            r.GetByte();// 0, end ButtonRecords

            uint start = r.Position;

            ActionRecords          = new ActionRecords(r, int.MaxValue);
            ActionRecords.CodeSize = r.Position - start;
        }
Пример #4
0
        public ButtonCondAction(SwfReader r)
        {
            CondActionSize        = r.GetUI16();
            CondIdleToOverDown    = r.GetBit();
            CondOutDownToIdle     = r.GetBit();
            CondOutDownToOverDown = r.GetBit();
            CondOverDownToOutDown = r.GetBit();
            CondOverDownToOverUp  = r.GetBit();
            CondOverUpToOverDown  = r.GetBit();
            CondOverUpToIdle      = r.GetBit();
            CondIdleToOverUp      = r.GetBit();
            CondKeyPress          = r.GetBits(7);
            CondOverDownToIdle    = r.GetBit();

            uint start = r.Position;

            ActionRecords          = new ActionRecords(r, int.MaxValue);
            ActionRecords.CodeSize = r.Position - start;
        }
Пример #5
0
        public ClipActionRecord(SwfReader r, bool isSwf6Plus)
        {
            uint highClip    = r.GetBits(16) << 16;
            uint lowClip     = 0;
            bool isEndRecord = false;

            if (highClip == 0)
            {
                if (isSwf6Plus)
                {
                    lowClip = r.GetBits(16);
                    if (lowClip == 0)
                    {
                        ClipEvents       = (ClipEvents)0;
                        ActionRecordSize = 4;
                        isEndRecord      = true;
                    }
                }
                else
                {
                    ClipEvents       = (ClipEvents)0;
                    ActionRecordSize = 2;
                    isEndRecord      = true;
                }
            }
            else
            {
                lowClip = r.GetBits(16);
            }

            if (!isEndRecord)
            {
                ClipEvents       = (ClipEvents)(lowClip | highClip);
                ActionRecordSize = r.GetUI32();
                if ((ClipEvents & ClipEvents.KeyPress) > 0)
                {
                    KeyCode = r.GetByte();
                }
                ActionRecords = new ActionRecords(r, ActionRecordSize);                 // always is init tag?
            }
        }
Пример #6
0
        public void ToFlashAsm(IndentedTextWriter w)
        {
            w.Write("function2 '" + FunctionName + "' ");
            string comma = "";

            if (Parameters.Count > 0)
            {
                w.Write("(");
                foreach (KeyValuePair <uint, string> p in Parameters)
                {
                    w.Write(comma + "r:" + p.Key + "='" + p.Value + "'");
                    comma = ", ";
                }
                w.Write(") ");
            }

            if (Preloads != PreloadFlags.Empty)
            {
                // in the order: this, arguments, super, _root, _parent, _global
                uint regIndex = 1;
                comma = "";

                w.Write("(");
                int pl = (int)Preloads;
                for (int i = 1; i < (int)PreloadFlags.End; i *= 2)
                {
                    if ((i & pl) != 0)
                    {
                        w.Write(comma + "r:" + regIndex++ + "=" + PreloadFlagToString((PreloadFlags)i) + " ");
                        comma = ", ";
                    }
                }
                //if ((PreloadFlags)(Preloads & PreloadFlags.This) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=this ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Arguments) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=arguments ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Super) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=super ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Root) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=_root ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Parent) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=_parent ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Global) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=_global ");
                //    comma = ", ";
                //}
                w.Write(") ");
            }

            w.Write(ActionRecords.GetLabel((int)CodeSize) + " ");
            w.WriteLine("maxreg=" + RegisterCount);

            ActionRecords.CurrentConstantPool = cp;
            for (int i = 0; i < Statements.Count; i++)
            {
                ActionRecords.AutoLineLabel(w);
                Statements[i].ToFlashAsm(w);
            }
        }
Пример #7
0
 public DoActionTag(SwfReader r, uint tagLen, bool isInitTag)
 {
     this.isInitTag = isInitTag;
     ActionRecords  = new ActionRecords(r, tagLen, isInitTag);
 }
Пример #8
0
 public DoActionTag()
 {
     ActionRecords = new ActionRecords();
 }
Пример #9
0
 public void ToFlashAsm(IndentedTextWriter w)
 {
     w.WriteLine("branch " + ActionRecords.GetLabel(BranchOffset));
 }
Пример #10
0
 public void ToFlashAsm(IndentedTextWriter w)
 {
     w.WriteLine("branchiftrue " + ActionRecords.GetLabel(BranchOffset));             // todo: add label logic to if's
 }