/// <summary> /// Loads the ConnectionManagers settings from the specified folder /// </summary> /// <param name="settingsFolder">The folder to use for storing settings</param> public void LoadSettings(string settingsFolder) { applicationDataFolder = settingsFolder; settingsFile = new KeyValueStore(Path.Combine(settingsFolder, "Account.xml")); if (settingsFile != null) { _clusterKey = settingsFile.GetItem <string>("ClusterKey").GetBytesBase64(); //Set up XmppMessagingClient and connect var messagingClient = new XmppMessagingClient() { Username = settingsFile.GetItem <string>("XmppUsername"), Server = settingsFile.GetItem <string>("XmppServer"), Password = settingsFile.GetItem <string>("XmppPassword") }; messagingClients.Add(messagingClient); messagingClient.MessageReceived += messagingClient_MessageReceived; messagingClient.PeerDisconnected += messagingClient_PeerDisconnected; messagingClient.Connect(); var clients = settingsFile.GetItem <IEnumerable <object> >("KnownClients"); if (clients == null) { knownClientsCache = new Dictionary <string, ClientInfo>(); } else { knownClientsCache = clients .Cast <ClientInfo>() .ToDictionary(x => x.JId); } logger.Info("Sucessfully loaded settings"); } }
/// <summary> /// Loads the ConnectionManagers settings from the specified folder /// </summary> /// <param name="settingsFolder">The folder to use for storing settings</param> public void LoadSettings(string settingsFolder) { applicationDataFolder = settingsFolder; settingsFile = new KeyValueStore(Path.Combine(settingsFolder, "Account.xml")); if (settingsFile != null) { _clusterKey = settingsFile.GetItem<string>("ClusterKey").GetBytesBase64(); //Set up XmppMessagingClient and connect var messagingClient = new XmppMessagingClient() { Username = settingsFile.GetItem<string>("XmppUsername"), Server = settingsFile.GetItem<string>("XmppServer"), Password = settingsFile.GetItem<string>("XmppPassword") }; messagingClients.Add(messagingClient); messagingClient.MessageReceived += messagingClient_MessageReceived; messagingClient.PeerDisconnected += messagingClient_PeerDisconnected; messagingClient.Connect(); var clients = settingsFile.GetItem<IEnumerable<object>>("KnownClients"); if (clients == null) knownClientsCache = new Dictionary<string, ClientInfo>(); else knownClientsCache = clients .Cast<ClientInfo>() .ToDictionary(x => x.JId); logger.Info("Sucessfully loaded settings"); } }