public IPHeader(ArraySegment<byte> buffer) { using (var memoryStream = new MemoryStream(buffer.Array, buffer.Offset, buffer.Count)) { using (var binaryReader = new BinaryReader(memoryStream)) { var versionAndHeaderLength = binaryReader.ReadByte(); var differentiatedServices = binaryReader.ReadByte(); DifferentiatedServices = (byte)(differentiatedServices >> 2); CongestionNotification = (byte)(differentiatedServices & 0x03); TotalLength = (ushort) IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); Debug.Assert(TotalLength >= 20, "Invalid IP packet Total Lenght"); Identification = (ushort) IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _flagsAndOffset = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); Ttl = binaryReader.ReadByte(); _protocol = binaryReader.ReadByte(); Checksum = IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); SourceAddress = new IPAddress(binaryReader.ReadUInt32()); DestinationAddress = new IPAddress(binaryReader.ReadUInt32()); HeaderLength = (versionAndHeaderLength & 0x0f) * 4; } } Raw = buffer; Data = new ArraySegment<byte>(buffer.Array, buffer.Offset + HeaderLength, MessageLength); }
static Map LoadHeaderInternal( [NotNull] Stream stream ) { if( stream == null ) throw new ArgumentNullException( "stream" ); BinaryReader reader = new BinaryReader( stream ); // Read in the magic number if( reader.ReadUInt32() != Identifier ) { throw new MapFormatException(); } // Read in the map dimesions int width = reader.ReadInt16(); int length = reader.ReadInt16(); int height = reader.ReadInt16(); // ReSharper disable UseObjectOrCollectionInitializer Map map = new Map( null, width, length, height, false ); // ReSharper restore UseObjectOrCollectionInitializer // Read in the spawn location map.Spawn = new Position { X = reader.ReadInt16(), Y = reader.ReadInt16(), Z = reader.ReadInt16(), R = reader.ReadByte(), L = reader.ReadByte() }; return map; }
public static void AddCliloc( string lang ) { StringList list = StringList.GetList( lang ); if ( list == null ) list = StringList.AddLanguage( lang ); string path = Core.FindDataFile( String.Format( "cliloc.{0}", lang ) ); if ( path == null ) { Console.WriteLine( "Warning: cliloc.{0} not found", lang ); return; } using ( BinaryReader bin = new BinaryReader( new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.Read ), Encoding.ASCII ) ) { bin.ReadInt32(); bin.ReadInt16(); Encoding utf8 = Encoding.GetEncoding( "UTF-8", new EncoderReplacementFallback(""), new DecoderReplacementFallback("") ); while ( bin.PeekChar() != -1 ) { int number = bin.ReadInt32(); bin.ReadByte(); //State in Cliloc int length = bin.ReadInt16(); //Max of 65535 characters StringEntry entry = new StringEntry( number, LState.Original, StringList.FormatArguments( utf8.GetString( bin.ReadBytes( length ) ) ) ); list.Table[number] = entry; } bin.Close(); } }
//public ushort MaxAudioLevel; private static WaveProcessor WaveHeaderIN(char Digit) { String Path = HttpContext.Current.Server.MapPath(String.Format("~/Epayment/DigitVoice/{0}.WAV", Digit)); FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); try { WaveProcessor Header = new WaveProcessor {Length = (int) fs.Length - 8}; fs.Position = 22; Header.Channels = br.ReadInt16(); //1 fs.Position = 24; Header.SampleRate = br.ReadInt32(); //8000 fs.Position = 34; Header.BitsPerSample = br.ReadInt16(); //16 Header.DataLength = (int)fs.Length - 44; byte[] arrfile = new byte[fs.Length - 44]; fs.Position = 44; fs.Read(arrfile, 0, arrfile.Length); return Header; } finally { br.Close(); fs.Close(); } }
private static bool ParseFileHeader(BinaryReader reader, out string filename) { filename = null; if (reader.BaseStream.Position < reader.BaseStream.Length) { int headerSignature = reader.ReadInt32(); if (headerSignature == 67324752) //PKZIP { reader.BaseStream.Seek(14, SeekOrigin.Current); //ignore unneeded values int compressedSize = reader.ReadInt32(); int unCompressedSize = reader.ReadInt32(); short fileNameLenght = reader.ReadInt16(); short extraFieldLenght = reader.ReadInt16(); filename = new string(reader.ReadChars(fileNameLenght)); if (string.IsNullOrEmpty(filename)) return false; //Seek to the next file header reader.BaseStream.Seek(extraFieldLenght + compressedSize, SeekOrigin.Current); if (unCompressedSize == 0) //Directory or not supported. Skip it return ParseFileHeader(reader, out filename); else return true; } } return false; }
/// <summary> /// The read. /// </summary> /// <param name="client"> /// </param> /// <param name="packet"> /// </param> public static void Read(Client client, byte[] packet) { LogUtil.Debug(DebugInfoDetail.Network, "\r\nReceived:\r\n" + HexOutput.Output(packet)); MemoryStream m_stream = new MemoryStream(packet); BinaryReader m_reader = new BinaryReader(m_stream); // now we should do password check and then send OK or Error // sending OK now m_stream.Position = 8; short userNameLength = IPAddress.NetworkToHostOrder(m_reader.ReadInt16()); string userName = Encoding.ASCII.GetString(m_reader.ReadBytes(userNameLength)); short loginKeyLength = IPAddress.NetworkToHostOrder(m_reader.ReadInt16()); string loginKey = Encoding.ASCII.GetString(m_reader.ReadBytes(loginKeyLength)); LoginEncryption loginEncryption = new LoginEncryption(); if (loginEncryption.IsValidLogin(loginKey, client.ServerSalt, userName)) { client.IsBot = true; byte[] chars = AccountCharacterList.Create(userName); LogUtil.Debug(DebugInfoDetail.Network, "\r\nReceived:\r\n" + HexOutput.Output(chars)); client.Send(chars); } else { byte[] loginerr = LoginError.Create(); client.Send(loginerr); client.Server.DisconnectClient(client); } }
public wavefile(FileStream file) { BinaryReader binRead = new BinaryReader(file); //head data ChunkID = binRead.ReadChars(4); ChunkSize = binRead.ReadInt32(); Format = binRead.ReadChars(4); Subchunk1ID = binRead.ReadChars(4); Subchunk1Size = binRead.ReadInt32();//in bytes AudioFormat = binRead.ReadInt16(); NumChannels = binRead.ReadInt16(); SampleRate = binRead.ReadInt32();//samples per second? ByteRate = binRead.ReadInt32(); BlockAlign = binRead.ReadInt16(); BitsPerSample = binRead.ReadInt16(); Subchunk2ID = binRead.ReadChars(4); Subchunk2Size = binRead.ReadInt32();//in bytes int numSamples = Subchunk2Size / (BitsPerSample / 8); data = new byte[numSamples]; wave = new float[numSamples]; data = binRead.ReadBytes(numSamples); for (int i = 0; i < numSamples; i++) { wave[i] = ((float)data[i] - 128) / 128; } }
public UDPHeader(byte[] byBuffer, int nReceived) { try { using (var memoryStream = new MemoryStream(byBuffer, 0, nReceived)) { using (var binaryReader = new BinaryReader(memoryStream)) { _sourcePort = (ushort) IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _destinationPort = (ushort) IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _length = (ushort) IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _checksum = IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); var tempData = new byte[nReceived - 8]; Array.Copy(byBuffer, 8, tempData, 0, nReceived - 8); foreach (var b in tempData) { _data.Add(b); } } } } catch (Exception ex) { } }
public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); Interaction = reader.ReadUInt16(); CalleeID = reader.ReadInt16(); Param0 = reader.ReadInt16(); }
static ItemBounds() { m_Bounds = new Rectangle2D[TileData.ItemTable.Length]; if (File.Exists("Data/Binary/Bounds.bin")) { using (FileStream fs = new FileStream("Data/Binary/Bounds.bin", FileMode.Open, FileAccess.Read, FileShare.Read)) { BinaryReader bin = new BinaryReader(fs); int count = Math.Min(m_Bounds.Length, (int)(fs.Length / 8)); for (int i = 0; i < count; ++i) { int xMin = bin.ReadInt16(); int yMin = bin.ReadInt16(); int xMax = bin.ReadInt16(); int yMax = bin.ReadInt16(); m_Bounds[i].Set(xMin, yMin, (xMax - xMin) + 1, (yMax - yMin) + 1); } bin.Close(); } } else { Console.WriteLine("Warning: Data/Binary/Bounds.bin does not exist"); } }
/// <summary> /// Initializes new instance. /// </summary> public TinyImage(Stream stream) { BinaryReader reader = new BinaryReader(stream, Encoding.ASCII); Width = reader.ReadInt16(); Height = reader.ReadInt16(); ImageData = reader.ReadBytes(Width*Height); }
/// <summary> /// Parse an IDX file /// </summary> /// <param name="streamIdx">stream that contains IDX data</param> /// <param name="streamImg">stream that contains IMG data</param> public IDX(System.IO.Stream streamIdx, System.IO.Stream streamImg) { BinaryReader reader = new BinaryReader(streamIdx); // First 4 bytes are the entries count filesCount = reader.ReadInt32(); idx = new FileIdx[filesCount]; // Parse IDX file for (int i = 0; i < filesCount; i++) { idx[i].hash32 = reader.ReadInt32(); idx[i].hash16 = reader.ReadInt16(); idx[i].clength = reader.ReadInt16(); idx[i].position = reader.ReadInt32(); idx[i].length = reader.ReadInt32(); idx[i].compressed = (idx[i].clength & 0x4000) != 0; idx[i].streamed = (idx[i].clength & 0x8000) != 0; idx[i].clength = (idx[i].clength & 0x3FFF) * 0x800 + 0x800; idx[i].position *= 0x800; } // Get the stream of IMG this.streamImg = streamImg; }
public void Load(string Path) { this.path = Path; BinaryReader binaryReader = new BinaryReader(File.Open(Path, FileMode.Open)); short num = binaryReader.ReadInt16(); for (int i = 0; i < (int)num; i++) { ZSC.Mesh mesh = new ZSC.Mesh(); mesh.read(ref binaryReader); this.listMesh.Add(mesh); } short num2 = binaryReader.ReadInt16(); for (int i = 0; i < (int)num2; i++) { ZSC.Materiel materiel = new ZSC.Materiel(); materiel.read(ref binaryReader); this.listMateriel.Add(materiel); } short num3 = binaryReader.ReadInt16(); for (int i = 0; i < (int)num3; i++) { ZSC.Effect effect = new ZSC.Effect(); effect.read(ref binaryReader); this.listEffect.Add(effect); } short num4 = binaryReader.ReadInt16(); for (int i = 0; i < (int)num4; i++) { ZSC.Object @object = new ZSC.Object(); @object.read(ref binaryReader); this.listObject.Add(@object); } binaryReader.Close(); }
// As found in .DAT archives (RESOURCE.DAT, IO.DAT) public void Load(string destinationDirectory, string baseName, BinaryReader binaryReader) { xOffset = binaryReader.ReadInt16(); yOffset = binaryReader.ReadInt16(); binaryReader.BaseStream.Seek(4, SeekOrigin.Current); width = binaryReader.ReadUInt16(); height = binaryReader.ReadUInt16(); binaryReader.BaseStream.Seek(2, SeekOrigin.Current); uint length = binaryReader.ReadUInt32(); var imageOffset = binaryReader.BaseStream.Position; var rowDataOffsets = new ushort[height]; for (int i = 0; i < height; ++i) { rowDataOffsets[i] = binaryReader.ReadUInt16(); } var bmp = new Bmp(width, height); var imageData = binaryReader.ReadBytes((int)length - 2*height); ReadImage(imageData, rowDataOffsets, false, bmp.Data); Debug.Assert(binaryReader.BaseStream.Position - imageOffset == length); bmp.Save(Path.Combine(destinationDirectory, baseName), ImageFormat); Bmp.SaveOffsets(baseName, xOffset, yOffset); }
public static Bitmap Open(string filePath) { using (var reader = new BinaryReader(new FileStream(filePath, FileMode.Open, FileAccess.Read))) { if(new string(reader.ReadChars(3)) != "PSF" || reader.ReadByte() != 1) throw new Exception(); var width = reader.ReadInt16(); var height = reader.ReadInt16(); var alphaMark = reader.ReadByte(); var bmp = new Bitmap(width, height); var bmpData = bmp.LockBits(new Rectangle(Point.Empty, bmp.Size), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb); try { var scanPointer = bmpData.Scan0; for (var y = 0; y < bmpData.Height; y++, scanPointer += bmpData.Stride) { var dataBuffer = reader.ReadBytes(bmpData.Width * 4); Marshal.Copy(dataBuffer, 0, scanPointer, dataBuffer.Length); } return bmp; } finally { bmp.UnlockBits(bmpData); } } }
public static byte[] GetWaveData(BinaryReader file, ref WaveInfo waveInfo) { byte[] returnData; //Read the wave file header from the buffer. waveInfo.ChunkID = file.ReadInt32(); waveInfo.FileSize = file.ReadInt32(); waveInfo.RiffType = file.ReadInt32(); waveInfo.FormatID = file.ReadInt32(); waveInfo.FormatSize = file.ReadInt32(); waveInfo.FormatCode = file.ReadInt16(); waveInfo.Channels = file.ReadInt16(); waveInfo.SampleRate = file.ReadInt32(); waveInfo.FormatAverageBps = file.ReadInt32(); waveInfo.FormatBlockAlign = file.ReadInt16(); waveInfo.BitDepth = file.ReadInt16(); if (waveInfo.FormatSize == 18) { // Read any extra values waveInfo.FormatExtraSize = file.ReadInt16(); file.ReadBytes(waveInfo.FormatExtraSize); } waveInfo.DataID = file.ReadInt32(); waveInfo.DataSize = file.ReadInt32(); // Store the audio data of the wave file to a byte array. returnData = file.ReadBytes(waveInfo.DataSize); return returnData; }
public void LoadFromStream(BinaryReader reader) { this.First = reader.ReadInt16(); this.Second = reader.ReadInt16(); this.UseLine = reader.ReadInt16(); this.Third = reader.ReadInt16(); }
static Map LoadHeaderInternal( [NotNull] Stream stream ) { if( stream == null ) throw new ArgumentNullException( "stream" ); BinaryReader bs = new BinaryReader( stream ); // Read in the magic number if( bs.ReadByte() != 0xbe || bs.ReadByte() != 0xee || bs.ReadByte() != 0xef ) { throw new MapFormatException( "MapMinerCPP: Map header is incorrect." ); } // Read in the map dimesions // Saved in big endian for who-knows-what reason. // XYZ(?) int width = IPAddress.NetworkToHostOrder( bs.ReadInt16() ); int height = IPAddress.NetworkToHostOrder( bs.ReadInt16() ); int length = IPAddress.NetworkToHostOrder( bs.ReadInt16() ); // ReSharper disable UseObjectOrCollectionInitializer Map map = new Map( null, width, length, height, false ); // ReSharper restore UseObjectOrCollectionInitializer // Read in the spawn location // XYZ(?) map.Spawn = new Position { X = IPAddress.NetworkToHostOrder( bs.ReadInt16() ), Z = IPAddress.NetworkToHostOrder( bs.ReadInt16() ), Y = IPAddress.NetworkToHostOrder( bs.ReadInt16() ), R = bs.ReadByte(), L = bs.ReadByte() }; // Skip over the block count, totally useless bs.ReadInt32(); return map; }
public EscortData(System.IO.BinaryReader reader) { position = reader.ReadVector3(); duration = reader.ReadInt16(); id = reader.ReadString(32); unknown = reader.ReadInt16(); }
public unsafe FlacMetadataStreamInfo(Stream stream, Int32 length, bool lastBlock) : base(FlacMetaDataType.StreamInfo, lastBlock, length) { //http://flac.sourceforge.net/format.html#metadata_block_streaminfo BinaryReader reader = new BinaryReader(stream, Encoding.ASCII); try { MinBlockSize = reader.ReadInt16(); MaxBlockSize = reader.ReadInt16(); } catch (IOException e) { throw new FlacException(e, FlacLayer.Metadata); } int bytesToRead = (240 / 8) - 16; byte[] buffer = reader.ReadBytes(bytesToRead); if (buffer.Length != bytesToRead) throw new FlacException(new EndOfStreamException("Could not read StreamInfo-content"), FlacLayer.Metadata); fixed (byte* b = buffer) { FlacBitReader bitreader = new FlacBitReader(b, 0); MinFrameSize = bitreader.ReadBits(24); MaxFrameSize = bitreader.ReadBits(24); SampleRate = (int)bitreader.ReadBits(20); Channels = 1 + (int)bitreader.ReadBits(3); BitsPerSample = 1 + (int)bitreader.ReadBits(5); TotalSamples = (long)bitreader.ReadBits64(36); MD5 = new String(reader.ReadChars(16)); } }
private ushort usTotalLength; //Шестнадцать битов для общей длины датаграммы (заголовок + сообщение) #endregion Fields #region Constructors public IPHeader(byte[] byBuffer, int nReceived) { try { MemoryStream memoryStream = new MemoryStream(byBuffer, 0, nReceived); BinaryReader binaryReader = new BinaryReader(memoryStream); byVersionAndHeaderLength = binaryReader.ReadByte(); byDifferentiatedServices = binaryReader.ReadByte(); usTotalLength = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); usIdentification = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); usFlagsAndOffset = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); byTTL = binaryReader.ReadByte(); byProtocol = binaryReader.ReadByte(); sChecksum = IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); uiSourceIPAddress = (uint)(binaryReader.ReadInt32()); uiDestinationIPAddress = (uint)(binaryReader.ReadInt32()); byHeaderLength = byVersionAndHeaderLength; byHeaderLength <<= 4; byHeaderLength >>= 4; byHeaderLength *= 4; Array.Copy(byBuffer, byHeaderLength, byIPData, 0, usTotalLength - byHeaderLength); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private static bool Version(BinaryReader reader) { reader.ReadInt16(); // minor var major = reader.ReadInt16(); return major == 2 || major == 3; }
public void ReadFromStream(Stream stream) { BinaryReader br = new BinaryReader(stream); SamplesPerBlock = br.ReadInt16(); CoefficientsCount = br.ReadInt16(); Coefficients = stream.ReadContent<AdPcmCoefficientSet>(CoefficientsCount); }
public void load_chr(string path) { this.listBox.Items.Clear(); BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open), Encoding.GetEncoding("EUC-KR")); int num = (int)binaryReader.ReadInt16(); for (int num2 = 0; num2 != num; num2++) { Mesh mesh = new Mesh(); mesh.read(ref binaryReader); this.list_mesh.Add(mesh); } int num3 = (int)binaryReader.ReadInt16(); for (int num2 = 0; num2 != num3; num2++) { Materiel materiel = new Materiel(); materiel.read(ref binaryReader); this.list_materiel.Add(materiel); } int num4 = (int)binaryReader.ReadInt16(); for (int num2 = 0; num2 != num4; num2++) { Effect effect = new Effect(); effect.read(ref binaryReader); this.list_effect.Add(effect); } int num5 = (int)binaryReader.ReadInt16(); for (int num2 = 0; num2 != num5; num2++) { Object @object = new Object(); @object.read(ref binaryReader); this.list_object.Add(@object); this.listBox.Items.Add("Entry [" + num2 + "] : "); } binaryReader.Close(); }
public void Load(string filePath, ClientType clientType) { this.Path = filePath; this.clientType = clientType; BinaryReader binaryReader = new BinaryReader(File.Open(filePath, FileMode.Open)); short num = binaryReader.ReadInt16(); this.listDDS = new List<TSI.DDS>((int)num); for (int i = 0; i < (int)num; i++) { TSI.DDS dDS = new TSI.DDS(); dDS.Path = RoseFile.ReadSString(ref binaryReader); dDS.ColourKey = binaryReader.ReadInt32(); this.listDDS.Add(dDS); } short num2 = binaryReader.ReadInt16(); for (int i = 0; i < (int)num; i++) { short num3 = binaryReader.ReadInt16(); this.listDDS[i].ListDDS_element = new List<TSI.DDS.DDSElement>((int)num3); for (int j = 0; j < (int)num3; j++) { TSI.DDS.DDSElement dDSElement = new TSI.DDS.DDSElement(); dDSElement.OwnerId = binaryReader.ReadInt16(); dDSElement.X = binaryReader.ReadInt32(); dDSElement.Y = binaryReader.ReadInt32(); dDSElement.Width = binaryReader.ReadInt32() - dDSElement.X; dDSElement.Height = binaryReader.ReadInt32() - dDSElement.Y; dDSElement.Color = binaryReader.ReadInt32(); dDSElement.Name = RoseFile.ReadFString(ref binaryReader, 32); this.listDDS[i].ListDDS_element.Add(dDSElement); } } binaryReader.Close(); }
public void Load(string destinationDirectory, string resourceName, BinaryReader binaryReader) { binaryReader.BaseStream.Seek(2, SeekOrigin.Current); uint length = binaryReader.ReadUInt32(); byte[] imageData = binaryReader.ReadBytes((int)length); short xOffset = binaryReader.ReadInt16(); short yOffset = binaryReader.ReadInt16(); ushort width = binaryReader.ReadUInt16(); ushort height = binaryReader.ReadUInt16(); binaryReader.BaseStream.Seek(8, SeekOrigin.Current); var bmp = new Bmp(width, height); var colorData = bmp.Data; var palette = PaletteLoader.DefaultPalette; int index = 0; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { colorData[y, x] = palette.Colors[imageData[index]]; ++index; } } bmp.Save(Path.Combine(destinationDirectory, resourceName), ImageFormat); Bmp.SaveOffsets(resourceName, xOffset, yOffset); }
public StringTable(string path) { m_Entries = new Dictionary<int, StringEntry>(); using (BinaryReader bin = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))) { m_Header1 = bin.ReadInt32(); m_Header2 = bin.ReadInt16(); byte[] m_Buffer = new byte[1024]; while (bin.BaseStream.Length != bin.BaseStream.Position) { int number = bin.ReadInt32(); byte flag = bin.ReadByte(); int length = bin.ReadInt16(); if (length > m_Buffer.Length) m_Buffer = new byte[(length + 1023) & ~1023]; bin.Read(m_Buffer, 0, length); string text = Encoding.UTF8.GetString(m_Buffer, 0, length); m_Entries.Add(number, new StringEntry(number, text, flag)); } } }
static ItemBounds() { string path = Path.Combine(Path.Combine(Core.Config.ConfigDirectory, "Binary"), "Bounds.bin"); if ( File.Exists( path ) ) { using ( FileStream fs = new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { BinaryReader bin = new BinaryReader( fs ); m_Bounds = new Rectangle2D[0x4000]; for ( int i = 0; i < 0x4000; ++i ) { int xMin = bin.ReadInt16(); int yMin = bin.ReadInt16(); int xMax = bin.ReadInt16(); int yMax = bin.ReadInt16(); m_Bounds[i].Set( xMin, yMin, (xMax - xMin) + 1, (yMax - yMin) + 1 ); } bin.Close(); } } else { log.Warn(String.Format("{0} does not exist", path)); m_Bounds = new Rectangle2D[0x4000]; } }
public static Message ReadMessage(Stream input) { var buffer = new BinaryReader(input); Message msg = new Message(); msg.ProtocolVersion = buffer.ReadByte(); msg.MessageType = buffer.ReadByte(); // read kv IDictionary<string, object> dict = new Dictionary<string, object>(); short headerType = buffer.ReadInt16(); while (headerType != MessageType.HeaderType.EndOfHeaders) { if (headerType == MessageType.HeaderType.Custom) dict.Add(ReadCountedString(buffer), ReadCustomValue(buffer)); else if (headerType == MessageType.HeaderType.StatusCode) msg.StatusCode = buffer.ReadInt32(); else if (headerType == MessageType.HeaderType.StatusPhrase) msg.StatusPhase = ReadCountedString(buffer); else if (headerType == MessageType.HeaderType.Flag) msg.Flag = buffer.ReadInt32(); else if (headerType == MessageType.HeaderType.Token) msg.Token = ReadCountedString(buffer); headerType = buffer.ReadInt16(); } msg.Content = dict; return msg; }
/// <summary> /// /// </summary> /// <param name="stream"></param> /// <returns></returns> public static DibSection GetDibData(Stream stream) { var data = new DibSection(); var reader = new BinaryReader(stream); reader.BaseStream.Seek(0, SeekOrigin.Begin); if (reader.ReadByte() != 'B' || reader.ReadByte() != 'M') { throw new ArgumentException("Invalid bitmap stream.", "stream"); } reader.BaseStream.Seek(10, SeekOrigin.Begin); var offBits = reader.ReadInt32(); reader.ReadInt32(); // biSize data.Width = reader.ReadInt32(); data.Height = reader.ReadInt32(); reader.ReadInt16(); // biPlanes data.BitCount = reader.ReadInt16(); reader.BaseStream.Seek(offBits, SeekOrigin.Begin); data.pixelsPerY = (((data.Width * (data.BitCount >> 3)) + 3) >> 2) << 2; data.data = reader.ReadBytes(data.pixelsPerY * data.Height); return data; }
public IPHeader(byte[] byBuffer, int nReceived) { try { using (var memoryStream = new MemoryStream(byBuffer, 0, nReceived)) { using (var binaryReader = new BinaryReader(memoryStream)) { _versionAndHeaderLength = binaryReader.ReadByte(); _differentiatedServices = binaryReader.ReadByte(); _totalLength = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _identification = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _flags = (ushort)IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _TTL = binaryReader.ReadByte(); _protocol = binaryReader.ReadByte(); _checksum = IPAddress.NetworkToHostOrder(binaryReader.ReadInt16()); _sourceIPAddress = (uint)(binaryReader.ReadInt32()); _destinationIPAddress = (uint)(binaryReader.ReadInt32()); _headerLength = _versionAndHeaderLength; _headerLength <<= 4; _headerLength >>= 4; _headerLength *= 4; var tempData = new byte[_totalLength - _headerLength]; Array.Copy(byBuffer, _headerLength, tempData, 0, _totalLength - _headerLength); foreach (var b in tempData) { _data.Add(b); } } } } catch (Exception ex) { } }
public void FromBytes(byte[] bytes) { System.IO.BinaryReader reader = new System.IO.BinaryReader(new System.IO.MemoryStream(bytes)); Id = readString(reader); Name = readString(reader); short size = reader.ReadInt16(); log("Photo size == " + size); if (size > 0) { byte[] photo = reader.ReadBytes((int)size); PhotoTexture = new Texture2D(2, 2); PhotoTexture.LoadImage(photo); } size = reader.ReadInt16(); log("Phones size == " + size); if (size > 0) { for (int i = 0; i < size; i++) { PhoneContact pc = new PhoneContact(); pc.Number = readString(reader); pc.Type = readString(reader); Phones.Add(pc); } } size = reader.ReadInt16(); log("Emails size == " + size); if (size > 0) { for (int i = 0; i < size; i++) { EmailContact ec = new EmailContact(); ec.Address = readString(reader); ec.Type = readString(reader); Emails.Add(ec); } } size = reader.ReadInt16(); log("Connections size == " + size); if (size > 0) { for (int i = 0; i < size; i++) { string connection = readString(reader); Connections.Add(connection); } } }
public HeightData(System.IO.BinaryReader reader) { ReferenceHeight = reader.ReadSingle(); HeightPoints = reader.ReadSByteArray(65 * 65); reader.ReadInt16(); // always -22801, or (239, 166)? reader.ReadSByte(); // always 0, deleted? }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.ProjectileProjectileFlags = ((ProjectileFlags)(binaryReader.ReadInt32())); this.DetonationTimerStarts = ((DetonationTimerStartsEnum)(binaryReader.ReadInt16())); this.ImpactNoise = ((ImpactNoiseEnum)(binaryReader.ReadInt16())); this.AIPerceptionRadius = binaryReader.ReadSingle(); this.CollisionRadius = binaryReader.ReadSingle(); this.ArmingTime = binaryReader.ReadSingle(); this.DangerRadius = binaryReader.ReadSingle(); this.Timer = binaryReader.ReadRange(); this.MinimumVelocity = binaryReader.ReadSingle(); this.MaximumRange = binaryReader.ReadSingle(); this.DetonationNoise = ((DetonationNoiseEnum)(binaryReader.ReadInt16())); this.SuperDetProjectileCount = binaryReader.ReadInt16(); this.DetonationStarted = binaryReader.ReadTagReference(); this.DetonationEffect = binaryReader.ReadTagReference(); this.DetonationEffect0 = binaryReader.ReadTagReference(); this.DetonationDamage = binaryReader.ReadTagReference(); this.AttachedDetonationDamage = binaryReader.ReadTagReference(); this.SuperDetonation = binaryReader.ReadTagReference(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.YourMomma.ReadFields(binaryReader))); this.DetonationSound = binaryReader.ReadTagReference(); this.DamageReportingType = ((DamageReportingTypeEnum)(binaryReader.ReadByte())); this.fieldpad3 = binaryReader.ReadBytes(3); this.SuperAttachedDetonationDamage = binaryReader.ReadTagReference(); this.MaterialEffectRadius = binaryReader.ReadSingle(); this.FlybySound = binaryReader.ReadTagReference(); this.ImpactEffect = binaryReader.ReadTagReference(); this.ImpactDamage = binaryReader.ReadTagReference(); this.BoardingDetonationTime = binaryReader.ReadSingle(); this.BoardingDetonationDamage = binaryReader.ReadTagReference(); this.BoardingAttachedDetonationDamage = binaryReader.ReadTagReference(); this.AirGravityScale = binaryReader.ReadSingle(); this.AirDamageRange = binaryReader.ReadRange(); this.WaterGravityScale = binaryReader.ReadSingle(); this.WaterDamageRange = binaryReader.ReadRange(); this.InitialVelocity = binaryReader.ReadSingle(); this.FinalVelocity = binaryReader.ReadSingle(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Blah.ReadFields(binaryReader))); this.GuidedAngularVelocity = binaryReader.ReadSingle(); this.AccelerationRange = binaryReader.ReadRange(); this.fieldpad4 = binaryReader.ReadBytes(4); this.TargetedLeadingFraction = binaryReader.ReadSingle(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(88)); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Name = binaryReader.ReadStringID(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(1)); this.Type = ((TypeEnum)(binaryReader.ReadInt16())); this.ShaderTemplateParameterFlags = ((Flags)(binaryReader.ReadInt16())); this.DefaultBitmap = binaryReader.ReadTagReference(); this.DefaultConstValue = binaryReader.ReadSingle(); this.DefaultConstColor = binaryReader.ReadColorR8G8B8(); this.BitmapType = ((BitmapTypeEnum)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.ShaderTemplateParameterBitmapAnimationFlags = ((BitmapAnimationFlags)(binaryReader.ReadInt16())); this.fieldpad0 = binaryReader.ReadBytes(2); this.BitmapScale = binaryReader.ReadSingle(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.ShapeType = ((ShapeTypeEnum)(binaryReader.ReadInt16())); this.Shape = binaryReader.ReadShortBlockIndex2(); this.CollisionFilter = binaryReader.ReadInt32(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.CharacterMovementMovementFlags = ((MovementFlags)(binaryReader.ReadInt32())); this.PathfindingRadius = binaryReader.ReadSingle(); this.DestinationRadius = binaryReader.ReadSingle(); this.DiveGrenadeChance = binaryReader.ReadSingle(); this.ObstacleLeapMinSize = ((ObstacleLeapMinSizeEnum)(binaryReader.ReadInt16())); this.ObstacleLeapMaxSize = ((ObstacleLeapMaxSizeEnum)(binaryReader.ReadInt16())); this.ObstacleIgnoreSize = ((ObstacleIgnoreSizeEnum)(binaryReader.ReadInt16())); this.ObstacleSmashableSize = ((ObstacleSmashableSizeEnum)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.JumpHeight = ((JumpHeightEnum)(binaryReader.ReadInt16())); this.CharacterMovementMovementHints = ((MovementHints)(binaryReader.ReadInt32())); this.ThrottleScale = binaryReader.ReadSingle(); return(pointerQueue); }
public PaletteImage(System.IO.BinaryReader br, bool compressed) { try { this.Width = br.ReadInt16(); this.Height = br.ReadInt16(); this.Size = Convert.ToInt32(this.Width) * Convert.ToInt32(this.Height); if (compressed) { this.Size = br.ReadUInt16(); } this.Data = br.ReadBytes(this.Size); } catch (Exception ex) { } }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.ClothFlags = ((Flags)(binaryReader.ReadInt32())); this.MarkerAttachmentName = binaryReader.ReadStringID(); this.Shader = binaryReader.ReadTagReference(); this.GridXDimension = binaryReader.ReadInt16(); this.GridYDimension = binaryReader.ReadInt16(); this.GridSpacingX = binaryReader.ReadSingle(); this.GridSpacingY = binaryReader.ReadSingle(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Properties.ReadFields(binaryReader))); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(20)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(2)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(2)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16)); return(pointerQueue); }
/// <summary> /// Reads the binary representation of this driver from the stream. /// </summary> /// <param name="reader">Input stream</param> public void ReadBinaryData(System.IO.BinaryReader reader) { type = (JointDriverType)((int)reader.ReadByte()); port1 = reader.ReadInt16(); port2 = reader.ReadInt16(); lowerLimit = reader.ReadSingle(); upperLimit = reader.ReadSingle(); isCan = reader.ReadBoolean(); int extensions = reader.ReadInt32(); MetaInfo.Clear(); for (int i = 0; i < extensions; i++) { JointDriverMeta meta = JointDriverMeta.ReadDriverMeta(reader); AddInfo(meta); } }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.NodeIndex = binaryReader.ReadInt16(); this.fieldpad = binaryReader.ReadBytes(2); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Bsp.ReadFields(binaryReader))); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Type = ((TypeEnum)(binaryReader.ReadInt16())); this.ScenarioLightStructFlags = ((Flags)(binaryReader.ReadInt16())); this.LightmapType = ((LightmapTypeEnum)(binaryReader.ReadInt16())); this.ScenarioLightStructLightmapFlags = ((LightmapFlags)(binaryReader.ReadInt16())); this.LightmapHalfLife = binaryReader.ReadSingle(); this.LightmapLightScale = binaryReader.ReadSingle(); this.TargetPoint = binaryReader.ReadVector3(); this.Width = binaryReader.ReadSingle(); this.HeightScale = binaryReader.ReadSingle(); this.FieldOfView = binaryReader.ReadSingle(); this.FalloffDistance = binaryReader.ReadSingle(); this.CutoffDistance = binaryReader.ReadSingle(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Point = binaryReader.ReadVector3(); this.ReferenceFrame = binaryReader.ReadInt16(); this.fieldpad = binaryReader.ReadBytes(2); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.RigidNodeIndex = binaryReader.ReadByte(); this.NodesPoint = binaryReader.ReadByte(); this.PointCount = binaryReader.ReadInt16(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.NaturalPitch = binaryReader.ReadInt16(); this.BendBounds = binaryReader.ReadInt32(); this.MaxGainPitchBounds = binaryReader.ReadInt32(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Property = ((PropertyEnum)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.ParameterName = binaryReader.ReadStringID(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.ReferenceFrameIndex = binaryReader.ReadInt16(); this.ProjectionAxis = binaryReader.ReadByte(); this.EnvironmentObjectNodesProjectionSign = ((ProjectionSign)(binaryReader.ReadByte())); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.fieldskip = binaryReader.ReadBytes(4); this.Size = binaryReader.ReadInt16(); this.Count = binaryReader.ReadInt16(); this.fieldskip0 = binaryReader.ReadBytes(4); this.NumSpheres = binaryReader.ReadInt32(); int i; for (i = 0; (i < 8); i = (i + 1)) { this.FourVectorsStorage00[i] = new FourVectorsStorageBlock(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.FourVectorsStorage00[i].ReadFields(binaryReader))); } return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.RenderModelSectionGroupDetailLevels = ((DetailLevels)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16)); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.LeavesFlags = ((Flags)(binaryReader.ReadByte())); this.BSP2DReferenceCount = binaryReader.ReadByte(); this.FirstBSP2DReference = binaryReader.ReadInt16(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.ShaderStateMiscStateFlags = ((Flags)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.FogColor = binaryReader.ReadColourR1G1B1(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.VariantNumber = binaryReader.ReadInt16(); this.fieldpad = binaryReader.ReadBytes(2); this.Dialogue = binaryReader.ReadTagReference(); return(pointerQueue); }
public override System.Collections.Generic.Queue<Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue<Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue<Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.CreateIn = ((CreateInEnum)(binaryReader.ReadInt16())); this.EffectPartEffectPartCreateIn = ((EffectPartCreateInEnum)(binaryReader.ReadInt16())); this.Location = binaryReader.ReadShortBlockIndex1(); this.EffectPartFlags = ((Flags)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(4); this.Type = binaryReader.ReadTagReference(); this.VelocityBounds = binaryReader.ReadRange(); this.VelocityConeAngle = binaryReader.ReadSingle(); this.AngularVelocityBounds = binaryReader.ReadRange(); this.RadiusModifierBounds = binaryReader.ReadRange(); this.EffectPartAScalesValues = ((AScalesValues)(binaryReader.ReadInt32())); this.EffectPartBScalesValues = ((BScalesValues)(binaryReader.ReadInt32())); return pointerQueue; }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Effect = binaryReader.ReadTagReference(); this.AnimationGraphEffectReferenceFlags = ((Flags)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.ScenarioControlStructFlags = ((Flags)(binaryReader.ReadInt32())); this.DONTTOUCHTHIS = binaryReader.ReadInt16(); this.fieldpad = binaryReader.ReadBytes(2); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16)); this.SpawnTime = binaryReader.ReadInt16(); this.fieldpad = binaryReader.ReadBytes(2); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Sound = binaryReader.ReadShortBlockIndex1(); this.Frame = binaryReader.ReadInt16(); this.MarkerName = binaryReader.ReadStringID(); return(pointerQueue); }
public ReadChunk(System.IO.BinaryReader input) { this.name = ReadUtil.ReadUTF(input); this.id = input.ReadInt16(); this.length = input.ReadUInt32(); this.bytes = input; this.pos = input.BaseStream.Position; }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.BitmapIndex = binaryReader.ReadInt16(); this.PaletteIndex = binaryReader.ReadByte(); this.fieldpad = binaryReader.ReadBytes(1); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Signature = binaryReader.ReadTagClass(); this.Width = binaryReader.ReadInt16(); this.Height = binaryReader.ReadInt16(); this.Depth = binaryReader.ReadByte(); this.BitmapDataMoreFlags = ((MoreFlags)(binaryReader.ReadByte())); this.Type = ((TypeEnum)(binaryReader.ReadInt16())); this.Format = ((FormatEnum)(binaryReader.ReadInt16())); this.BitmapDataFlags = ((Flags)(binaryReader.ReadInt16())); this.RegistrationPoint = binaryReader.ReadPoint(); this.MipmapCount = binaryReader.ReadInt16(); this.LowDetailMipmapCount = binaryReader.ReadInt16(); this.PixelsOffset = binaryReader.ReadInt32(); this.LOD1TextureDataOffset = binaryReader.ReadInt32(); this.LOD2TextureDataOffset = binaryReader.ReadInt32(); this.LOD3TextureDataOffset = binaryReader.ReadInt32(); this.fieldskip = binaryReader.ReadBytes(12); this.LOD1TextureDataLength = binaryReader.ReadInt32(); this.LOD2TextureDataLength = binaryReader.ReadInt32(); this.LOD3TextureDataLength = binaryReader.ReadInt32(); this.fieldskip0 = binaryReader.ReadBytes(52); return(pointerQueue); }