/// <summary> /// Equals determines whether two files (buffers) /// have the same checksum value (identical). /// </summary> /// <param name="obj">A AdlerChecksum object for comparison</param> /// <returns>Returns true if the value of checksum is the same /// as this instance; otherwise, false /// </returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (this.GetType() != obj.GetType()) { return(false); } AdlerChecksum other = (AdlerChecksum)obj; return(this.ChecksumValue == other.ChecksumValue); }
internal uint find_CRC(R_MythicPackageData data) { AdlerChecksum crc = new AdlerChecksum(); byte[] tocheck = new byte[ BitConverter.GetBytes(data.Flag).Length + BitConverter.GetBytes(data.DataOffset).Length + data.Data.Length]; BitConverter.GetBytes(data.Flag).CopyTo(tocheck, 0); //tocheck position in array BitConverter.GetBytes(data.DataOffset).CopyTo(tocheck, BitConverter.GetBytes(data.Flag).Length); //tocheck position in array data.Data.CopyTo(tocheck, BitConverter.GetBytes(data.Flag).Length + BitConverter.GetBytes(data.DataOffset).Length); if(crc.MakeForBuff(tocheck)) return crc.ChecksumValue; else return 0; //this will be Error }