/// <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); characterId = binaryReader.ReadUInt16(); int imgLen = Convert.ToInt32(binaryReader.ReadUInt32()); if (imgLen > 0) { jpegData = binaryReader.ReadBytes(imgLen); alphaData = binaryReader.ReadBytes(tl - 6 - imgLen); } }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="shapeType">Shape type.</param> public void ReadData(BufferedBinaryReader binaryReader, ShapeType shapeType) { base.SetStartPoint(binaryReader); fillStyleType = binaryReader.ReadByte(); rgbColor = null; gradientMatrix = null; bitmapId = 0; bitmapMatrix = null; gradient = null; if (fillStyleType == (byte)FillStyleType.SolidFill) { if (shapeType == ShapeType.Shape3) { rgbColor = new RGBA(); rgbColor.ReadData(binaryReader); } else if (shapeType == ShapeType.Shape2 || shapeType == ShapeType.Shape) { rgbColor = new RGB(); rgbColor.ReadData(binaryReader); } } if (fillStyleType == (byte)FillStyleType.RadialGradientFill || fillStyleType == (byte)FillStyleType.LinearGradientFill) { gradientMatrix = new Matrix(); gradientMatrix.ReadData(binaryReader); gradient = new GradientRecordCollection(); gradient.ReadData(binaryReader, shapeType); } if (fillStyleType == (byte)FillStyleType.RepeatingBitmapFill || fillStyleType == (byte)FillStyleType.ClippedBitmapFill || fillStyleType == (byte)FillStyleType.NonSmoothedClippedBitmap || fillStyleType == (byte)FillStyleType.NonSmoothedRepeatingBitmap) { bitmapId = binaryReader.ReadUInt16(); bitmapMatrix = new Matrix(); bitmapMatrix.ReadData(binaryReader); } base.SetEndPoint(binaryReader); }
/// <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(); binaryReader.SynchBits(); startBounds = new Rect(); startBounds.ReadData(binaryReader); binaryReader.SynchBits(); endBounds = new Rect(); endBounds.ReadData(binaryReader); binaryReader.SynchBits(); offset = binaryReader.ReadUInt32(); morphFillStyles = new MorphFillStyleCollection(); morphFillStyles.ReadData(binaryReader); morphLineStyles = new MorphLineStyleCollection(); morphLineStyles.ReadData(binaryReader); ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count; ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count; startEdges = new ShapeRecordCollection(); startEdges.ReadData(binaryReader, ShapeType.None); ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count; ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count; endEdges = new ShapeRecordCollection(); endEdges.ReadData(binaryReader, ShapeType.None); }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { fillStyleType = binaryReader.ReadByte(); startColor = null; endColor = null; if (fillStyleType == (byte)MorphFillStyleType.SolidFill) { startColor = new RGBA(); startColor.ReadData(binaryReader); endColor = new RGBA(); endColor.ReadData(binaryReader); } startGradientMatrix = null; endGradientMatrix = null; MorphGradientCollection gradient = null; if (fillStyleType == (byte)MorphFillStyleType.LinearGradientFill || fillStyleType == (byte)MorphFillStyleType.RadialGradientFill) { startGradientMatrix = new Matrix(); startGradientMatrix.ReadData(binaryReader); endGradientMatrix = new Matrix(); endGradientMatrix.ReadData(binaryReader); gradient = new MorphGradientCollection(); gradient.ReadData(binaryReader); } bitmapId = 0; startBitmapMatrix = null; endBitmapMatrix = null; if (fillStyleType == (byte)MorphFillStyleType.RepeatingBitmap || fillStyleType == (byte)MorphFillStyleType.ClippedBitmapFill || fillStyleType == (byte)MorphFillStyleType.NonSmoothedClippedBitmap || fillStyleType == (byte)MorphFillStyleType.NonSmoothedRepeatingBitmap) { bitmapId = binaryReader.ReadUInt16(); startBitmapMatrix = new Matrix(); startBitmapMatrix.ReadData(binaryReader); endBitmapMatrix = new Matrix(); endBitmapMatrix.ReadData(binaryReader); } }
/// <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); long startPosition = binaryReader.BaseStream.Position; buttonId = binaryReader.ReadUInt16(); binaryReader.ReadUBits(7); //reserved trackAsMenu = binaryReader.ReadBoolean(); long startPos = binaryReader.BaseStream.Position; actionOffset = binaryReader.ReadUInt16(); if (characters == null) characters = new ButtonRecordCollection(); else characters.Clear(); bool characterEndFlag = false; while (!characterEndFlag) { byte first = binaryReader.ReadByte(); if (first == 0) characterEndFlag = true; else { ButtonRecord buttRecord = new ButtonRecord(); buttRecord.ReadData(binaryReader, first, TagCodeEnum.DefineButton2); characters.Add(buttRecord); } } long curr = startPos + actionOffset; actions = new ButtonCondactionCollection(); bool lastCondAction = false; if (actionOffset == 0) lastCondAction = true; while (!lastCondAction) { long readedBytes = binaryReader.BaseStream.Position - startPosition; ushort condActionSize = binaryReader.ReadUInt16(); if (condActionSize == 0) { lastCondAction = true; condActionSize = (ushort)(rh.TagLength - readedBytes); } ButtonCondaction buttCond = new ButtonCondaction(); buttCond.ReadData(binaryReader, condActionSize); actions.Add(buttCond); } }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="fontFlagsWideCodes">Font flags wide codes.</param> public void ReadData(BufferedBinaryReader binaryReader, bool fontFlagsWideCodes) { ushort kerningCount = binaryReader.ReadUInt16(); if (kerningCount > 0) { for (int i = 0; i < kerningCount; i++) { KerningRecord fontKerning = new KerningRecord(); fontKerning.ReadData(binaryReader, fontFlagsWideCodes); Add(fontKerning); } } }
/// <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); recursion = binaryReader.ReadUInt16(); timeout = binaryReader.ReadUInt16(); }
/// <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(); }
/// <summary> /// Reads the data from a binary file /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { ushort tagCL = binaryReader.ReadUInt16(); tagCode = Convert.ToUInt16(tagCL >> 6); tagLength = System.Convert.ToUInt32(tagCL - (tagCode << 6)); bool longTag; if (tagLength == 0x3F) { uint len = binaryReader.ReadUInt32(); tagLength = len; longTag = (tagLength <= 127); } else { longTag = false; } if (tagLength > binaryReader.BaseStream.Length) { throw new InvalidTagLengthException(); } }
/// <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(); } }
/// <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); soundId = binaryReader.ReadUInt16(); soundInfo = new SoundInfo(); soundInfo.ReadData(binaryReader); }
/// <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); spriteId = binaryReader.ReadUInt16(); int lenght = System.Convert.ToInt32(rh.TagLength-2); actionRecord = binaryReader.ReadBytes(lenght); }
/// <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); buttonId = binaryReader.ReadUInt16(); characters = new ButtonRecordCollection(); bool characterEndFlag = false; while (!characterEndFlag) { byte first = binaryReader.ReadByte(); if (first == 0) characterEndFlag = true; else { ButtonRecord buttRecord = new ButtonRecord(); buttRecord.ReadData(binaryReader, first, TagCodeEnum.DefineButton); characters.Add(buttRecord); } } int offset = 2; foreach (ButtonRecord butRec in characters) offset += butRec.GetSizeOf(); int lenght = System.Convert.ToInt32(rh.TagLength) - offset - 1; //-1 for the ActionEndFlag actions = binaryReader.ReadBytes(lenght); //Read ActionEndFlag binaryReader.ReadByte(); }
/// <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(); }
/// <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(); numFrames = binaryReader.ReadUInt16(); width = binaryReader.ReadUInt16(); height = binaryReader.ReadUInt16(); binaryReader.ReadUBits(5); videoFlagsDeblocking = binaryReader.ReadUBits(2); videoFlagsSmoothing = binaryReader.ReadBoolean(); codecId = binaryReader.ReadByte(); }
/// <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); binaryReader.ReadUBits(4); playbackSoundRate = binaryReader.ReadUBits(2); playbackSoundSize = binaryReader.ReadUBits(1); playbackSoundType = binaryReader.ReadUBits(1); streamSoundCompression = binaryReader.ReadUBits(4); streamSoundRate = binaryReader.ReadUBits(2); streamSoundSize = binaryReader.ReadUBits(1); streamSoundType = binaryReader.ReadUBits(1); streamSoundSampleCount = binaryReader.ReadUInt16(); latencySeek = 0; if (streamSoundCompression == 2) latencySeek = binaryReader.ReadInt16(); }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="fontFlagsWideCodes">Font flags wide codes.</param> public void ReadData(BufferedBinaryReader binaryReader, bool fontFlagsWideCodes) { this.fontFlagsWideCodes = fontFlagsWideCodes; if (fontFlagsWideCodes) { fontFlagsWideCode1 = (uint)binaryReader.ReadUInt16(); fontFlagsWideCode2 = (uint)binaryReader.ReadUInt16(); } else { fontFlagsWideCode1 = (uint)binaryReader.ReadByte(); fontFlagsWideCode2 = (uint)binaryReader.ReadByte(); } short fontKerningAdjustement = binaryReader.ReadInt16(); }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="endOfRecordsFlag">End of records flag.</param> /// <param name="tagCodeEnum">Tag code enum.</param> public void ReadData(BufferedBinaryReader binaryReader, ref bool endOfRecordsFlag, TagCodeEnum tagCodeEnum) { binaryReader.SynchBits(); bool textRecordType = binaryReader.ReadBoolean(); binaryReader.ReadUBits(3); bool styleFlagsHasFont = binaryReader.ReadBoolean(); bool styleFlagsHasColor = binaryReader.ReadBoolean(); bool styleFlagsHasYOffset = binaryReader.ReadBoolean(); bool styleFlagsHasXOffset = binaryReader.ReadBoolean(); if (textRecordType == false) { endOfRecordsFlag = true; return; } fontId = 0; if (styleFlagsHasFont) fontId = binaryReader.ReadUInt16(); textColor = null; if (styleFlagsHasColor) { if (tagCodeEnum == TagCodeEnum.DefineText2) { textColor = new RGBA(); textColor.ReadData(binaryReader); } else { textColor = new RGB(); textColor.ReadData(binaryReader); } } xOffset = 0; if (styleFlagsHasXOffset) xOffset = binaryReader.ReadInt16(); yOffset = 0; if (styleFlagsHasYOffset) yOffset = binaryReader.ReadInt16(); textHeight = 0; if (styleFlagsHasFont) textHeight = binaryReader.ReadUInt16(); byte glyphCount = binaryReader.ReadByte(); if (glyphCount > 0) { if (glyphEntries == null) glyphEntries = new GlyphEntryCollection(); else glyphEntries.Clear(); for (int i = 0; i < glyphCount; i++) { GlyphEntry glyphEntry = new GlyphEntry(); glyphEntry.ReadData(binaryReader); glyphEntries.Add(glyphEntry); } } }
/// <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(); }
/// <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(); depth = binaryReader.ReadUInt16(); }
/// <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); ushort count = binaryReader.ReadUInt16(); exportedCharacters.Clear(); if (count > 0) { for (int i = 0; i < count; i++) { Assert exportedCharacter = new Assert(); exportedCharacter.ReadData(binaryReader); this.exportedCharacters.Add(exportedCharacter); } } }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="numGlyphs">Num glyphs.</param> public void ReadData(BufferedBinaryReader binaryReader, ushort numGlyphs) { if (numGlyphs == 0) return; ShapeWithStyle.NumFillBits = 0; ShapeWithStyle.NumLineBits = 0; ShapeRecordCollection[] shapes = new ShapeRecordCollection[numGlyphs]; for (int i = 0; i < numGlyphs; i++) { ShapeRecordCollection glyphShape = new ShapeRecordCollection(); glyphShape.ReadData(binaryReader, ShapeType.None); shapes[i] = glyphShape; } for (int i = 0; i < numGlyphs; i++) { char c; if (isWideCodes) c = (char)binaryReader.ReadUInt16(); else c = (char)binaryReader.ReadByte(); this[c] = shapes[i]; } shapes = null; }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { uint count = 0; byte fillStyleCount = binaryReader.ReadByte(); count = fillStyleCount; ushort fillStyleCountExtended = 0; if (fillStyleCount == 0xFF) { fillStyleCountExtended = binaryReader.ReadUInt16(); count = fillStyleCountExtended; } if (count > 0) { for (int i = 0; i < count; i++) { byte fillStyleType = binaryReader.PeekByte(); MorphFillStyle morphFillStyle = GetMorphFillStyleFromType(fillStyleType); if (morphFillStyle != null) { morphFillStyle.ReadData(binaryReader); this.Add(morphFillStyle); } } } }
/// <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); long initPos = binaryReader.BaseStream.Position; characterId = binaryReader.ReadUInt16(); depth = binaryReader.ReadUInt16(); matrix = new Matrix(); matrix.ReadData(binaryReader); long pos = binaryReader.BaseStream.Position - initPos; if (pos < rh.TagLength) { colorTransform = new CXForm(); colorTransform.ReadData(binaryReader); } }
/// <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 beforePos = (int)binaryReader.BaseStream.Position; int toReaded = (int)rh.TagLength - 7; _characterId = binaryReader.ReadUInt16(); _bitmapFormat = binaryReader.ReadByte(); _bitmapWidth = binaryReader.ReadUInt16(); _bitmapHeight = binaryReader.ReadUInt16(); _bitmapColorTableSize = 0; if (_bitmapFormat == 3) { _bitmapColorTableSize = binaryReader.ReadByte(); toReaded--; } if (_bitmapFormat == 3) { _colorMapData = new ColorMapData(); _colorMapData.ReadData(binaryReader, _bitmapColorTableSize, _bitmapWidth, _bitmapHeight, toReaded); } else if (_bitmapFormat == 4 || _bitmapFormat == 5) { int imageSize = _bitmapWidth * _bitmapHeight; int uncompressedSize = imageSize; if (_bitmapFormat == 4) uncompressedSize *= 2; else uncompressedSize *= 4; byte[] uncompressed = new byte[uncompressedSize]; byte[] compressed = binaryReader.ReadBytes(toReaded); Inflater zipInflator = new Inflater(); zipInflator.SetInput(compressed); zipInflator.Inflate(uncompressed, 0, uncompressedSize); _bitmapColorData = null; if (_bitmapFormat == 4) { Pix15[] bitmapPixelData = new Pix15[imageSize]; for (int i = 0, j = 0; i < imageSize; i++, j += 2) { byte[] data = new byte[2] {uncompressed[j], uncompressed[j+1]}; bitmapPixelData[i] = new Pix15(data); } _bitmapColorData = new BitmapColorData(bitmapPixelData); } else { Pix24[] bitmapPixelData = new Pix24[imageSize]; for (int i = 0, j = 0; i < imageSize; i++, j += 4) { byte reserved = uncompressed[j]; byte red = uncompressed[j + 1]; byte green = uncompressed[j + 2]; byte blue = uncompressed[j + 3]; bitmapPixelData[i] = new Pix24(red, green, blue); } _bitmapColorData = new BitmapColorData(bitmapPixelData); } } }
/// <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); buttonId = binaryReader.ReadUInt16(); buttonSoundChar = binaryReader.ReadUInt16(); buttonSoundInfo = null; if (buttonSoundChar != 0) { buttonSoundInfo = new SoundInfo(); buttonSoundInfo.ReadData(binaryReader); } buttonSoundChar1 = binaryReader.ReadUInt16(); buttonSoundInfo1 = null; if (buttonSoundChar1 != 0) { buttonSoundInfo1 = new SoundInfo(); buttonSoundInfo1.ReadData(binaryReader); } buttonSoundChar2 = binaryReader.ReadUInt16(); buttonSoundInfo2 = null; if (buttonSoundChar2 != 0) { buttonSoundInfo2 = new SoundInfo(); buttonSoundInfo2.ReadData(binaryReader); } buttonSoundChar3 = binaryReader.ReadUInt16(); buttonSoundInfo3 = null; if (buttonSoundChar3 != 0) { buttonSoundInfo3 = new SoundInfo(); buttonSoundInfo3.ReadData(binaryReader); } }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="shapeType">Shape type.</param> public void ReadData(BufferedBinaryReader binaryReader, ShapeType shapeType) { int count = 0; byte fillStyleCount = binaryReader.ReadByte(); count = System.Convert.ToInt32(fillStyleCount); ushort fillStyleCountExtended = 0; if (fillStyleCount == 0xFF && (shapeType == ShapeType.Shape2 || shapeType == ShapeType.Shape3)) { fillStyleCountExtended = binaryReader.ReadUInt16(); count = System.Convert.ToInt32(fillStyleCountExtended); } if (count != 0) { for (int i = 0; i < count; i++) { byte fillStyleType = binaryReader.PeekByte(); FillStyle fillStyle = GetFillStyleFromType(fillStyleType); if (fillStyle != null) { fillStyle.ReadData(binaryReader, shapeType); this.Add(fillStyle); } } } }
/// <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 beforePos = (int)binaryReader.BaseStream.Position; int toReaded = (int)rh.TagLength - 7; _characterId = binaryReader.ReadUInt16(); _bitmapFormat = binaryReader.ReadByte(); _bitmapWidth = binaryReader.ReadUInt16(); _bitmapHeight = binaryReader.ReadUInt16(); _bitmapColorTableSize = 0; if (_bitmapFormat == 3) { _bitmapColorTableSize = binaryReader.ReadByte(); toReaded--; } int imageSize = _bitmapWidth * _bitmapHeight; if (_bitmapFormat == 3) { int uncompressedSize = imageSize + ((_bitmapColorTableSize + 1) * 4); byte[] uncompressed = new byte[uncompressedSize]; byte[] compressed = binaryReader.ReadBytes(toReaded); Inflater zipInflator = new Inflater(); zipInflator.SetInput(compressed); zipInflator.Inflate(uncompressed, 0, uncompressedSize); _alphaColorMapData = new AlphaColorMapData(); _alphaColorMapData.ColorTableRgb = new RGBA[_bitmapColorTableSize + 1]; int offset = 0; for (int i = 0; i < _bitmapColorTableSize + 1; i++, offset += 4) { byte red = uncompressed[offset]; byte green = uncompressed[offset + 1]; byte blue = uncompressed[offset + 2]; byte alpha = uncompressed[offset + 3]; _alphaColorMapData.ColorTableRgb[i] = new RGBA(red, green, blue, alpha); } _alphaColorMapData.ColorMapPixelData = new byte[uncompressedSize - offset]; for (int i = 0; i < uncompressedSize - offset; i++, offset++) _alphaColorMapData.ColorMapPixelData[i] = uncompressed[offset]; } else if (_bitmapFormat == 4 || _bitmapFormat == 5) { int uncompressedSize = imageSize * 4; byte[] uncompressed = new byte[uncompressedSize]; byte[] compressed = binaryReader.ReadBytes(toReaded); Inflater zipInflator = new Inflater(); zipInflator.SetInput(compressed); zipInflator.Inflate(uncompressed, 0, uncompressedSize); _alphaBitmapData = new AlphaBitmapData(); _alphaBitmapData.BitmapPixelData = new RGBA[imageSize]; for (int i = 0, j = 0; i < imageSize; i++, j += 4) { byte red = uncompressed[j]; byte green = uncompressed[j + 1]; byte blue = uncompressed[j + 2]; byte alpha = uncompressed[j + 3]; _alphaBitmapData.BitmapPixelData[i] = new RGBA(red, green, blue, alpha); } } }
/// <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); soundId = binaryReader.ReadUInt16(); soundFormat = binaryReader.ReadUBits(4); soundRate = binaryReader.ReadUBits(2); soundSize = binaryReader.ReadUBits(1); soundType = binaryReader.ReadUBits(1); soundSampleCount = binaryReader.ReadUInt32(); uint size = rh.TagLength - 2 - 1 - 4; soundData = new byte[size]; for (uint i = 0; i < size; i++) soundData[i] = binaryReader.ReadByte(); }
/// <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); } } }