/// <summary> /// Loads the session data from a local cache /// </summary> public void SessionDataLoad() { TraceFactory.Logger.Debug("Loading proxy references and subscribers"); EventPublisher.LoadSubscriberData(); // If there is a proxy entries cache file, load it and process it. if (File.Exists(_backupFile)) { TraceFactory.Logger.Debug("Cache file exists, loading"); var proxies = LegacySerializer.DeserializeDataContract <SessionProxyControllerSet>(File.ReadAllText(_backupFile)); // If the number of entries is greater than the max, then we need to adjust // the max to account for all entries. if (proxies.Count > _proxyControllers.Maximum) { _proxyControllers = new SessionProxyControllerSet(proxies.Count); } // Create a new entry in the proxie entries and then tell the proxy // entry to refresh all subscribers. foreach (var proxy in proxies.Values) { try { proxy.Channel.Ping(); _proxyControllers.Add(proxy); TraceFactory.Logger.Debug("Endpoint reloaded for {0}".FormatWith(proxy.SessionId)); } catch (EndpointNotFoundException ex) { TraceFactory.Logger.Debug("Endpoint skipped for {0}:{1}".FormatWith(proxy.SessionId, ex.Message)); } } try { File.Delete(_backupFile); TraceFactory.Logger.Debug("deleted {0}".FormatWith(_backupFile)); } catch (Exception ex) { TraceFactory.Logger.Error("Error deleting saved proxies file", ex); } } else { TraceFactory.Logger.Debug("Nothing to load..."); } }