Ejemplo n.º 1
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            fontId = binaryReader.ReadUInt16();
            byte fontNameLen = binaryReader.ReadByte();

            fontName = binaryReader.ReadString(fontNameLen);

            binaryReader.ReadUBits(2); //reserved
            fontFlagsSmallText = binaryReader.ReadBoolean();
            binaryReader.ReadUBits(2); //not used
            fontFlagsItalic = binaryReader.ReadBoolean();
            fontFlagsBold   = binaryReader.ReadBoolean();
            binaryReader.ReadBoolean(); //not used

            languageCode = binaryReader.ReadByte();

            long codeTableLenght = rh.TagLength - 5 - fontNameLen;

            codeTable = null;
            codeTable = new ushort[codeTableLenght];
            for (int i = 0; i < codeTableLenght / 2; i++)
            {
                codeTable[i] = binaryReader.ReadUInt16();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            int lenght = System.Convert.ToInt32(rh.TagLength);
            password = binaryReader.ReadString();
            //char[] password = br.ReadChars(lenght);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            int tl = System.Convert.ToInt32(rh.TagLength);

            Meta = binaryReader.ReadString();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Reads the data.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public void ReadData(BufferedBinaryReader reader)
 {
     this.signature = reader.ReadString(3);
     this.version   = reader.ReadByte();
     reader.ReadUBits(5);
     this.hasAudio = reader.ReadBoolean();
     reader.ReadBoolean();
     this.hasVideo = reader.ReadBoolean();
     reader.ReadUInt32();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Reads the data from a binary file
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            this.signature = binaryReader.ReadString(3);
            this.version   = binaryReader.ReadByte();

            this.fileSize = binaryReader.ReadUInt32();
            this.rect     = new Rect();
            this.rect.ReadData(binaryReader);
            binaryReader.SynchBits();
            this.fps    = binaryReader.ReadFloatWord(8, 8);
            this.frames = binaryReader.ReadUInt16();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            int tl    = System.Convert.ToInt32(rh.TagLength);
            int count = binaryReader.ReadUInt16();

            for (int i = 0; i < count; i++)
            {
                int    id   = binaryReader.ReadUInt16();
                string name = binaryReader.ReadString(Encoding.UTF8);
                tagsData.Add(id, name);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Reads the data from a binary file
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            this.signature = binaryReader.ReadString(3);
            this.version   = binaryReader.ReadByte();

            if (this.version > MAX_VERSION)
            {
                throw new InvalidSwfVersionException(this.version, MAX_VERSION);
            }

            this.fileSize = binaryReader.ReadUInt32();
            this.rect     = new Rect();
            this.rect.ReadData(binaryReader);
            binaryReader.SynchBits();
            this.fps    = binaryReader.ReadFloatWord(8, 8);
            this.frames = binaryReader.ReadUInt16();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            uint max = rh.TagLength;

            if (version >= 6)
            {
                max--;
            }
            name = binaryReader.ReadString(max);
            if (version >= 6)
            {
                binaryReader.ReadByte();
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="version">Version.</param>
        /// <param name="binaryReader">Binary reader.</param>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            url = binaryReader.ReadString();
            ushort count = binaryReader.ReadUInt16();

            exportedCharacters.Clear();
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Assert exportedCharacter = new Assert();
                    exportedCharacter.ReadData(binaryReader);
                    exportedCharacters.Add(exportedCharacter);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            fontId = binaryReader.ReadUInt16();
            byte fontNameLen = binaryReader.ReadByte();

            fontName = binaryReader.ReadString(fontNameLen);

            binaryReader.ReadUBits(2); //reserved
            fontFlagsSmallText = binaryReader.ReadBoolean();
            fontFlagsShiftJIS  = binaryReader.ReadBoolean();
            fontFlagsAINSI     = binaryReader.ReadBoolean();
            fontFlagsItalic    = binaryReader.ReadBoolean();
            fontFlagsBold      = binaryReader.ReadBoolean();
            fontFlagsWildCodes = binaryReader.ReadBoolean();

            uint codeTableLenght = rh.TagLength - 4 - fontNameLen;

            if (!fontFlagsWildCodes)
            {
                codeTable = new uint[codeTableLenght];
                for (int i = 0; i < codeTableLenght; i++)
                {
                    codeTable[i] = (uint)binaryReader.ReadByte();
                }
            }
            else
            {
                codeTable = new uint[codeTableLenght / 2];
                for (int i = 0; i < codeTableLenght / 2; i++)
                {
                    codeTable[i] = (uint)binaryReader.ReadUInt16();
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            characterId = binaryReader.ReadUInt16();
            rect        = new Rect();
            rect.ReadData(binaryReader);

            BitArray ba = BitParser.GetBitValues(new byte[1] {
                binaryReader.ReadByte()
            });

            bool hasText = ba.Get(0);         //binaryReader.ReadBoolean();

            wordWrap  = ba.Get(1);            //binaryReader.ReadBoolean();
            multiline = ba.Get(2);            //binaryReader.ReadBoolean();
            password  = ba.Get(3);            //binaryReader.ReadBoolean();
            readOnly  = ba.Get(4);            //binaryReader.ReadBoolean();
            bool hasTextColor = ba.Get(5);    //binaryReader.ReadBoolean();
            bool hasMaxLength = ba.Get(6);    //binaryReader.ReadBoolean();
            bool hasFont      = ba.Get(7);    //binaryReader.ReadBoolean();

            //binaryReader.SynchBits();

            ba = BitParser.GetBitValues(new byte[1] {
                binaryReader.ReadByte()
            });
            //binaryReader.ReadBoolean(); //Reserved
            autoSize = ba.Get(1);         //binaryReader.ReadBoolean();
            bool hasLayout = ba.Get(2);   //binaryReader.ReadBoolean();

            noSelect = ba.Get(3);         //binaryReader.ReadBoolean();
            border   = ba.Get(4);         //binaryReader.ReadBoolean();
            //binaryReader.ReadBoolean(); //Reserved
            html         = ba.Get(6);     //binaryReader.ReadBoolean();
            usedOutlines = ba.Get(7);     //binaryReader.ReadBoolean();

            if (hasFont)
            {
                fontId     = binaryReader.ReadUInt16();
                fontHeight = binaryReader.ReadUInt16();
            }

            if (hasTextColor)
            {
                textColor = new RGBA();
                textColor.ReadData(binaryReader);
            }

            if (hasMaxLength)
            {
                maxLenght = binaryReader.ReadUInt16();
            }

            if (hasLayout)
            {
                align       = binaryReader.ReadByte();
                leftMargin  = binaryReader.ReadUInt16();
                rightMargin = binaryReader.ReadUInt16();
                indent      = binaryReader.ReadUInt16();
                leading     = binaryReader.ReadUInt16();
            }

            variableName = binaryReader.ReadString();
            if (hasText)
            {
                initialText = binaryReader.ReadString();
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            bool placeFlagHasClipActions    = binaryReader.ReadBoolean();
            bool placeFlagHasClipDepth      = binaryReader.ReadBoolean();
            bool placeFlagHasName           = binaryReader.ReadBoolean();
            bool placeFlagHasRatio          = binaryReader.ReadBoolean();
            bool placeFlagHasColorTransform = binaryReader.ReadBoolean();
            bool placeFlagHasMatrix         = binaryReader.ReadBoolean();
            bool placeFlagHasCharacter      = binaryReader.ReadBoolean();

            placeFlagMove = binaryReader.ReadBoolean();

            depth       = binaryReader.ReadUInt16();
            characterId = 0;
            if (placeFlagHasCharacter)
            {
                characterId = binaryReader.ReadUInt16();
            }
            matrix = null;
            if (placeFlagHasMatrix)
            {
                matrix = new Matrix();
                matrix.ReadData(binaryReader);
            }
            colorTransform = null;
            if (placeFlagHasColorTransform)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
            ratio = 0;
            if (placeFlagHasRatio)
            {
                ratio = binaryReader.ReadUInt16() / 65535.0f;
            }
            name = null;
            if (placeFlagHasName)
            {
                name = binaryReader.ReadString();
            }
            clipDepth = 0;
            if (placeFlagHasClipDepth)
            {
                clipDepth = binaryReader.ReadUInt16();
            }

            // get bytecode actions
            clipActions = null;
            if (placeFlagHasClipActions)
            {
                // different behaviour for Flash 6+
                actionHead = (version >= 6) ? binaryReader.ReadBytes(6) : binaryReader.ReadBytes(4);
                // read clip action records to list
                ArrayList clpAc = new ArrayList();
                //ClipActionRec a = null;
                bool res = true;
                do
                {
                    ClipActionRec action = new ClipActionRec();
                    res = action.ReadData(binaryReader, version);
                    if (res)
                    {
                        clpAc.Add(action);
                    }
                }while (res);
                // copy list to array
                clipActions = new ClipActionRec[clpAc.Count];
                clpAc.CopyTo(clipActions, 0);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            fontId = binaryReader.ReadUInt16();

            bool fontFlagsHasLayout = binaryReader.ReadBoolean();

            fontFlagsShiftJIS  = binaryReader.ReadBoolean();
            fontFlagsSmallText = binaryReader.ReadBoolean();
            fontFlagsANSI      = binaryReader.ReadBoolean();
            bool fontFlagsWideOffsets = binaryReader.ReadBoolean();
            bool fontFlagsWideCodes   = binaryReader.ReadBoolean();

            fontFlagsItalic = binaryReader.ReadBoolean();
            fontFlagsBold   = binaryReader.ReadBoolean();
            languageCode    = (LanguageCode)binaryReader.ReadByte();
            byte fontNameLength = binaryReader.ReadByte();

            fontName = binaryReader.ReadString(fontNameLength);

            ushort numGlyphs = binaryReader.ReadUInt16();

            if (numGlyphs > 0)
            {
                uint[] offsetTable = new uint[numGlyphs];
                for (int i = 0; i < numGlyphs; i++)
                {
                    if (fontFlagsWideOffsets)
                    {
                        offsetTable[i] = binaryReader.ReadUInt32();
                    }
                    else
                    {
                        offsetTable[i] = (uint)binaryReader.ReadUInt16();
                    }
                }
            }
            uint codeTableOffset = 0;

            if (fontFlagsWideOffsets)
            {
                codeTableOffset = binaryReader.ReadUInt32();
            }
            else
            {
                codeTableOffset = (uint)binaryReader.ReadUInt16();
            }

            if (numGlyphs > 0)
            {
                this.glyphShapesTable.IsWideCodes = fontFlagsWideCodes;
                this.glyphShapesTable.ReadData(binaryReader, numGlyphs);
            }

            if (fontFlagsHasLayout)
            {
                fontAscent  = binaryReader.ReadInt16();
                fontDescent = binaryReader.ReadInt16();
                fontLeading = binaryReader.ReadInt16();

                if (numGlyphs > 0)
                {
                    fontAdvanceTable.ReadData(binaryReader, numGlyphs);
                    fontBoundsTable.ReadData(binaryReader, numGlyphs);
                    fontKerningTable.ReadData(binaryReader, fontFlagsWideCodes);
                }
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Reads the data from a binary stream reader.
 /// </summary>
 /// <param name="binaryReader">Binary reader.</param>
 public void ReadData(BufferedBinaryReader binaryReader)
 {
     tag  = binaryReader.ReadUInt16();
     name = binaryReader.ReadString();
 }