MiscUtil.IO.EndianBinaryReader.Seek C# (CSharp) Method

Seek() public method

Seeks within the stream.
public Seek ( int offset, SeekOrigin origin ) : void
offset int Offset to seek to.
origin SeekOrigin Origin of seek operation.
return void
        public void Seek(int offset, SeekOrigin origin)
        {
            CheckDisposed();
            stream.Seek (offset, origin);
        }

Usage Example

コード例 #1
0
ファイル: PaletteFile.cs プロジェクト: sikora507/OpenC1
        public PaletteFile(string filename)
        {
            EndianBinaryReader reader = new EndianBinaryReader(EndianBitConverter.Big, File.Open(filename, FileMode.Open));

            while (true)
            {
                int blockLength = 0;
                PaletteBlockType blockType = (PaletteBlockType)reader.ReadInt32();
                blockLength = reader.ReadInt32();

                switch (blockType)
                {
                    case PaletteBlockType.Attributes:

                        //contains name of palette and some attributes
                        //we dont care about this
                        reader.Seek(blockLength, SeekOrigin.Current);
                        break;

                    case PaletteBlockType.PixelData:
                        int entryCount = reader.ReadInt32();
                        int bytesPerEntry = reader.ReadInt32();
                        _paletteData = reader.ReadBytes(entryCount * bytesPerEntry);

                        break;

                    case PaletteBlockType.Null:
                        break;

                    default:
                        reader.Seek(blockLength, SeekOrigin.Current);
                        break;
                }
                if (reader.BaseStream.Position == reader.BaseStream.Length)
                    break;
            }

            reader.Close();
        }
All Usage Examples Of MiscUtil.IO.EndianBinaryReader::Seek