public static byte[] ReadBytes(GTFS fs, long offset, int length, bool flip) { byte[] bytes = new byte[length]; long original = fs.Position; fs.Position = offset; //for (int i = 0; i < length; i++) //bytes[i] = (byte)fs.ReadByte(); fs.Read(bytes, 0, length); if (fs.GetType() == typeof(GTFS) && EnableGTFSView) { ((GTFS)fs).AddTrack(offset, length); } fs.Position = original; if (flip) { Array.Reverse(bytes); } return(bytes); }
public static byte[] ReadBytes(GTFS fs, int length, bool flip) { if (length < 0) { throw new Exception(); } byte[] bytes = new byte[length]; fs.Read(bytes, 0, length); //for (int i = 0; i < length i++) //bytes[i] = (byte)fs.ReadByte(); if (fs.GetType() == typeof(GTFS) && EnableGTFSView) { ((GTFS)fs).AddTrack(fs.Position - length, length); } if (flip) { Array.Reverse(bytes); } return(bytes); }
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); }