private static int RemoveEntriesWithProperty(int historyLength, byte[] buffer, OofHistory.PropId propId, byte[] propValue, long hashCode) { int num = 6; int currentEntryStart = 6; int result = 6; uint num2 = BitConverter.ToUInt32(buffer, 2); if (10000U < num2) { num2 = 10000U; } uint num3 = num2; for (uint num4 = 0U; num4 < num2; num4 += 1U) { if (num >= historyLength) { OofHistory.HandleInsufficientDataCorruption(hashCode, "Unable to get property count of entry " + num4); return(result); } byte propertyCount = buffer[num++]; bool flag; if (OofHistory.MatchAnyPropertiesInEntry(buffer, propId, propValue, propertyCount, historyLength, num4, hashCode, ref num, out flag)) { num3 -= 1U; } else { if (flag) { return(result); } OofHistory.HandleNonMatchingProperty(buffer, num, currentEntryStart, ref result); } currentEntryStart = num; } if (num3 < num2) { ExBitConverter.Write(num3, buffer, 2); } return(result); }
private static bool MatchAnyPropertiesInEntry(byte[] buffer, OofHistory.PropId propId, byte[] propValue, byte propertyCount, int historyLength, uint currentEntry, long hashCode, ref int index, out bool isCorrupt) { isCorrupt = false; bool flag = false; for (byte b = 0; b < propertyCount; b += 1) { if (index >= historyLength) { OofHistory.HandleInsufficientDataCorruption(hashCode, string.Concat(new object[] { "Unable to get property id of property ", b, " entry ", currentEntry })); isCorrupt = true; return(false); } byte b2 = buffer[index++]; if (index + 2 >= historyLength) { OofHistory.HandleInsufficientDataCorruption(hashCode, string.Concat(new object[] { "Unable to get property size of property ", b, " entry ", currentEntry, " property id ", b2, " index ", index })); isCorrupt = true; return(false); } ushort num = BitConverter.ToUInt16(buffer, index); index += 2; if (index + (int)num > historyLength) { OofHistory.HandleInsufficientDataCorruption(hashCode, string.Concat(new object[] { "Unable to get property content of property ", b, " entry ", currentEntry, " property id ", b2, " property size ", num, " index ", index })); isCorrupt = true; return(false); } if (flag) { index += (int)num; } else if (OofHistory.MatchProperty(buffer, b2, propId, num, propValue, ref index)) { flag = true; } } return(flag); }