/// <summary> /// /// </summary> bool RegisterClientSourceTypes(ClientId clientId) { IMessageBus messageBus = _messageBus; if (messageBus == null) { Console.WriteLine("Failed to register client source type, message bus not found."); #if Matrix_Diagnostics InstanceMonitor.OperationError("Failed to register client source type, message bus not found."); #endif return(false); } List <string> sourceTypes = messageBus.GetClientSourceTypes(clientId); if (sourceTypes == null) { Console.WriteLine("Failed to register client source type, source type not found."); #if Matrix_Diagnostics InstanceMonitor.OperationError("Failed to register client source type, source type not found."); #endif return(false); } foreach (Type superType in ReflectionHelper.GetKnownTypes(sourceTypes)) { if (superType.IsInterface == false || ReflectionHelper.TypeHasCustomAttribute(superType, typeof(SuperPoolInterfaceAttribute), false) == false) { continue; } HotSwapList <ClientId> clientList = null; if (_clientsInterfaces.TryGetValue(superType, out clientList) == false) { clientList = _clientsInterfaces.GetOrAdd(superType, new HotSwapList <ClientId>()); } clientList.AddUnique(clientId); if (ReflectionHelper.TypeHasCustomAttribute(superType, typeof(SuperPoolInterfaceAttribute), false) == false) {// Register this type as well. _proxyTypeManager.ObtainInterfaceProxy(superType); } } return(true); }
void DoUpdateSubscription(ClientId subscriberId, MethodInfo subscriberMethodInfo, ClientId targetSourceId, bool addSubscription, int?specificValue) { HotSwapDictionary <ClientId, ClientEventSubscriptionInfo> data; if (_subscriptionsHotSwap.TryGetValue(targetSourceId, out data) == false) {// Create a new list for this id. data = _subscriptionsHotSwap.GetOrAdd(targetSourceId, new HotSwapDictionary <ClientId, ClientEventSubscriptionInfo>()); } ClientEventSubscriptionInfo dataInfo; if (data.TryGetValue(subscriberId, out dataInfo) == false) { dataInfo = data.GetOrAdd(subscriberId, new ClientEventSubscriptionInfo()); } dataInfo.Update(subscriberMethodInfo, addSubscription, specificValue); }