Ejemplo n.º 1
0
        public static string ReadASCIItoNull(GTFS fs, long offset, bool flip, byte terminator = 0x00)
        {
            long previous = fs.Position;

            int end = 0;

            fs.Position = offset;
            for (int k = 0; k < 100; k++)
            {
                byte test = (byte)fs.ReadByte();
                if (test == terminator)
                {
                    end = k;
                    break;
                }
            }

            if (end == 0)
            {
                throw new Exception();
            }

            fs.Position = previous;

            byte[] bString = ReadBytes(fs, offset, end, flip);

            return(Encoding.ASCII.GetString(bString));
        }
Ejemplo n.º 2
0
        public static byte ReadByte(GTFS fs)
        {
            if (fs.GetType() == typeof(GTFS) && EnableGTFSView)
            {
                ((GTFS)fs).AddTrack(fs.Position, 1);
            }

            return((byte)fs.ReadByte());
        }
Ejemplo n.º 3
0
        public static byte ReadByteAt(GTFS fs, long offset)
        {
            if (fs.GetType() == typeof(GTFS) && EnableGTFSView)
            {
                ((GTFS)fs).AddTrack(fs.Position, 1);
            }

            long remember = fs.Position;

            fs.Position = offset;
            byte b = (byte)fs.ReadByte();

            fs.Position = remember;

            return(b);
        }