SwfTagData ISwfTagVisitor <ISwfStreamWriter, SwfTagData> .Visit(DefineSceneAndFrameLabelDataTag tag, ISwfStreamWriter writer) { writer.WriteEncodedU32((uint)tag.Scenes.Count); foreach (var scene in tag.Scenes) { writer.WriteEncodedU32(scene.Offset); writer.WriteString(scene.Name); } writer.WriteEncodedU32((uint)tag.Frames.Count); foreach (var frame in tag.Frames) { writer.WriteEncodedU32(frame.FrameNumber); writer.WriteString(frame.Label); } return(null); }
SwfTagBase ISwfTagVisitor <ISwfStreamReader, SwfTagBase> .Visit(DefineSceneAndFrameLabelDataTag tag, ISwfStreamReader reader) { var scenesCount = reader.ReadEncodedU32(); for (var i = 0; i < scenesCount; i++) { var item = new SceneOffsetData { Offset = reader.ReadEncodedU32(), Name = reader.ReadString() }; tag.Scenes.Add(item); } var framesCount = reader.ReadEncodedU32(); for (var i = 0; i < framesCount; i++) { var item = new FrameLabelData { FrameNumber = reader.ReadEncodedU32(), Label = reader.ReadString() }; tag.Frames.Add(item); } return(tag); }
public static void AreEqual(DefineSceneAndFrameLabelDataTag expected, DefineSceneAndFrameLabelDataTag actual, string message) { AreEqual(expected.Scenes, actual.Scenes, message + ".Scenes"); AreEqual(expected.Frames, actual.Frames, message + ".Frames"); Assert.AreEqual(expected.RestData, actual.RestData); }
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)); } }
public static void AreEqual(DefineSceneAndFrameLabelDataTag expected, DefineSceneAndFrameLabelDataTag actual, string message) { AreEqual(expected.Scenes, actual.Scenes, message + ".Scenes"); AreEqual(expected.Frames, actual.Frames, message + ".Frames"); Assert.AreEqual(expected.RestData, actual.RestData); }
ITagFormatter ISwfTagVisitor <object, ITagFormatter> .Visit(DefineSceneAndFrameLabelDataTag tag, object arg) { return(new DefineSceneAndFrameLabelDataTagFormatter()); }
public SwfDisplayList Visit(DefineSceneAndFrameLabelDataTag tag, SwfDisplayList dl) { return(dl); }