Exemplo n.º 1
0
        ActionBase IActionVisitor <ushort, ActionBase> .Visit(ActionPush action, ushort length)
        {
            var position = _reader.Position;

            while (_reader.Position - position < length)
            {
                var item = new ActionPushItem();
                var type = (ActionPushItemType)_reader.ReadByte();
                item.Type = type;
                switch (type)
                {
                case ActionPushItemType.String:
                    item.String = _reader.ReadString();
                    break;

                case ActionPushItemType.Float:
                    item.Float = _reader.ReadSingle();
                    break;

                case ActionPushItemType.Null:
                    break;

                case ActionPushItemType.Undefined:
                    break;

                case ActionPushItemType.Register:
                    item.Register = _reader.ReadByte();
                    break;

                case ActionPushItemType.Boolean:
                    item.Boolean = _reader.ReadByte();
                    break;

                case ActionPushItemType.Double:
                    item.Double = _reader.ReadDouble();
                    break;

                case ActionPushItemType.Integer:
                    item.Integer = _reader.ReadInt32();
                    break;

                case ActionPushItemType.Constant8:
                    item.Constant8 = _reader.ReadByte();
                    break;

                case ActionPushItemType.Constant16:
                    item.Constant16 = _reader.ReadUInt16();
                    break;

                default:
                    throw new NotSupportedException("Unknown PushData type " + type);
                }
                action.Items.Add(item);
            }
            return(action);
        }
Exemplo n.º 2
0
        public static SwfTagData ReadTagData(this ISwfStreamReader reader)
        {
            var typeAndSize = reader.ReadUInt16();
            var type        = (SwfTagType)(typeAndSize >> 6);
            var shortSize   = typeAndSize & 0x3f;
            var size        = shortSize < 0x3f ? shortSize : reader.ReadInt32();
            var tagData     = reader.ReadBytes(size);

            return(new SwfTagData {
                Type = type, Data = tagData
            });
        }