/// <summary> /// Reads the next long from the stream, and checks if it equals 'value'. /// </summary> /// <param name="value">The value to compare against the next long from the stream</param> /// <param name="objectID">The ID of the marker (if known)</param> /// <param name="objectName">The name of the object being affected</param> /// <param name="objectType">The type of object (if known)</param> /// <param name="precedingProperty">The property immediately before the invalid marker</param> /// <returns>true or false, depending on whether the read long is the same as the specified value</returns> public bool Assert(long value, ushort objectID, string objectName, string objectType, string precedingProperty) { long Location = _stream.Position; byte[] temp = new byte[LONGLENGTH]; _stream.Read(temp, 0, LONGLENGTH); long Value = ByteConversion.ToLong(temp, 0); if (Value != value) { InvalidMarkerEventArgs Args = new InvalidMarkerEventArgs(Location, objectID, objectName, objectType, precedingProperty, value, Value); InvalidMarkerEvent(null, Args); } return(true); }
/// <summary> /// Reads a long from the stream, and advances the index accordingly. /// </summary> /// <returns>the next 8 bytes from the stream cast as a long</returns> public long ReadLong() { byte[] temp = new byte[LONGLENGTH]; _stream.Read(temp, 0, LONGLENGTH); return(ByteConversion.ToLong(temp, 0)); }
/// <summary> /// Reads the next long from the stream, and checks if it equals 'value'. /// </summary> /// <param name="value">The value to compare against the next long from the stream</param> /// <param name="failmessage">The error message to be thrown if the long does not equal value</param> /// <returns>true or false, depending on whether the read long is the same as the specified value</returns> public bool Assert(long value, string failmessage) { byte[] temp = new byte[LONGLENGTH]; _stream.Read(temp, 0, LONGLENGTH); if (ByteConversion.ToLong(temp, 0) != value) { throw new AssertFailedException(failmessage); } return(true); }