/// <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(); } }
internal ProductDefinition0002(BufferedBinaryReader reader, Discipline discipline) : base(reader, discipline) { DerivedForecast = reader.ReadByte(); EnsembleForecastsNumber = reader.ReadByte(); RegisterContent(ProductDefinitionContent.DerivedForecast, () => DerivedForecast); RegisterContent(ProductDefinitionContent.EnsembleForecastsNumber, () => EnsembleForecastsNumber); }
/// <summary> /// Reads the data from a binary reader. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { byte pix24Reserved = binaryReader.ReadByte(); this.pix24Red = binaryReader.ReadByte(); this.pix24Green = binaryReader.ReadByte(); this.pix24Blue = binaryReader.ReadByte(); }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { startRatio = binaryReader.ReadByte(); startColor = new RGBA(); startColor.ReadData(binaryReader); endRatio = binaryReader.ReadByte(); endColor = new RGBA(); endColor.ReadData(binaryReader); }
internal ProductDefinition0001(BufferedBinaryReader reader, Discipline discipline) : base(reader, discipline) { EnsembleForecastType = (EnsembleForecastType)reader.ReadByte(); PerturbationNumber = reader.ReadByte(); EnsembleForecastsNumber = reader.ReadByte(); RegisterContent(ProductDefinitionContent.EnsembleForecastType, () => EnsembleForecastType); RegisterContent(ProductDefinitionContent.PerturbationNumber, () => PerturbationNumber); RegisterContent(ProductDefinitionContent.EnsembleForecastsNumber, () => EnsembleForecastsNumber); }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> /// <param name="condActionSize">Size of the cond action.</param> public void ReadData(BufferedBinaryReader binaryReader, ushort condActionSize) { int offset = condActionSize - 5; condO = binaryReader.ReadByte(); condKey = binaryReader.ReadByte(); actions = binaryReader.ReadBytes(offset); byte end = binaryReader.ReadByte(); }
public void ReadFromStream(BufferedBinaryReader r) { ID = Utils.Latin1Encoding.GetString(r.ReadBytes(4)); StreamVersion = r.ReadByte(); TypeFlag = r.ReadByte(); AbsolutePosition = r.ReadUInt64(); Serial = r.ReadInt32(); PageNumber = r.ReadInt32(); Checksum = r.ReadUInt32(); Segments = r.ReadByte(); LacingValues = r.ReadBytes(Segments); }
private void readPatterns(BufferedBinaryReader source, IList <ushort> patternPointers) { byte rowNum; byte what; IList <S3MEvent> aRow; IList <IList <S3MEvent> > aPattern; foreach (ushort pos in patternPointers) { aPattern = new List <IList <S3MEvent> >(); source.Seek(pos << 4, SeekOrigin.Begin); aRow = new List <S3MEvent>(); rowNum = 0; source.Seek(2, SeekOrigin.Current); // patternSize do { what = source.ReadByte(); if (what > 0) { S3MEvent theEvent = new S3MEvent(); theEvent.Channel = what & 0x1F; if ((what & 0x20) > 0) { source.Seek(2, SeekOrigin.Current); // Note & Instrument } if ((what & 0x40) > 0) { source.Seek(1, SeekOrigin.Current); // Volume } if ((what & 0x80) > 0) { theEvent.Command = source.ReadByte(); theEvent.Info = source.ReadByte(); } aRow.Add(theEvent); } else // what = 0 => end of row { aPattern.Add(aRow); aRow = new List <S3MEvent>(); rowNum++; } } while (rowNum < MAX_ROWS); FPatterns.Add(aPattern); } }
/// <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(); }
public static EncodedTranscriptData Read(BufferedBinaryReader reader) { var info = reader.ReadUInt16(); var contents = reader.ReadByte(); return(new EncodedTranscriptData(info, contents)); }
/// <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; }
private static VBRData getXingInfo(BufferedBinaryReader source) { VBRData result = new VBRData(); byte[] data = new byte[8]; result.Found = true; result.ID = VBR_ID_XING.ToCharArray(); source.Seek(4, SeekOrigin.Current); source.Read(data, 0, 8); result.Frames = data[0] * 0x1000000 + data[1] * 0x10000 + data[2] * 0x100 + data[3]; result.Bytes = data[4] * 0x1000000 + data[5] * 0x10000 + data[6] * 0x100 + data[7]; source.Seek(103, SeekOrigin.Current); result.Scale = source.ReadByte(); source.Read(data, 0, 8); result.VendorID = Utils.Latin1Encoding.GetString(data, 0, 8); return(result); }
/// <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 lineStyleCount = binaryReader.ReadByte(); count = System.Convert.ToInt32(lineStyleCount); ushort lineStyleCountExtended = 0; if (lineStyleCount == 0xFF) { lineStyleCountExtended = binaryReader.ReadUInt16(); count = System.Convert.ToInt32(lineStyleCountExtended); } if (count > 0) { for (int i = 0; i < count; i++) { LineStyle lineStyle = new LineStyle(); lineStyle.ReadData(binaryReader, shapeType); Add(lineStyle); } } }
/// <summary> /// Reads the data. /// </summary> /// <param name="version">Version.</param> /// <param name="binaryReader">Binary reader.</param> public virtual void ReadData(byte version, BufferedBinaryReader binaryReader) { this.tagType = (FlvTagCodeEnum)binaryReader.ReadByte(); this.dataSize = binaryReader.ReadUBits(24); this.timeStamp = binaryReader.ReadUBits(24); binaryReader.ReadUInt32(); }
/// <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> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { uint count = 0; byte lineStyleCount = binaryReader.ReadByte(); count = lineStyleCount; ushort lineStyleCountExtended = 0; if (lineStyleCount == 0xFF) { lineStyleCountExtended = binaryReader.ReadUInt16(); count = lineStyleCountExtended; } if (count > 0) { for (int i = 0; i < count; i++) { MorphLineStyle morphLineStyle = new MorphLineStyle(); morphLineStyle.ReadData(binaryReader); this.Add(morphLineStyle); } } }
/// <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> /// 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(); }
internal IEnumerable <bool> GetBitmap(BufferedBinaryReader reader) { if (BitMapIndicatorCode == 0) { reader.Seek(BitmapOffset, SeekOrigin.Begin); var bitmap = new BitArray((int)dataPointsNumber, true); void TrySet(int i, bool value) { if (i < bitmap.Length) { bitmap[i] = value; } } // create new bit map, octet 4 contains number of unused bits at the end var i = 0; while (i < bitmap.Length) { var bitmapByte = (Bitmask)reader.ReadByte(); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit1)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit2)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit3)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit4)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit5)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit6)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit7)); TrySet(i++, bitmapByte.HasFlag(Bitmask.Bit8)); } IEnumerable <bool> EnumerateBitArray() { foreach (bool item in bitmap) { yield return(item); } } return(EnumerateBitArray()); } else { IEnumerable <bool> EnumerateTrue() { for (int i = 0; i < dataPointsNumber; i++) { yield return(true); } } return(EnumerateTrue()); } }
/// <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(); if (rect == null) { rect = new Rect(); } rect.ReadData(binaryReader); if (matrix == null) { matrix = new Matrix(); } matrix.ReadData(binaryReader); TextRecordCollection.GLYPH_BITS = binaryReader.ReadByte(); TextRecordCollection.ADVANCE_BITS = binaryReader.ReadByte(); if (textRecords == null) { textRecords = new TextRecordCollection(); } else { textRecords.Clear(); } bool endOfRecordsFlag = false; while (!endOfRecordsFlag) { TextRecord textRecord = new TextRecord(); textRecord.ReadData(binaryReader, ref endOfRecordsFlag, (TagCodeEnum)this.TagCode); if (!endOfRecordsFlag) { textRecords.Add(textRecord); } } }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { byte numGradients = binaryReader.ReadByte(); for (int i = 0; i < numGradients; i++) { MorphGradRecord morph = new MorphGradRecord(); morph.ReadData(binaryReader); this.Add(morph); } }
public static ITranscriptRegion Read(BufferedBinaryReader reader) { TranscriptRegionType type = (TranscriptRegionType)reader.ReadByte(); ushort id = reader.ReadOptUInt16(); int genomicStart = reader.ReadOptInt32(); int genomicEnd = reader.ReadOptInt32(); int cdnaStart = reader.ReadOptInt32(); int cdnaEnd = reader.ReadOptInt32(); return(new TranscriptRegion(type, id, genomicStart, genomicEnd, cdnaStart, cdnaEnd)); }
/// <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(); }
public ColorPaletteBlock(BufferedBinaryReader br, ushort majorVersion) { this.chunkSize = majorVersion > PSPConstants.majorVersion5 ? br.ReadUInt32() : 0; this.entriesCount = br.ReadUInt32(); this.entries = new NativeStructs.RGBQUAD[this.entriesCount]; for (int i = 0; i < this.entriesCount; i++) { this.entries[i].rgbBlue = br.ReadByte(); this.entries[i].rgbGreen = br.ReadByte(); this.entries[i].rgbRed = br.ReadByte(); this.entries[i].rgbReserved = br.ReadByte(); } long dif = (long)this.chunkSize - HeaderSize; if (dif > 0 && majorVersion > PSPConstants.majorVersion5) { br.Position += dif; } }
public SEHBlock(BufferedBinaryReader reader, bool fatFormat) { if (fatFormat) { Flags = (SEHFlags)reader.ReadInt32(); TryOffset = reader.ReadInt32(); TryLength = reader.ReadInt32(); HandlerOffset = reader.ReadInt32(); HandlerLength = reader.ReadInt32(); Value = reader.ReadInt32(); } else { Flags = (SEHFlags)reader.ReadInt16(); TryOffset = reader.ReadInt16(); TryLength = reader.ReadByte(); HandlerOffset = reader.ReadInt16(); HandlerLength = reader.ReadByte(); Value = reader.ReadInt32(); } }
/// <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); soundData = new byte[rh.TagLength]; for (uint i = 0; i < rh.TagLength; 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); binaryReader.ReadByte(); int lenght = System.Convert.ToInt32(rh.TagLength - 1); password = binaryReader.ReadString(); //char[] password = br.ReadChars(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(); }
private uint calculateDuration(BufferedBinaryReader source, uint loopStart, uint nbLoops) { long streamSize = source.Length; byte frameType; uint frameIndex = 0; uint nbTicks_all = 0; uint nbTicks_loop = 0; bool loopReached = false; while (source.Position < streamSize) { frameIndex++; if (frameIndex == loopStart) { loopReached = true; } frameType = source.ReadByte(); switch (frameType) { case (0x00): nbTicks_all++; if (loopReached) { nbTicks_loop++; } break; case (0x01): case (0x02): source.Seek(2, SeekOrigin.Current); break; case (0x03): source.Seek(1, SeekOrigin.Current); break; } } uint result = (nbTicks_all - nbTicks_loop) + (nbLoops * nbTicks_loop); if (Settings.GYM_VGM_playbackRate > 0) { result = (uint)Math.Round(result * (1.0 / Settings.GYM_VGM_playbackRate)); } else { result = (uint)Math.Round(result * (1.0 / PLAYBACK_RATE_DEFAULT)); } if (loopStart > 0) { result += FADEOUT_DURATION_DEFAULT; } return(result); }
/// <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(); } } }