/// <summary> /// Reads a ushort from the stream, and advances the index accordingly. /// </summary> /// <returns>the next 2 bytes from the stream cast as a ushort</returns> public ushort ReadUShort() { byte[] temp = new byte[SHORTLENGTH]; _stream.Read(temp, 0, SHORTLENGTH); return(ByteConversion.ToUShort(temp, 0)); }
/// <summary> /// Reads the next short from the stream, and checks if it equals 'value'. /// </summary> /// <param name="value">The value to compare against the next short 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 short is the same as the specified value</returns> public bool Assert(ushort value, ushort objectID, string objectName, string objectType, string precedingProperty) { long Location = _stream.Position; byte[] temp = new byte[SHORTLENGTH]; _stream.Read(temp, 0, SHORTLENGTH); ushort Value = ByteConversion.ToUShort(temp, 0); if (Value != value) { InvalidMarkerEventArgs Args = new InvalidMarkerEventArgs(Location, objectID, objectName, objectType, precedingProperty, value, Value); InvalidMarkerEvent(null, Args); } return(true); }