IPod.EqualizerRecord.Read C# (CSharp) Method

Read() public method

public Read ( byte data ) : void
data byte
return void
        public void Read(byte[] data)
        {
            headerName = Encoding.ASCII.GetString (data, 0, 4);

            // this is allegedly the length of the preset name
            // but that doesn't seem to be the case.  It contains values
            // anywhere between 8 and 14 that I've seen, and the preset name
            // is always 510 bytes.
            unknownOne = BitConverter.ToUInt16 (data, 4);
            PresetName = encoding.GetString (data, 6, PresetNameLength).Trim ((char) 0);
            PreAmp = BitConverter.ToInt32 (data, 6 + PresetNameLength);
            largeBandCount = BitConverter.ToInt32 (data, 10 + PresetNameLength);
            largeBandData = new byte[4 * largeBandCount];
            Array.Copy (data, 14 + PresetNameLength, largeBandData, 0, 4 * largeBandCount);

            int offset = 14 + PresetNameLength + (4 * largeBandCount);
            BandCount = BitConverter.ToInt32 (data, offset);
            BandValues = new int[BandCount];

            offset += 4;
            for (int i = 0; i < BandCount; i++) {
                BandValues[i] = BitConverter.ToInt32 (data, offset);
                offset += 4;
            }
        }

Usage Example

Exemplo n.º 1
0
        public void Read(BinaryReader reader)
        {
            byte[] header = reader.ReadBytes(8);

            headerId = BitConverter.ToInt32(header, 0);
            int headerSize = BitConverter.ToInt32(header, 4);

            byte[] remainder = reader.ReadBytes(headerSize - 8);
            unknownOne = BitConverter.ToInt32(remainder, 0);
            unknownTwo = BitConverter.ToInt32(remainder, 4);
            int numEq = BitConverter.ToInt32(remainder, 8);

            eqSize = BitConverter.ToInt32(remainder, 12);

            for (int i = 0; i < numEq; i++)
            {
                EqualizerRecord eqrec = new EqualizerRecord();
                eqrec.Read(reader.ReadBytes(eqSize));

                Add(eqrec);
            }
        }
All Usage Examples Of IPod.EqualizerRecord::Read
EqualizerRecord