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)); }
public static byte ReadByte(GTFS fs) { if (fs.GetType() == typeof(GTFS) && EnableGTFSView) { ((GTFS)fs).AddTrack(fs.Position, 1); } return((byte)fs.ReadByte()); }
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); }