private void FreeChildren(ScalableDictionaryNodeReference nodeRef) { using (nodeRef.PinValue()) { ScalableDictionaryNode scalableDictionaryNode = nodeRef.Value(); for (int i = 0; i < scalableDictionaryNode.Entries.Length; i++) { IScalableDictionaryEntry scalableDictionaryEntry = scalableDictionaryNode.Entries[i]; if (scalableDictionaryEntry != null) { switch (scalableDictionaryEntry.GetObjectType()) { case AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType.ScalableDictionaryNodeReference: { ScalableDictionaryNodeReference scalableDictionaryNodeReference = scalableDictionaryEntry as ScalableDictionaryNodeReference; this.FreeChildren(scalableDictionaryNodeReference); scalableDictionaryNodeReference.Free(); break; } default: Global.Tracer.Assert(false, "Unknown ObjectType"); break; case AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType.ScalableDictionaryValues: break; } } scalableDictionaryNode.Entries[i] = null; } scalableDictionaryNode.Count = 0; } }
private bool Remove(ScalableDictionaryNodeReference nodeRef, int hashCode, TKey key, int level, out int newCount) { using (nodeRef.PinValue()) { ScalableDictionaryNode scalableDictionaryNode = nodeRef.Value(); bool flag = false; int num = this.HashToSlot(scalableDictionaryNode, hashCode, level); IScalableDictionaryEntry scalableDictionaryEntry = scalableDictionaryNode.Entries[num]; if (scalableDictionaryEntry == null) { flag = false; } else { switch (scalableDictionaryEntry.GetObjectType()) { case AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType.ScalableDictionaryNodeReference: { ScalableDictionaryNodeReference scalableDictionaryNodeReference = scalableDictionaryEntry as ScalableDictionaryNodeReference; int num4 = default(int); flag = this.Remove(scalableDictionaryNodeReference, hashCode, key, level + 1, out num4); if (flag && num4 == 0) { scalableDictionaryNode.Entries[num] = null; scalableDictionaryNodeReference.Free(); } break; } case AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType.ScalableDictionaryValues: { ScalableDictionaryValues scalableDictionaryValues = scalableDictionaryEntry as ScalableDictionaryValues; int num2 = 0; while (num2 < scalableDictionaryValues.Count) { if (!this.m_comparer.Equals(key, (TKey)scalableDictionaryValues.Keys[num2])) { num2++; continue; } if (scalableDictionaryValues.Count == 1) { scalableDictionaryNode.Entries[num] = null; } else { scalableDictionaryValues.Keys[num2] = null; scalableDictionaryValues.Values[num2] = null; scalableDictionaryValues.Count--; int num3 = scalableDictionaryValues.Count - num2; if (num3 > 0) { Array.Copy(scalableDictionaryValues.Keys, num2 + 1, scalableDictionaryValues.Keys, num2, num3); Array.Copy(scalableDictionaryValues.Values, num2 + 1, scalableDictionaryValues.Values, num2, num3); } } flag = true; break; } break; } default: Global.Tracer.Assert(false, "Unknown ObjectType"); break; } } if (flag) { scalableDictionaryNode.Count--; } newCount = scalableDictionaryNode.Count; return(flag); } }