internal static void AddReference(XDRPCReference reference) { IXboxConsole xboxConsole = reference.XboxConsole; uint pointer = reference.Pointer; if (!XDRPCReferenceMonitor._references.ContainsKey(xboxConsole)) { XDRPCReferenceMonitor._references.Add(xboxConsole, new Dictionary <uint, XDRPCReference>()); } Dictionary <uint, XDRPCReference> reference1 = XDRPCReferenceMonitor._references[xboxConsole]; if (reference1.ContainsKey(pointer)) { throw new XDRPCInvalidOperationException(string.Format("Invalid operation: Pointer {0} is being referred to by two seperate XboxReferences.", (object)pointer)); } reference1.Add(pointer, reference); }
internal static void ReleaseReference(XDRPCReference reference) { IXboxConsole xboxConsole = reference.XboxConsole; uint pointer = reference.Pointer; if (!XDRPCReferenceMonitor._references.ContainsKey(xboxConsole)) { throw new XDRPCInvalidOperationException("Invalid operation: attempting to release reference that is not registered."); } Dictionary <uint, XDRPCReference> reference1 = XDRPCReferenceMonitor._references[xboxConsole]; if (!reference1.ContainsKey(pointer)) { throw new XDRPCInvalidOperationException("Invalid operation: attempting to release reference that is not registered."); } reference1.Remove(pointer); if (reference1.Count != 0) { return; } XDRPCReferenceMonitor._references.Remove(xboxConsole); }