示例#1
0
        public static DefineSceneAndFrameLabelDataTag Create(SwfStreamReader reader)
        {
            var scene_count = reader.ReadEncodedU32();
            var scenes      = new List <SceneOffsetData>((int)scene_count);

            for (var i = 0; i < scene_count; ++i)
            {
                scenes.Add(new SceneOffsetData {
                    Offset = reader.ReadEncodedU32(),
                    Name   = reader.ReadString()
                });
            }
            var frame_count = reader.ReadEncodedU32();
            var frames      = new List <FrameLabelData>((int)frame_count);

            for (var i = 0; i < frame_count; ++i)
            {
                frames.Add(new FrameLabelData {
                    Number = reader.ReadEncodedU32(),
                    Label  = reader.ReadString()
                });
            }
            return(new DefineSceneAndFrameLabelDataTag {
                Scenes = scenes,
                Frames = frames
            });
        }
示例#2
0
        public static FrameLabelTag Create(SwfStreamReader reader)
        {
            var tag = new FrameLabelTag();

            tag.Name       = reader.ReadString();
            tag.AnchorFlag = reader.IsEOF ? (byte)0 : reader.ReadByte();
            return(tag);
        }
示例#3
0
        public static ProtectTag Create(SwfStreamReader reader)
        {
            var md5_password = reader.IsEOF
                                ? string.Empty
                                : reader.ReadString();

            return(new ProtectTag {
                MD5Password = md5_password
            });
        }
示例#4
0
        public static EnableDebuggerTag Create(SwfStreamReader reader)
        {
            var md5 = reader.IsEOF
                                ? string.Empty
                                : reader.ReadString();

            return(new EnableDebuggerTag {
                MD5PasswordHash = md5
            });
        }
示例#5
0
        public override string ReadString()
        {
            var a = _first.ReadString();
            var b = _second.ReadString();

            if (a != b)
            {
                throw new Exception(string.Format("a={0}, b={1}", a, b));
            }
            return(a);
        }
示例#6
0
        public static DoABCTag Create(SwfStreamReader reader)
        {
            const int kDoAbcLazyInitializeFlag = 1;
            var       flags     = reader.ReadUInt32();
            var       name      = reader.ReadString();
            var       abc_bytes = reader.ReadRest();

            return(new DoABCTag {
                ExecuteImmediately = (flags & kDoAbcLazyInitializeFlag) == 0,
                Name = name,
                ABCBytes = abc_bytes
            });
        }
示例#7
0
        public static ExportAssetsTag Create(SwfStreamReader reader)
        {
            var asset_tag_count = reader.ReadUInt16();
            var asset_tags      = new List <AssetTagData>(asset_tag_count);

            for (var i = 0; i < asset_tag_count; ++i)
            {
                asset_tags.Add(new AssetTagData {
                    Tag  = reader.ReadUInt16(),
                    Name = reader.ReadString()
                });
            }
            return(new ExportAssetsTag {
                AssetTags = asset_tags
            });
        }
示例#8
0
        public static SymbolClassTag Create(SwfStreamReader reader)
        {
            var symbol_tag_count = reader.ReadUInt16();
            var symbol_tags      = new List <SymbolTagData>(symbol_tag_count);

            for (var i = 0; i < symbol_tag_count; ++i)
            {
                symbol_tags.Add(new SymbolTagData {
                    Tag  = reader.ReadUInt16(),
                    Name = reader.ReadString()
                });
            }
            return(new SymbolClassTag {
                SymbolTags = symbol_tags
            });
        }
        public static PlaceObject2Tag Create(SwfStreamReader reader)
        {
            var tag = new PlaceObject2Tag();

            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();

            tag.CharacterId = tag.HasCharacter
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Matrix = tag.HasMatrix
                                ? SwfMatrix.Read(reader, false)
                                : SwfMatrix.identity;

            tag.ColorTransform = tag.HasColorTransform
                                ? SwfColorTransform.Read(reader, true)
                                : SwfColorTransform.identity;

            tag.Ratio = tag.HasRatio
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Name = tag.HasName
                                ? reader.ReadString()
                                : string.Empty;

            tag.ClipDepth = tag.HasClipDepth
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.ClipActions = tag.HasClipActions
                                ? SwfClipActions.Read(reader)
                                : SwfClipActions.identity;

            return(tag);
        }
示例#10
0
        public static PlaceObject3Tag Create(SwfStreamReader reader)
        {
            var tag = new PlaceObject3Tag();

            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();
            reader.ReadBit();             // reserved
            tag.OpaqueBackground = reader.ReadBit();
            tag.HasVisible       = reader.ReadBit();
            tag.HasImage         = reader.ReadBit();
            tag.HasClassName     = reader.ReadBit();
            tag.HasCacheAsBitmap = reader.ReadBit();
            tag.HasBlendMode     = reader.ReadBit();
            tag.HasFilterList    = reader.ReadBit();
            tag.Depth            = reader.ReadUInt16();

            tag.ClassName = tag.HasClassName
                                ? reader.ReadString()
                                : string.Empty;

            tag.CharacterId = tag.HasCharacter
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Matrix = tag.HasMatrix
                                ? SwfMatrix.Read(reader)
                                : SwfMatrix.identity;

            tag.ColorTransform = tag.HasColorTransform
                                ? SwfColorTransform.Read(reader, true)
                                : SwfColorTransform.identity;

            tag.Ratio = tag.HasRatio
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Name = tag.HasName
                                ? reader.ReadString()
                                : string.Empty;

            tag.ClipDepth = tag.HasClipDepth
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.SurfaceFilters = tag.HasFilterList
                                ? SwfSurfaceFilters.Read(reader)
                                : SwfSurfaceFilters.identity;

            tag.BlendMode = tag.HasBlendMode
                                ? SwfBlendMode.Read(reader)
                                : SwfBlendMode.identity;

            tag.BitmapCache = tag.HasCacheAsBitmap
                                ? (0 != reader.ReadByte())
                                : false;

            tag.Visible = tag.HasVisible && !reader.IsEOF
                                ? (0 != reader.ReadByte())
                                : true;

            tag.BackgroundColor = tag.HasVisible && !reader.IsEOF
                                ? SwfColor.Read(reader, true)
                                : SwfColor.identity;

            tag.ClipActions = tag.HasClipActions && !reader.IsEOF
                                ? SwfClipActions.Read(reader)
                                : SwfClipActions.identity;

            return(tag);
        }
示例#11
0
 public static MetadataTag Create(SwfStreamReader reader)
 {
     return(new MetadataTag {
         Metadata = reader.ReadString()
     });
 }