/// <summary> /// When Provider Is disconnected /// Removing its Permission from Dictionary /// </summary> /// <param name="permissions">Contains Permission Of Certain Provider</param> public void OnProviderDisconnect(ProviderPermission permissions) { if (Logger.IsDebugEnabled) { Logger.Info(permissions.ToString(), _oType.FullName, "OnProviderDisconnect"); } try { ProviderPermissionDictionary.Remove(permissions.MarketDataProvider); } catch (Exception exception) { Logger.Error(exception, _oType.FullName, "OnProviderDisconnect"); } }
/// <summary> /// When New Provider Is Connected /// Saving its Permissions in a dictionary /// </summary> /// <param name="permissions">Contains Permission Of Certain Provider</param> public void OnProviderConnected(ProviderPermission permissions) { if (Logger.IsDebugEnabled) { Logger.Info(permissions.ToString(), _oType.FullName, "OnProviderConnected"); } try { // Add permission if they don't exist in the local map if (!ProviderPermissionDictionary.ContainsKey(permissions.MarketDataProvider)) { ProviderPermissionDictionary.Add(permissions.MarketDataProvider, permissions); } } catch (Exception exception) { Logger.Error(exception, _oType.FullName, "OnProviderConnected"); } }
/// <summary> /// Overwrites Previous Writer Permission /// </summary> /// <param name="providerPermission"></param> public void ChangeProviderPermissions(ProviderPermission providerPermission) { try { ProviderPermission currentPermission; // Update exsiting permissions if they exist if (ProviderPermissionDictionary.TryGetValue(providerPermission.MarketDataProvider, out currentPermission)) { ProviderPermissionDictionary[providerPermission.MarketDataProvider] = providerPermission; } else { // Add permissions to the local map ProviderPermissionDictionary.Add(providerPermission.MarketDataProvider, providerPermission); } } catch (Exception exception) { Logger.Error(exception, _oType.FullName, "ChangeProviderPermissions"); } }