예제 #1
0
        /*
         * /// <summary>
         * /// Read and parse JpegTableTag
         * /// </summary>
         * protected JpegTableTag ReadJpegTableTag() {
         *
         *      RecordHeader rh = ReadRecordHeader();
         *      int tl = rh.TagLength;
         *      byte[] data = br.ReadBytes(tl);
         *
         *      return new JpegTableTag(data);
         * }
         *
         * /// <summary>
         * /// Read and parse DefineBitsTag
         * /// </summary>
         * protected DefineBitsTag ReadDefineBitsTag() {
         *
         *      RecordHeader rh = ReadRecordHeader();
         *      int tl = rh.TagLength;
         *      ushort id = br.ReadUInt16();
         *      byte[] data = br.ReadBytes(tl-2);
         *      return new DefineBitsTag(id,data);
         * }
         *
         * /// <summary>
         * /// Read and parse DefineBitsJpeg2Tag
         * /// </summary>
         * protected DefineBitsJpeg2Tag ReadDefineBitsJpeg2Tag() {
         *
         *      RecordHeader rh = ReadRecordHeader();
         *      int tl = rh.TagLength;
         *      ushort id = br.ReadUInt16();
         *      byte[] data = br.ReadBytes(tl-2);
         *      return new DefineBitsJpeg2Tag(id,data);
         * }
         *
         * /// <summary>
         * /// Read and parse DefineBitsJpeg3Tag
         * /// </summary>
         * protected DefineBitsJpeg3Tag ReadDefineBitsJpeg3Tag() {
         *
         *      RecordHeader rh = ReadRecordHeader();
         *      int tl = rh.TagLength;
         *      ushort id = br.ReadUInt16();
         *      int imgLen = Convert.ToInt32(br.ReadUInt32());
         *      byte[] img = br.ReadBytes(imgLen);
         *      byte[] alpha = br.ReadBytes(tl-6-imgLen);
         *
         *      return new DefineBitsJpeg3Tag(id,img,alpha);
         * }
         */
        /// <summary>
        /// Read tag from swf input stream, non-bytecode tags are reads into base tags and wont get parsed
        /// </summary>
        virtual protected BaseTag ReadTag()
        {
            long         posBefore = br.BaseStream.Position;
            RecordHeader rh        = ReadRecordHeader();
            int          offset    = (int)(br.BaseStream.Position - posBefore);

            br.BaseStream.Position = posBefore;
            switch (rh.TagCode)
            {
            case (int)TagCodeEnum.DefineSprite: return(this.ReadDefineSpriteTag());

            case (int)TagCodeEnum.DoAction: return(this.ReadDoActionTag());

            case (int)TagCodeEnum.InitAction: return(this.ReadInitActionTag());

            case (int)TagCodeEnum.ScriptLimit: return(this.ReadScriptLimitTag());

            case (int)TagCodeEnum.PlaceObject2:

                PlaceObject2Tag p = this.ReadPlaceObject2Tag();
                if (p == null)
                {
                    br.BaseStream.Position = posBefore;
                    return(new BaseTag(br.ReadBytes(rh.TagLength + offset)));
                }
                else
                {
                    return(p);
                }

            default: return(new BaseTag(br.ReadBytes(rh.TagLength + offset)));
            }
        }
        public SwfDisplayList Visit(PlaceObject2Tag tag, SwfDisplayList dl)
        {
            var is_shape  = tag.HasCharacter && Library.HasDefine <SwfLibraryShapeDefine>(tag.CharacterId);
            var is_sprite = tag.HasCharacter && Library.HasDefine <SwfLibrarySpriteDefine>(tag.CharacterId);

            if (tag.HasCharacter)
            {
                SwfDisplayInstance old_inst = null;
                if (tag.Move)                     // replace character
                {
                    if (dl.Instances.TryGetValue(tag.Depth, out old_inst))
                    {
                        dl.Instances.Remove(tag.Depth);
                    }
                }
                // new character
                SwfDisplayInstance new_inst = null;
                if (is_shape)
                {
                    new_inst = new SwfDisplayShapeInstance();
                }
                else if (is_sprite)
                {
                    new_inst = new SwfDisplaySpriteInstance();
                }
                if (new_inst != null)
                {
                    new_inst.Id             = tag.CharacterId;
                    new_inst.Depth          = tag.Depth;
                    new_inst.ClipDepth      = tag.HasClipDepth      ? tag.ClipDepth      : (old_inst != null ? old_inst.ClipDepth      : (ushort)0);
                    new_inst.Visible        = true;
                    new_inst.Matrix         = tag.HasMatrix         ? tag.Matrix         : (old_inst != null ? old_inst.Matrix         : SwfMatrix.identity);
                    new_inst.BlendMode      = SwfBlendMode.identity;
                    new_inst.FilterList     = SwfSurfaceFilters.identity;
                    new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity);
                    dl.Instances.Add(new_inst.Depth, new_inst);
                }
            }
            else if (tag.Move)                   // move character
            {
                SwfDisplayInstance inst;
                if (dl.Instances.TryGetValue(tag.Depth, out inst))
                {
                    if (tag.HasClipDepth)
                    {
                        inst.ClipDepth = tag.ClipDepth;
                    }
                    if (tag.HasMatrix)
                    {
                        inst.Matrix = tag.Matrix;
                    }
                    if (tag.HasColorTransform)
                    {
                        inst.ColorTransform = tag.ColorTransform;
                    }
                }
            }
            return(dl);
        }
예제 #3
0
 public static Point ToPoint(this PlaceObject2Tag tag)
 {
     return(tag != null
         ? new Point(
                (int)Math.Floor(tag.Matrix.TranslateX / 20),
                (int)Math.Floor(tag.Matrix.TranslateY / 20))
         : default(Point));
 }
예제 #4
0
 public static void AreEqual(PlaceObject2Tag expected, PlaceObject2Tag actual)
 {
     Assert.AreEqual(expected.CharacterID, actual.CharacterID);
     Assert.AreEqual(expected.Depth, actual.Depth);
     AssertData.AreEqual(expected.Matrix, actual.Matrix, "Matrix");
     Assert.AreEqual(expected.HasColorTransform, actual.HasColorTransform, "HasColorTransform");
     AssertData.AreEqual(expected.ColorTransform, actual.ColorTransform, "ColorTransform");
     Assert.AreEqual(expected.RestData, actual.RestData);
 }
예제 #5
0
 public static void AreEqual(PlaceObject2Tag expected, PlaceObject2Tag actual)
 {
     Assert.AreEqual(expected.CharacterID, actual.CharacterID);
     Assert.AreEqual(expected.Depth, actual.Depth);
     AssertData.AreEqual(expected.Matrix, actual.Matrix, "Matrix");
     Assert.AreEqual(expected.HasColorTransform, actual.HasColorTransform, "HasColorTransform");
     AssertData.AreEqual(expected.ColorTransform, actual.ColorTransform, "ColorTransform");
     Assert.AreEqual(expected.RestData, actual.RestData);
 }
예제 #6
0
 public static Point ToPoint(this PlaceObject2Tag tag)
 {
     return(tag != null
            // 31-4 の No.5 と No.14 のように座標が微妙にずれて設定されてることがあるのでとりあえず丸め
         ? new Point(
                (int)Math.Floor(tag.Matrix.TranslateX / 20) / 2 * 2,
                (int)Math.Floor(tag.Matrix.TranslateY / 20) / 2 * 2)
         : default(Point));
 }
예제 #7
0
        SwfTagBase ISwfTagVisitor <ISwfStreamReader, SwfTagBase> .Visit(PlaceObject2Tag tag, ISwfStreamReader reader)
        {
            tag.HasClipActions    = reader.ReadBit();
            tag.HasClipDepth      = reader.ReadBit();
            tag.HasName           = reader.ReadBit();
            tag.HasRatio          = reader.ReadBit();
            tag.HasColorTransform = reader.ReadBit();
            tag.HasMatrix         = reader.ReadBit();
            tag.HasCharacter      = reader.ReadBit();
            tag.Move = reader.ReadBit();

            tag.Depth = reader.ReadUInt16();
            if (tag.HasCharacter)
            {
                tag.CharacterID = reader.ReadUInt16();
            }
            if (tag.HasMatrix)
            {
                tag.Matrix = reader.ReadMatrix();
            }
            if (tag.HasColorTransform)
            {
                tag.ColorTransform = reader.ReadColorTransformRGBA();
            }
            if (tag.HasRatio)
            {
                tag.Ratio = reader.ReadUInt16();
            }
            if (tag.HasName)
            {
                tag.Name = reader.ReadString();
            }
            if (tag.HasClipDepth)
            {
                tag.ClipDepth = reader.ReadUInt16();
            }
            if (tag.HasClipActions)
            {
                reader.ReadClipActions(_file.FileInfo.Version, tag.ClipActions);
            }
            return(tag);
        }
예제 #8
0
 SwfTagData ISwfTagVisitor <ISwfStreamWriter, SwfTagData> .Visit(PlaceObject2Tag tag, ISwfStreamWriter writer)
 {
     writer.WriteBit(tag.HasClipActions);
     writer.WriteBit(tag.HasClipDepth);
     writer.WriteBit(tag.HasName);
     writer.WriteBit(tag.HasRatio);
     writer.WriteBit(tag.HasColorTransform);
     writer.WriteBit(tag.HasMatrix);
     writer.WriteBit(tag.HasCharacter);
     writer.WriteBit(tag.Move);
     writer.WriteUInt16(tag.Depth);
     if (tag.HasCharacter)
     {
         writer.WriteUInt16(tag.CharacterID);
     }
     if (tag.HasMatrix)
     {
         writer.WriteMatrix(ref tag.Matrix);
     }
     if (tag.HasColorTransform)
     {
         writer.WriteColorTransformRGBA(tag.ColorTransform);
     }
     if (tag.HasRatio)
     {
         writer.WriteUInt16(tag.Ratio);
     }
     if (tag.HasName)
     {
         writer.WriteString(tag.Name);
     }
     if (tag.HasClipDepth)
     {
         writer.WriteUInt16(tag.ClipDepth);
     }
     if (tag.HasClipActions)
     {
         writer.WriteClipActions(_file.FileInfo.Version, tag.ClipActions);
     }
     return(null);
 }
예제 #9
0
 public static Point ToPoint(this PlaceObject2Tag tag)
 {
     return(new Point(tag.Matrix.TranslateX / 20, tag.Matrix.TranslateY / 20));
 }
예제 #10
0
        /// <summary>
        /// Read tag from swf input stream, non-bytecode tags are reads into base tags and wont get parsed
        /// </summary>
        virtual protected BaseTag ReadTag()
        {
            long         posBefore = br.BaseStream.Position;
            RecordHeader rh        = ReadRecordHeader();
            int          offset    = (int)(br.BaseStream.Position - posBefore);

            br.BaseStream.Position = posBefore;
            switch (rh.TagCode)
            {
            case (int)TagCodeEnum.DefineSprite: return(this.ReadDefineSpriteTag());

            case (int)TagCodeEnum.DoAction: return(this.ReadDoActionTag());

            case (int)TagCodeEnum.InitAction: return(this.ReadInitActionTag());

            case (int)TagCodeEnum.ScriptLimit: return(this.ReadScriptLimitTag());

            case (int)TagCodeEnum.PlaceObject2:

                PlaceObject2Tag p = this.ReadPlaceObject2Tag();
                if (p == null)
                {
                    br.BaseStream.Position = posBefore;
                    return(new BaseTag(br.ReadBytes(rh.TagLength + offset)));
                }
                else
                {
                    return(p);
                }

            case (int)TagCodeEnum.DefineBits:
            case (int)TagCodeEnum.DefineBitsLossless:
            case (int)TagCodeEnum.DefineBitsLossless2:
                return(ReadDefineBitsTag());

            case (int)TagCodeEnum.DefineBitsJpeg2:
                return(ReadDefineBitsJpeg2Tag());

            case (int)TagCodeEnum.DefineBitsJpeg3:
                return(ReadDefineBitsJpeg3Tag());

            case (int)TagCodeEnum.DefineSound:
                return(ReadDefineSoundTag());

            case (int)TagCodeEnum.ExportAssets:
            case (int)TagCodeEnum.SymbolClass:
                return(ReadExportTag(offset));

            case (int)TagCodeEnum.DefineFont2:
            case (int)TagCodeEnum.DefineFont3:
                return(new DefineFontTag(br.ReadBytes(rh.TagLength + offset), offset, rh.TagCode));

            /*case 63:
             *  // Dump tag
             *  br.BaseStream.Position += offset;
             *  byte b;
             *  for (int i = 0; i < rh.TagLength; i++)
             *  {
             *      b = br.ReadByte();
             *      Console.Write((b >= 32) ? ((char)b).ToString() : b.ToString());
             *  }
             *  br.BaseStream.Position = posBefore;
             *  return new BaseTag(br.ReadBytes(rh.TagLength + offset));*/

            default:
                return(new BaseTag(br.ReadBytes(rh.TagLength + offset), rh.TagCode));
            }
        }
예제 #11
0
        static SwfTagBase Create(SwfTagData tag_data)
        {
            var reader = new SwfStreamReader(tag_data.TagData);

            switch (tag_data.TagId)
            {
            // Display list
            case (int)SwfTagType.PlaceObject:                  return(PlaceObjectTag.Create(reader));

            case (int)SwfTagType.PlaceObject2:                 return(PlaceObject2Tag.Create(reader));

            case (int)SwfTagType.PlaceObject3:                 return(PlaceObject3Tag.Create(reader));

            case (int)SwfTagType.RemoveObject:                 return(RemoveObjectTag.Create(reader));

            case (int)SwfTagType.RemoveObject2:                return(RemoveObject2Tag.Create(reader));

            case (int)SwfTagType.ShowFrame:                    return(ShowFrameTag.Create(reader));

            // Control
            case (int)SwfTagType.SetBackgroundColor:           return(SetBackgroundColorTag.Create(reader));

            case (int)SwfTagType.FrameLabel:                   return(FrameLabelTag.Create(reader));

            case (int)SwfTagType.Protect:                      return(ProtectTag.Create(reader));

            case (int)SwfTagType.End:                          return(EndTag.Create(reader));

            case (int)SwfTagType.ExportAssets:                 return(ExportAssetsTag.Create(reader));

            case (int)SwfTagType.ImportAssets:                 return(UnsupportedTag.Create(SwfTagType.ImportAssets));

            case (int)SwfTagType.EnableDebugger:               return(EnableDebuggerTag.Create(reader));

            case (int)SwfTagType.EnableDebugger2:              return(EnableDebugger2Tag.Create(reader));

            case (int)SwfTagType.ScriptLimits:                 return(ScriptLimitsTag.Create(reader));

            case (int)SwfTagType.SetTabIndex:                  return(UnsupportedTag.Create(SwfTagType.SetTabIndex));

            case (int)SwfTagType.ImportAssets2:                return(UnsupportedTag.Create(SwfTagType.ImportAssets2));

            case (int)SwfTagType.SymbolClass:                  return(SymbolClassTag.Create(reader));

            case (int)SwfTagType.Metadata:                     return(MetadataTag.Create(reader));

            case (int)SwfTagType.DefineScalingGrid:            return(UnsupportedTag.Create(SwfTagType.DefineScalingGrid));

            case (int)SwfTagType.DefineSceneAndFrameLabelData: return(DefineSceneAndFrameLabelDataTag.Create(reader));

            // Actions
            case (int)SwfTagType.DoAction:                     return(UnsupportedTag.Create(SwfTagType.DoAction));

            case (int)SwfTagType.DoInitAction:                 return(UnsupportedTag.Create(SwfTagType.DoInitAction));

            case (int)SwfTagType.DoABC:                        return(DoABCTag.Create(reader));

            // Shape
            case (int)SwfTagType.DefineShape:                  return(DefineShapeTag.Create(reader));

            case (int)SwfTagType.DefineShape2:                 return(DefineShape2Tag.Create(reader));

            case (int)SwfTagType.DefineShape3:                 return(DefineShape3Tag.Create(reader));

            case (int)SwfTagType.DefineShape4:                 return(DefineShape4Tag.Create(reader));

            // Bitmaps
            case (int)SwfTagType.DefineBits:                   return(UnsupportedTag.Create(SwfTagType.DefineBits));

            case (int)SwfTagType.JPEGTables:                   return(UnsupportedTag.Create(SwfTagType.JPEGTables));

            case (int)SwfTagType.DefineBitsJPEG2:              return(UnsupportedTag.Create(SwfTagType.DefineBitsJPEG2));

            case (int)SwfTagType.DefineBitsJPEG3:              return(UnsupportedTag.Create(SwfTagType.DefineBitsJPEG3));

            case (int)SwfTagType.DefineBitsLossless:           return(DefineBitsLosslessTag.Create(reader));

            case (int)SwfTagType.DefineBitsLossless2:          return(DefineBitsLossless2Tag.Create(reader));

            case (int)SwfTagType.DefineBitsJPEG4:              return(UnsupportedTag.Create(SwfTagType.DefineBitsJPEG4));

            // Shape Morphing
            case (int)SwfTagType.DefineMorphShape:             return(UnsupportedTag.Create(SwfTagType.DefineMorphShape));

            case (int)SwfTagType.DefineMorphShape2:            return(UnsupportedTag.Create(SwfTagType.DefineMorphShape2));

            // Fonts and Text
            case (int)SwfTagType.DefineFont:                   return(UnsupportedTag.Create(SwfTagType.DefineFont));

            case (int)SwfTagType.DefineFontInfo:               return(UnsupportedTag.Create(SwfTagType.DefineFontInfo));

            case (int)SwfTagType.DefineFontInfo2:              return(UnsupportedTag.Create(SwfTagType.DefineFontInfo2));

            case (int)SwfTagType.DefineFont2:                  return(UnsupportedTag.Create(SwfTagType.DefineFont2));

            case (int)SwfTagType.DefineFont3:                  return(UnsupportedTag.Create(SwfTagType.DefineFont3));

            case (int)SwfTagType.DefineFontAlignZones:         return(UnsupportedTag.Create(SwfTagType.DefineFontAlignZones));

            case (int)SwfTagType.DefineFontName:               return(UnsupportedTag.Create(SwfTagType.DefineFontName));

            case (int)SwfTagType.DefineText:                   return(UnsupportedTag.Create(SwfTagType.DefineText));

            case (int)SwfTagType.DefineText2:                  return(UnsupportedTag.Create(SwfTagType.DefineText2));

            case (int)SwfTagType.DefineEditText:               return(UnsupportedTag.Create(SwfTagType.DefineEditText));

            case (int)SwfTagType.CSMTextSettings:              return(UnsupportedTag.Create(SwfTagType.CSMTextSettings));

            case (int)SwfTagType.DefineFont4:                  return(UnsupportedTag.Create(SwfTagType.DefineFont4));

            // Sounds
            case (int)SwfTagType.DefineSound:                  return(UnsupportedTag.Create(SwfTagType.DefineSound));

            case (int)SwfTagType.StartSound:                   return(UnsupportedTag.Create(SwfTagType.StartSound));

            case (int)SwfTagType.StartSound2:                  return(UnsupportedTag.Create(SwfTagType.StartSound2));

            case (int)SwfTagType.SoundStreamHead:              return(UnsupportedTag.Create(SwfTagType.SoundStreamHead));

            case (int)SwfTagType.SoundStreamHead2:             return(UnsupportedTag.Create(SwfTagType.SoundStreamHead2));

            case (int)SwfTagType.SoundStreamBlock:             return(UnsupportedTag.Create(SwfTagType.SoundStreamBlock));

            // Buttons
            case (int)SwfTagType.DefineButton:                 return(UnsupportedTag.Create(SwfTagType.DefineButton));

            case (int)SwfTagType.DefineButton2:                return(UnsupportedTag.Create(SwfTagType.DefineButton2));

            case (int)SwfTagType.DefineButtonCxform:           return(UnsupportedTag.Create(SwfTagType.DefineButtonCxform));

            case (int)SwfTagType.DefineButtonSound:            return(UnsupportedTag.Create(SwfTagType.DefineButtonSound));

            // Sprites and Movie Clips
            case (int)SwfTagType.DefineSprite:                 return(DefineSpriteTag.Create(reader));

            // Video
            case (int)SwfTagType.DefineVideoStream:            return(UnsupportedTag.Create(SwfTagType.DefineVideoStream));

            case (int)SwfTagType.VideoFrame:                   return(UnsupportedTag.Create(SwfTagType.VideoFrame));

            // Metadata
            case (int)SwfTagType.FileAttributes:               return(FileAttributesTag.Create(reader));

            case (int)SwfTagType.EnableTelemetry:              return(EnableTelemetryTag.Create(reader));

            case (int)SwfTagType.DefineBinaryData:             return(DefineBinaryDataTag.Create(reader));

            default:                                           return(UnknownTag.Create(tag_data.TagId));
            }
        }
예제 #12
0
        /// <summary>
        /// Read next tag from swf input stream.
        /// </summary>
        /// <param name="version">Version.</param>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="tagList">Tag list.</param>
        /// <returns></returns>
        internal static BaseTag ReadTag(byte version, BufferedBinaryReader binaryReader, BaseTagCollection tagList)
        {
            long         posBefore = binaryReader.BaseStream.Position;
            RecordHeader rh        = new RecordHeader();

            rh.ReadData(binaryReader);

            int offset = (int)(binaryReader.BaseStream.Position - posBefore);

            binaryReader.BaseStream.Position = posBefore;

            BaseTag resTag = null;

            switch (rh.TagCode)
            {
            case (int)TagCodeEnum.DefineBits: resTag = new DefineBitsTag(); break;

            case (int)TagCodeEnum.DefineBitsJpeg2: resTag = new DefineBitsJpeg2Tag(); break;

            case (int)TagCodeEnum.DefineBitsJpeg3: resTag = new DefineBitsJpeg3Tag(); break;

            case (int)TagCodeEnum.DefineBitsLossLess: resTag = new DefineBitsLossLessTag(); break;

            case (int)TagCodeEnum.DefineBitsLossLess2: resTag = new DefineBitsLossLess2Tag(); break;

            case (int)TagCodeEnum.DefineButton: resTag = new DefineButtonTag(); break;

            case (int)TagCodeEnum.DefineButton2: resTag = new DefineButton2Tag(); break;

            case (int)TagCodeEnum.DefineButtonCxForm: resTag = new DefineButtonCxFormTag(); break;

            case (int)TagCodeEnum.DefineButtonSound: resTag = new DefineButtonSoundTag(); break;

            case (int)TagCodeEnum.DefineEditText: resTag = new DefineEditTextTag(); break;

            case (int)TagCodeEnum.DefineFont: resTag = new DefineFontTag(); break;

            case (int)TagCodeEnum.DefineFont2: resTag = new DefineFont2Tag(); break;

            case (int)TagCodeEnum.DefineFontInfo: resTag = new DefineFontInfoTag(); break;

            case (int)TagCodeEnum.DefineFontInfo2: resTag = new DefineFontInfo2Tag(); break;

            case (int)TagCodeEnum.DefineMorphShape: resTag = new DefineMorphShapeTag(); break;

            case (int)TagCodeEnum.DefineShape: resTag = new DefineShapeTag(); break;

            case (int)TagCodeEnum.DefineShape2: resTag = new DefineShape2Tag(); break;

            case (int)TagCodeEnum.DefineShape3: resTag = new DefineShape3Tag(); break;

            case (int)TagCodeEnum.DefineSound: resTag = new DefineSoundTag(); break;

            case (int)TagCodeEnum.DefineSprite: resTag = new DefineSpriteTag(); break;

            case (int)TagCodeEnum.DefineText: resTag = new DefineTextTag(); break;

            case (int)TagCodeEnum.DefineText2: resTag = new DefineText2Tag(); break;

            case (int)TagCodeEnum.DefineVideoStream: resTag = new DefineVideoStreamTag(); break;

            case (int)TagCodeEnum.DoAction: resTag = new DoActionTag(); break;

            case (int)TagCodeEnum.EnableDebugger: resTag = new EnableDebuggerTag(); break;

            case (int)TagCodeEnum.EnableDebugger2: resTag = new EnableDebugger2Tag(); break;

            case (int)TagCodeEnum.End: resTag = new EndTag(); break;

            case (int)TagCodeEnum.ExportAssets: resTag = new ExportAssetsTag(); break;

            case (int)TagCodeEnum.FrameLabel: resTag = new FrameLabelTag(); break;

            case (int)TagCodeEnum.ImportAssets: resTag = new ImportAssetsTag(); break;

            case (int)TagCodeEnum.InitAction: resTag = new InitActionTag(); break;

            case (int)TagCodeEnum.JpegTable: resTag = new JpegTableTag(); break;

            case (int)TagCodeEnum.PlaceObject: resTag = new PlaceObjectTag(); break;

            case (int)TagCodeEnum.PlaceObject2:     resTag = new PlaceObject2Tag(); break;

            case (int)TagCodeEnum.Protect: resTag = new ProtectTag(); break;

            case (int)TagCodeEnum.RemoveObject: resTag = new RemoveObjectTag(); break;

            case (int)TagCodeEnum.RemoveObject2: resTag = new RemoveObject2Tag(); break;

            case (int)TagCodeEnum.ScriptLimit: resTag = new ScriptLimitTag(); break;

            case (int)TagCodeEnum.SetBackgroundColor: resTag = new SetBackgroundColorTag(); break;

            case (int)TagCodeEnum.SetTabIndex: resTag = new SetTabIndexTag(); break;

            case (int)TagCodeEnum.ShowFrame: resTag = new ShowFrameTag(); break;

            case (int)TagCodeEnum.SoundStreamBlock: resTag = new SoundStreamBlockTag(); break;

            case (int)TagCodeEnum.SoundStreamHead: resTag = new SoundStreamHeadTag(); break;

            case (int)TagCodeEnum.SoundStreamHead2: resTag = new SoundStreamHead2Tag(); break;

            case (int)TagCodeEnum.StartSound: resTag = new StartSoundTag(); break;

            case (int)TagCodeEnum.Metadata: resTag = new MetadataTag(); break;

            case (int)TagCodeEnum.SymbolClass: resTag = new SymbolClassTag(); break;

            //TODO: Sorenson Codec
            case (int)TagCodeEnum.VideoFrame: resTag = ReadVideoFrameTag(binaryReader, tagList); break;

            default: resTag = new BaseTag(binaryReader.ReadBytes(System.Convert.ToInt32(rh.TagLength + offset)), rh.TagCode); break;
            }

            //Read the data of the current tag
            resTag.ReadData(version, binaryReader);

            //LOG
            long mustRead = rh.TagLength + offset;

            if (posBefore + mustRead != binaryReader.BaseStream.Position)
            {
                binaryReader.BaseStream.Position = posBefore + rh.TagLength + offset;
                if (log.IsErrorEnabled)
                {
                    log.Error(Enum.GetName(TagCodeEnum.DefineBits.GetType(), rh.TagCode) + "....KO");
                }
            }
            else if (log.IsInfoEnabled)
            {
                log.Info(Enum.GetName(TagCodeEnum.DefineBits.GetType(), rh.TagCode) + "....OK (" + mustRead + ")");
            }

            return(resTag);
        }
예제 #13
0
 ITagFormatter ISwfTagVisitor <object, ITagFormatter> .Visit(PlaceObject2Tag tag, object arg)
 {
     return(new PlaceObject2TagFormatter());
 }