Beispiel #1
0
        ActionBase IActionVisitor <ushort, ActionBase> .Visit(ActionDefineFunction action, ushort length)
        {
            action.Name = _reader.ReadString();
            var args = _reader.ReadUInt16();

            for (var i = 0; i < args; i++)
            {
                action.Args.Add(_reader.ReadString());
            }
            var codeSize = _reader.ReadUInt16();
            var pos      = _reader.Position;

            while ((_reader.Position - pos) < codeSize)
            {
                var subaction = ReadAction();
                action.Actions.Add(subaction);
            }
            return(action);
        }
Beispiel #2
0
        object IActionVisitor <ISwfStreamWriter, object> .Visit(ActionDefineFunction action, ISwfStreamWriter writer)
        {
            writer.WriteString(action.Name ?? "");
            writer.WriteUInt16((ushort)action.Args.Count);
            foreach (var arg in action.Args)
            {
                writer.WriteString(arg);
            }
            var awmem = new MemoryStream();
            var aw    = new ActionWriter(new SwfStreamWriter(awmem));

            foreach (var subaction in action.Actions)
            {
                aw.WriteAction(subaction);
            }

            writer.WriteUInt16((ushort)awmem.Length);

            return(awmem.ToArray());
        }