Beispiel #1
0
        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
                    }
                }
            }
        }
Beispiel #2
0
        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);
        }