示例#1
0
 public IAction[] GetAllActionsFlat()
 {
     return(new IAction[] { ActionIf, ActionElse, Checker }
            .Union(ActionIf.GetAllActionsFlat())
            .Union(ActionElse.GetAllActionsFlat())
            .Union(Checker.GetAllActionsFlat())
            .ToArray());
 }
示例#2
0
        /// <summary>
        /// Read <see cref="SwfDotNet.IO.ByteCode.Actions.ActionIf">if</see> action from swf.
        /// </summary>
        private ActionIf ReadActionIf(BinaryReader br)
        {
            int      len = Convert.ToInt32(br.ReadInt16());
            Int16    o   = br.ReadInt16();
            ActionIf a   = new ActionIf(Convert.ToInt32(o));

            //a.ByteSize = len+3;
            return(a);
        }
示例#3
0
 public void SetValue(ExecutionContext context, string value)
 {
     if (Checker.Evaluate(context))
     {
         ActionIf.SetValue(context, string.Empty);
     }
     else
     {
         ActionElse.SetValue(context, string.Empty);
     }
 }
示例#4
0
        private void Walk(int index, IActionExaminer examiner, ArrayList visitedLabels)
        {
            while (index < actionRec.Count)
            {
                BaseAction a = (BaseAction)actionRec[index];

                if (a is ActionLabel)
                {
                    ActionLabel l = a as ActionLabel;
                    if (visitedLabels.Contains(l.LabelId))
                    {
                        //examiner.End();
                        return;
                    }
                    else
                    {
                        visitedLabels.Add(l.LabelId);
                    }
                }

                examiner.Examine(index, a);

                if (a is ActionJump)
                {
                    ActionJump j = a as ActionJump;
                    index = (int)labelIndexTable[j.LabelId] - 1;
                }

                if (a is ActionIf)
                {
                    ActionIf ai = a as ActionIf;
                    if (!visitedLabels.Contains(ai.LabelId))
                    {
                        Walk((int)labelIndexTable[ai.LabelId], examiner.Clone(), (ArrayList)visitedLabels.Clone());
                    }
                }

                if (a is ActionReturn)
                {
                    //examiner.End();
                    return;
                }

                index++;
            }

            //examiner.End();
        }
示例#5
0
 ActionBase IActionVisitor <XElement, ActionBase> .Visit(ActionIf action, XElement xAction)
 {
     action.BranchOffset = ParseBranchOffset(xAction.RequiredStringAttribute("byteOffset"));
     return(action);
 }
示例#6
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionIf action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action),
                         new XAttribute("byteOffset", FormatBranchOffset(action.BranchOffset))));
 }