static ServerConnection() { using (RegistryKey key = ServerConnections.GetConnectionsKey()) { foreach (string connection in key.GetSubKeyNames()) { try { using (RegistryKey keyConnection = key.CreateSubKey(connection)) { string server = (string)keyConnection.GetValue("Server"); int port = (int)keyConnection.GetValue("Port"); bool autostart = (int)keyConnection.GetValue("SrcpServerAutoStart", 0) != 0; bool autostop = (int)keyConnection.GetValue("SrcpServerAutoStop", 0) != 0; string srcpserverpath = (string)keyConnection.GetValue("SrcpServerPath", SrcpServerDefaultPath); new ServerConnection(connection, server, port, autostart, autostop, srcpserverpath, false); } } catch { // Ignore errors in loading - continue with next one } } } }
static public string GetDefaultConnectionName() { string defaultConnectionName = null; using (RegistryKey key = GetApplicationDefaultConnectionKey()) { defaultConnectionName = (string)key.GetValue(GetApplicationName()); if (defaultConnectionName != null && ServerConnections.Contains(defaultConnectionName)) { return(defaultConnectionName); } } return(null); }