public IAction[] GetAllActionsFlat() { return(new IAction[] { ActionIf, ActionElse, Checker } .Union(ActionIf.GetAllActionsFlat()) .Union(ActionElse.GetAllActionsFlat()) .Union(Checker.GetAllActionsFlat()) .ToArray()); }
/// <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); }
public void SetValue(ExecutionContext context, string value) { if (Checker.Evaluate(context)) { ActionIf.SetValue(context, string.Empty); } else { ActionElse.SetValue(context, string.Empty); } }
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(); }
ActionBase IActionVisitor <XElement, ActionBase> .Visit(ActionIf action, XElement xAction) { action.BranchOffset = ParseBranchOffset(xAction.RequiredStringAttribute("byteOffset")); return(action); }
XElement IActionVisitor <XElement, XElement> .Visit(ActionIf action, XElement param) { return(new XElement(XActionNames.FromAction(action), new XAttribute("byteOffset", FormatBranchOffset(action.BranchOffset)))); }