Exemple #1
0
        protected override void DecompileBody(byte[] data)
        {
            SwfStream stream = data;

            Flags   = (DoAbcTagFlags)stream.ReadInt();
            Name    = stream.ReadString();
            AbcData = new Abc();
            AbcData.Decompile(stream.ReadToEnd());
        }
        public void Load(SwfStream stream, uint length, byte version)
        {
            uint numScenes = stream.ReadEncodedUInt();
            var scenes = new Dictionary<string, ushort>((int)numScenes);
            for (uint i = 0; i < numScenes; i++)
            {
                ushort frame = (ushort)stream.ReadEncodedUInt();
                scenes.Add(stream.ReadString(), frame);
            }

            uint numLabels = stream.ReadEncodedUInt();
            var labels = new Dictionary<string, ushort>((int)numScenes);
            for (uint i = 0; i < numScenes; i++)
            {
                ushort label = (ushort)stream.ReadEncodedUInt();
                labels.Add(stream.ReadString(), label);
            }

            Scenes = scenes;
            FrameLabels = labels;
        }
Exemple #3
0
        protected override void DecompileBody(byte[] data)
        {
            SwfStream stream = data;
            short     count  = stream.ReadShort();

            TagArray  = new short[count];
            NameArray = new string[count];
            for (int i = 0; i < count; i++)
            {
                TagArray[i]  = stream.ReadShort();
                NameArray[i] = stream.ReadString();
            }
        }
Exemple #4
0
        public virtual void Load(SwfStream stream, uint length, byte version)
        {
            FontID = stream.ReadUShort();
            Name = stream.ReadString(stream.ReadByte());
            Flags = (FontFlags)stream.ReadByte();
            ReadLangCode(stream);

            uint count = (uint)(length - stream.TagPosition);
            if ((Flags & FontFlags.WideCodes) != 0)
            {
                count /= 2;
                Characters = stream.ReadCharArray((int)count);
            }
            else
            {
                Characters = new char[count];
                for (int i = 0; i < count; i++)
                    Characters[i] = (char)stream.ReadByte();
            }
        }
Exemple #5
0
 public void Load(SwfStream stream, uint length, byte version)
 {
     Label = stream.ReadString();
     IsAnchor = (stream.TagPosition < length) && (stream.ReadByte() != 0);
 }
Exemple #6
0
 public virtual void Load(SwfStream stream, uint length, byte version)
 {
     CharacterID = stream.ReadUShort();
     Bounds = stream.ReadRectangle();
     Flags = (EditTextFlags)stream.ReadUShort();
     if ((Flags & EditTextFlags.HasFont) != 0) FontID = stream.ReadUShort();
     if ((Flags & EditTextFlags.HasFontClass) != 0) FontClass = stream.ReadString();
     if ((Flags & EditTextFlags.HasFont) != 0) FontHeight = stream.ReadUShort();
     TextColor = ((Flags & EditTextFlags.HasTextColor) != 0) ? stream.ReadRGBA() : (VGColor)Color.Black;
     MaxLength = ((Flags & EditTextFlags.HasMaxLength) != 0) ? stream.ReadUShort() : ushort.MaxValue;
     if ((Flags & EditTextFlags.HasLayout) != 0)
     {
         TextAlign = (Align)stream.ReadByte();
         LeftMargin = stream.ReadUShort();
         RightMargin = stream.ReadUShort();
         Indent = stream.ReadUShort();
         Leading = stream.ReadShort();
     }
     Variable = stream.ReadString();
     InitialText = ((Flags & EditTextFlags.HasText) != 0) ? stream.ReadString() : string.Empty;
 }
Exemple #7
0
 public void Load(SwfStream stream, uint length, byte version)
 {
     mFlags = stream.ReadByte();
     Depth = stream.ReadUShort();
     if (HasCharacter) CharacterID = stream.ReadUShort();
     if (HasMatrix) Matrix = stream.ReadMatrix();
     if (HasCxForm) CxForm = stream.ReadCxForm(true);
     if (HasRatio) Ratio = stream.ReadUShort();
     if (HasName) Name = stream.ReadString();
     if (HasClipDepth) ClipDepth = stream.ReadUShort();
     if (HasActions) Actions = new ClipActions(stream);
 }
Exemple #8
0
        public virtual void Load(SwfStream stream, uint length, byte version)
        {
            CharacterID = stream.ReadUShort();
            Flags = (FontFlags)stream.ReadByte();
            Language = stream.ReadLanguage();
            Name = stream.ReadString(stream.ReadByte());
            ushort count = stream.ReadUShort();
            stream.Skip((count + 1) * (((Flags & FontFlags.WideOffsets) != 0) ? 4 : 2)); // Offsets

            Glyphs = new FontGlyph[count];
            for (int i = 0; i < count; i++)
            {
                var subShapes = new Shape(ShapeInfo.ReadShape(stream, false, false, false, false), true).SubShapes;
                if (subShapes == null || subShapes.Length < 1) continue;

                var shape = subShapes[0];
                if (shape != null && shape.Fills.Count > 0)
                {
                    Glyphs[i] = new FontGlyph
                    {
                        GlyphPath = shape.Fills.Values.First().GetPath(),
                        ReferencePoint = new Vector2(shape.Shape.ReferencePoint.X, shape.Shape.ReferencePoint.Y) * DefineFontTag.EMSquareInv
                    };
                    Glyphs[i].GlyphPath.Scale(DefineFontTag.EMSquareInv);
                }
                else
                    Glyphs[i] = new FontGlyph { GlyphPath = new VGPath(), ReferencePoint = Vector2.Zero };
            }

            if ((Flags & FontFlags.WideCodes) != 0)
                Characters = stream.ReadCharArray((int)count);
            else
            {
                Characters = new char[count];
                for (int i = 0; i < count; i++)
                    Characters[i] = (char)stream.ReadByte();
            }

            if ((Flags & FontFlags.HasLayout) != 0)
            {
                Ascent = stream.ReadShort();
                Descent = stream.ReadShort();
                Leading = stream.ReadShort();
                Advances = stream.ReadShortArray(count);
                Bounds = stream.ReadRectangleArray(count);

                char l, r;
                int adj;
                ushort kerns = stream.ReadUShort();
                Kerning = new VGKerningTable(kerns);
                if ((Flags & FontFlags.WideCodes) != 0)
                {
                    for (int i = 0; i < kerns; i++)
                    {
                        l = (char)stream.ReadUShort();
                        r = (char)stream.ReadUShort();
                        adj = stream.ReadShort();
                        Kerning.Add(l, r, adj);
                    }
                }
                else
                {
                    for (int i = 0; i < kerns; i++)
                    {
                        l = (char)stream.ReadByte();
                        r = (char)stream.ReadByte();
                        adj = stream.ReadShort();
                        Kerning.Add(l, r, adj);
                    }
                }
            }
        }
Exemple #9
0
 public virtual void Load(SwfStream stream, uint length, byte version)
 {
     FontID = stream.ReadUShort();
     Name = stream.ReadString();
     Copyright = stream.ReadString();
 }
Exemple #10
0
 public void Load(SwfStream stream, uint length, byte version)
 {
     mFlags = stream.ReadUShort();
     Depth = stream.ReadUShort();
     if (HasClassName || (HasImage && HasCharacter)) ClassName = stream.ReadString();
     if (HasCharacter) CharacterID = stream.ReadUShort();
     if (HasMatrix) Matrix = stream.ReadMatrix();
     if (HasCxForm) CxForm = stream.ReadCxForm(true);
     if (HasRatio) Ratio = stream.ReadUShort();
     if (HasName) Name = stream.ReadString();
     if (HasClipDepth) ClipDepth = stream.ReadUShort();
     Filters = HasFilterList ? Filter.ReadFilterList(stream) : new Filter[0];
     if (HasBlendMode) BlendMode = (BlendMode)stream.ReadByte();
     if (HasCacheAsBitmap) BitmapCache = stream.ReadByte();
     if (HasActions) Actions = new ClipActions(stream);
 }