示例#1
0
        XElement IActionVisitor <XElement, XElement> .Visit(ActionTry action, XElement param)
        {
            var res = new XElement(XActionNames.FromAction(action));

            if (action.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", action.Reserved));
            }
            if (action.CatchInRegister)
            {
                res.Add(new XAttribute("catchReg", action.CatchRegister));
            }
            else
            {
                res.Add(new XAttribute("catchName", action.CatchName));
            }
            res.Add(XAction.ToXml(action.Try, new XElement("try")));
            if (action.CatchBlock)
            {
                res.Add(XAction.ToXml(action.Catch, new XElement("catch")));
            }
            if (action.FinallyBlock)
            {
                res.Add(XAction.ToXml(action.Finally, new XElement("finally")));
            }
            return(res);
        }
示例#2
0
        XElement IActionVisitor <XElement, XElement> .Visit(ActionDefineFunction action, XElement param)
        {
            var res = new XElement(XActionNames.FromAction(action));

            res.Add(new XAttribute("name", action.Name),
                    new XAttribute("argc", action.Args.Count)
                    );
            var args = new XElement("args");

            foreach (var arg in action.Args)
            {
                args.Add(new XElement("String", new XAttribute("value", arg)));
            }
            res.Add(args);

            if (action.Actions.Count > 0)
            {
                var xActions = new XElement("actions");
                foreach (var subaction in action.Actions)
                {
                    xActions.Add(XAction.ToXml(subaction));
                }
                res.Add(xActions);
            }
            return(res);
        }
示例#3
0
        XElement IActionVisitor <XElement, XElement> .Visit(ActionConstantPool action, XElement param)
        {
            var res     = new XElement(XActionNames.FromAction(action));
            var strings = new XElement("strings");

            foreach (var item in action.ConstantPool)
            {
                strings.Add(new XElement("String", new XAttribute("value", item)));
            }
            res.Add(strings);
            return(res);
        }
示例#4
0
        XElement IActionVisitor <XElement, XElement> .Visit(ActionGotoFrame2 action, XElement param)
        {
            var res = new XElement(XActionNames.FromAction(action),
                                   new XAttribute("play", CommonFormatter.Format(action.Play)));

            if (action.SceneBias.HasValue)
            {
                res.Add(new XAttribute("bias", action.SceneBias.Value));
            }
            if (action.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", action.Reserved));
            }
            return(res);
        }
示例#5
0
 public XElement Visit(ActionEnd action, XElement arg)
 {
     return(new XElement(XActionNames.FromAction(action)));
 }
示例#6
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionImplementsOp action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action)));
 }
示例#7
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionStoreRegister action, XElement arg)
 {
     return(new XElement(XActionNames.FromAction(action),
                         new XAttribute("reg", action.RegisterNumber)));
 }
示例#8
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionGetProperty action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action)));
 }
示例#9
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionGetURL2 action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action),
                         new XAttribute("flags", action.Flags)));
 }
示例#10
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionSetVariable action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action)));
 }
示例#11
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionJump action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action),
                         new XAttribute("byteOffset", FormatBranchOffset(action.BranchOffset))));
 }
示例#12
0
 XElement IActionVisitor <XElement, XElement> .Visit(ActionGotoFrame action, XElement param)
 {
     return(new XElement(XActionNames.FromAction(action), new XAttribute("frame", action.Frame)));
 }
示例#13
0
        /// <summary>
        /// Serializes action to xml node.
        /// </summary>
        /// <param name="action">Action to serialize.</param>
        /// <returns>Xml node representing action.</returns>
        public XElement Serialize(ActionBase action)
        {
            var xAction = new XElement(XActionNames.FromAction(action));

            return(action.AcceptVisitor(this, xAction));
        }