/** * Constructor to read the table from the table stream. * * @param tableStream the table stream. * @param offset the offset into the byte array. * @param size the size of the table in the byte array. */ public SavedByTable(byte[] tableStream, int offset, int size) { // Read the value that I don't know what it does. :-) unknownValue = LittleEndian.GetShort(tableStream, offset); offset += 2; // The stored int Is the number of strings, and there are two strings per entry. int numEntries = LittleEndian.GetInt(tableStream, offset) / 2; offset += 4; entries = new SavedByEntry[numEntries]; for (int i = 0; i < numEntries; i++) { int len = LittleEndian.GetShort(tableStream, offset); offset += 2; String userName = StringUtil.GetFromUnicodeLE(tableStream, offset, len); offset += len * 2; len = LittleEndian.GetShort(tableStream, offset); offset += 2; String saveLocation = StringUtil.GetFromUnicodeLE(tableStream, offset, len); offset += len * 2; entries[i] = new SavedByEntry(userName, saveLocation); } }
/** * Compares this object with another, for equality. * * @param other the object to compare to this one. * @return <code>true</code> iff the other object Is equal to this one. */ public override bool Equals(Object other) { if (other == this) { return(true); } if (!(other is SavedByEntry)) { return(false); } SavedByEntry that = (SavedByEntry)other; return(that.userName.Equals(userName) && that.saveLocation.Equals(saveLocation)); }