示例#1
0
 internal DefineFontName(SwfReader r)
     : base(TagType.DefineFontName)
 {
     FontID        = r.GetUI16();
     FontName      = r.GetString();
     FontCopyright = r.GetString();
 }
示例#2
0
        internal DefineFunction2(SwfReader r, ConstantPool cp)
        {
            this.cp      = cp;
            FunctionName = r.GetString();
            uint paramCount = r.GetUI16();

            RegisterCount = (uint)r.GetByte();

            Preloads = PreloadFlags.Empty;
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Parent;
            }
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Root;
            }

            SuppressSuperFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Super;
            }

            SuppressArgumentsFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Arguments;
            }

            SuppressThisFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.This;
            }

            r.GetBits(7);             // reserved

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Global;
            }

            for (int i = 0; i < paramCount; i++)
            {
                uint   reg  = r.GetByte();
                string name = r.GetString();
                Parameters.Add(reg, name);
            }
            ActionContainer.CodeSize = r.GetUI16();
        }
示例#3
0
        internal DefineFunction(SwfReader r, ConstantPool cp)
        {
            this.cp      = cp;
            FunctionName = r.GetString();
            uint paramCount = r.GetUI16();

            Params = new string[paramCount];
            for (int i = 0; i < paramCount; i++)
            {
                Params[i] = r.GetString();
            }

            CodeSize = r.GetUI16();
        }
示例#4
0
        internal DefineEditTextTag(SwfReader r)
            : base(TagType.DefineEditText)
        {
            CharacterID = r.GetUI16();
            Bounds      = new Rect(r);

            HasText      = r.GetBit();
            WordWrap     = r.GetBit();
            Multiline    = r.GetBit();
            Password     = r.GetBit();
            ReadOnly     = r.GetBit();
            HasTextColor = r.GetBit();
            HasMaxLength = r.GetBit();
            HasFont      = r.GetBit();
            r.GetBit();            // resreved
            AutoSize  = r.GetBit();
            HasLayout = r.GetBit();
            NoSelect  = r.GetBit();
            Border    = r.GetBit();
            r.GetBit();            // resreved
            HTML        = r.GetBit();
            UseOutlines = r.GetBit();

            if (HasFont)
            {
                FontID     = r.GetUI16();
                FontHeight = r.GetUI16();
            }
            if (HasTextColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }
            if (HasMaxLength)
            {
                MaxLength = r.GetUI16();
            }
            if (HasLayout)
            {
                Align       = (uint)r.GetByte();
                LeftMargin  = r.GetUI16();
                RightMargin = r.GetUI16();
                Indent      = r.GetUI16();
                Leading     = r.GetInt16();
            }
            VariableName = r.GetString();
            if (HasText)
            {
                InitialText = r.GetString();
            }
        }
示例#5
0
        internal MetadataTag(SwfReader r) : base(TagType.Metadata)
        {
            uint __pos = r.Position;

            xml  = r.GetString();
            size = r.Position - __pos;
        }
示例#6
0
        internal FrameLabelTag(SwfReader r)
            : base(TagType.FrameLabel)
        {
            uint __pos = r.Position;

            this.TargetName = r.GetString();
            size            = r.Position - __pos;
        }
示例#7
0
        internal ConstantPool(SwfReader r)
        {
            uint len = r.GetUI16();

            Constants = new string[len];
            for (int i = 0; i < len; i++)
            {
                Constants[i] = r.GetString();
            }
        }
示例#8
0
        internal ExportAssetsTag(SwfReader r)
            : base(TagType.ExportAssets)
        {
            uint count = r.GetUI16();

            for (int i = 0; i < count; i++)
            {
                uint   index = r.GetUI16();
                string name  = r.GetString();
                Exports.Add(index, name);
            }
        }
示例#9
0
 internal SwfHeader(SwfReader r)
 {
     this.CompressionMode  = CompressionType.Error;
     this.CompressionRatio = 0;
     //byte[] __signature = r.GetBytes(3);
     this.Signature = r.GetString(3);
     //Signature = r.GetString(3);
     if (Signature == "CWS")
     {
         this.CompressionMode = CompressionType.ZLIB;
         uint __oldSize = r.Size;
         r.DecompressCWSSwf();
         uint __newSize = r.Size;
         this.CompressionRatio = ((double)__oldSize / (double)__newSize) * 100;
     }
     else if (Signature == "ZWS")
     {
         this.CompressionMode = CompressionType.LZMA;
         //r.DecompressZWSSwf
         uint __oldSize = r.Size;
         r.DecompressCWSSwf();
         uint __newSize = r.Size;
         this.CompressionRatio = (double)__oldSize / (double)__newSize;
     }
     else if (Signature == "FWS")
     {
         this.CompressionMode = CompressionType.None;
     }
     if (this.CompressionMode != CompressionType.Error)
     {
         this.Version    = r.GetByte();
         this.FileLength = r.GetUI32();
         this.FrameSize  = new Rect(r);
         UInt16 __frate = r.GetUI16();
         this.FrameRate  = (__frate >> 8) + ((__frate & 0xFF) / 0xFF);
         this.FrameCount = r.GetUI16();
     }
     else
     {
         this.Version    = 0;
         this.FileLength = 0;
         this.FrameSize  = new Rect(0, 0, 0, 0);
         this.FrameRate  = 0;
         this.FrameCount = 0;
     }
 }
示例#10
0
        internal PlaceObject2Tag(SwfReader r, byte swfVersion)
        {
            tagType           = TagType.PlaceObject2;
            HasClipActions    = r.GetBit();
            HasClipDepth      = r.GetBit();
            HasName           = r.GetBit();
            HasRatio          = r.GetBit();
            HasColorTransform = r.GetBit();
            HasMatrix         = r.GetBit();
            HasCharacter      = r.GetBit();
            Move = r.GetBit();

            Depth = r.GetUI16();

            if (HasCharacter)
            {
                Character = r.GetUI16();
            }
            if (HasMatrix)
            {
                Matrix = new Matrix(r);
            }
            if (HasColorTransform)
            {
                ColorTransform = new ColorTransform(r, true);
            }
            if (HasRatio)
            {
                Ratio = r.GetUI16();
            }
            if (HasName)
            {
                Name = r.GetString();
            }
            if (HasClipDepth)
            {
                ClipDepth = r.GetUI16();
            }

            if (HasClipActions)
            {
                ClipActions = new ClipActions(r, (swfVersion > 5));
            }
        }
示例#11
0
        internal SymbolClassTag(SwfReader r, uint tagLen)
            : base(TagType.SymbolClass)
        {
            TagLen = tagLen;
            Symbols.Clear();
            UInt16 __count = r.GetUI16();

            for (UInt16 __i = 0; __i < __count; __i++)
            {
                uint   __idref = r.GetUI16();
                String __name  = r.GetString();
                if (__idref == 0)
                {
                    this.topLevelClass = __name;
                }
                if (!Symbols.ContainsKey(__name))
                {
                    Symbols.Add(__name, __idref);
                }
            }
        }
示例#12
0
        internal DefineFont2_3(SwfReader r, bool isHighRes)
            : base(TagType.DefineFont2)
        {
            this.IsHighRes = isHighRes; // true;
            if (isHighRes)
            {
                this.tagType = TagType.DefineFont3;
            }
            this.FontId               = r.GetUI16();
            this.FontFlagsHasLayout   = r.GetBit();
            this.FontFlagsShiftJIS    = r.GetBit();
            this.FontFlagsSmallText   = r.GetBit();
            this.FontFlagsANSI        = r.GetBit();
            this.FontFlagsWideOffsets = r.GetBit();
            this.FontFlagsWideCodes   = r.GetBit();
            this.FontFlagsItalic      = r.GetBit();
            this.FontFlagsBold        = r.GetBit();

            r.Align();

            this.LanguageCode = (uint)r.GetByte();
            uint fontNameLen = (uint)r.GetByte();

            this.FontName  = r.GetString(fontNameLen);
            this.NumGlyphs = r.GetUI16();

            this.OffsetTable = new uint[this.NumGlyphs];
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                this.OffsetTable[i] = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16();
            }

            this.CodeTableOffset = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16();

            GlyphShapeTable = new List <Shape>();
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                Shape s = new Shape(r);
                GlyphShapeTable.Add(s);
            }

            this.CodeTable = new uint[this.NumGlyphs];
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                this.CodeTable[i] = r.GetUI16();
            }

            if (this.FontFlagsHasLayout)
            {
                this.FontAscent  = r.GetInt16();
                this.FontDescent = r.GetInt16();
                this.FontLeading = r.GetInt16();

                this.FontAdvanceTable = new int[this.NumGlyphs];
                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontAdvanceTable[i] = r.GetInt16();
                }

                this.FontBoundsTable = new Rect[this.NumGlyphs];
                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontBoundsTable[i] = new Rect(r);
                }

                this.KerningCount = r.GetUI16();

                this.FontKerningTable = new KerningRecord[this.KerningCount];
                if (this.FontFlagsWideCodes)
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        this.FontKerningTable[i] = new KerningRecord(r.GetUI16(), r.GetUI16(), r.GetInt16());
                    }
                }
                else
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        this.FontKerningTable[i] = new KerningRecord((uint)r.GetByte(), (uint)r.GetByte(), r.GetInt16());
                    }
                }
            }
        }
示例#13
0
 internal GetURL(SwfReader r)
 {
     UrlString    = r.GetString();
     TargetString = r.GetString();
 }
示例#14
0
 internal SetTarget(SwfReader r)
 {
     TargetName = r.GetString();
 }
示例#15
0
 internal PrimitiveString(SwfReader r)
 {
     StringValue = r.GetString();
 }
示例#16
0
        //internal ClipActions ClipActions;

        internal PlaceObject3Tag(SwfReader r)
        {
            tagType = TagType.PlaceObject3;

            HasClipActions    = r.GetBit();
            HasClipDepth      = r.GetBit();
            HasName           = r.GetBit();
            HasRatio          = r.GetBit();
            HasColorTransform = r.GetBit();
            HasMatrix         = r.GetBit();
            HasCharacter      = r.GetBit();
            Move = r.GetBit();

            r.GetBits(5);             // reserved
            PlaceFlagHasCacheAsBitmap = r.GetBit();
            PlaceFlagHasBlendMode     = r.GetBit();
            PlaceFlagHasFilterList    = r.GetBit();

            Depth = r.GetUI16();

            if (HasCharacter)
            {
                Character = r.GetUI16();
            }
            if (HasMatrix)
            {
                Matrix = new Matrix(r);
            }
            if (HasColorTransform)
            {
                ColorTransform = new ColorTransform(r, true);
            }
            if (HasRatio)
            {
                Ratio = r.GetUI16();
            }
            if (HasName)
            {
                Name = r.GetString();
            }
            if (HasClipDepth)
            {
                ClipDepth = r.GetUI16();
            }

            if (PlaceFlagHasFilterList)
            {
                uint filterCount = (uint)r.GetByte();
                FilterList = new List <IFilter>();
                for (int i = 0; i < filterCount; i++)
                {
                    FilterKind kind = (FilterKind)r.GetByte();
                    switch (kind)
                    {
                    case FilterKind.Bevel:
                        FilterList.Add(new FilterBevel(r));
                        break;

                    case FilterKind.Blur:
                        FilterList.Add(new FilterBlur(r));
                        break;

                    case FilterKind.ColorMatrix:
                        FilterList.Add(new FilterColorMatrix(r));
                        break;

                    case FilterKind.Convolution:
                        FilterList.Add(new FilterConvolution(r));
                        break;

                    case FilterKind.DropShadow:
                        FilterList.Add(new FilterDropShadow(r));
                        break;

                    case FilterKind.Glow:
                        FilterList.Add(new FilterGlow(r));
                        break;

                    case FilterKind.GradientBevel:
                        FilterList.Add(new FilterGradientBevel(r));
                        break;

                    case FilterKind.GradientGlow:
                        FilterList.Add(new FilterGradientGlow(r));
                        break;

                    default:
                        // unsupported filter
                        break;
                    }
                }
            }
            if (PlaceFlagHasBlendMode)
            {
                BlendMode = (BlendMode)r.GetByte();
            }


            if (HasClipActions)
            {
                //ClipActions = new ClipActions();
            }
        }
示例#17
0
 internal GoToLabel(SwfReader r)
 {
     Label = r.GetString();
 }