/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> public override int GetHashCode() { long GetHashCode = 0; GetHashCode += FormatID.GetHashCode(); Property[] pa = Properties; for (int i = 0; i < pa.Length; i++) { GetHashCode += pa[i].GetHashCode(); } int returnHashCode = (int)(GetHashCode & 0x0ffffffffL); return(returnHashCode); }
/// <inheritdoc /> public override byte[] GetBytes() { int Offset = 24; byte[] PropertyStorage = new byte[StorageSize]; Buffer.BlockCopy(BitConverter.GetBytes(StorageSize), 0, PropertyStorage, 0, 4); Buffer.BlockCopy(BitConverter.GetBytes(Version), 0, PropertyStorage, 4, 4); Buffer.BlockCopy(FormatID.ToByteArray(), 0, PropertyStorage, 8, 16); for (int i = 0; i < this.PropertyStorage.Count; i++) { SerializedPropertyValue PropertyValue = this.PropertyStorage[i]; Buffer.BlockCopy(PropertyValue.GetBytes(), 0, PropertyStorage, Offset, (int)PropertyValue.ValueSize); Offset += (int)PropertyValue.ValueSize; } return(PropertyStorage); }