public static ServerInfo GetServerinfo(ServerEntry serverEntry)
        {
            if (serverEntry == null)
            {
                return(null);
            }


            //  Get the specified associations.
            AssociationType      associationType = COMServerAssociationAttribute.GetAssociationType(serverEntry.Server.GetType());
            IEnumerable <string> associations    = COMServerAssociationAttribute.GetAssociations(serverEntry.Server.GetType());

            ServerInfo serverInfo = new ServerInfo();

            serverInfo.ServerName     = serverEntry.ServerName;
            serverInfo.ServerType     = serverEntry.ServerType.ToString();
            serverInfo.ClassId        = serverEntry.ClassId.ToString();
            serverInfo.SecurityStatus = serverEntry.GetSecurityStatus();
            serverInfo.ServerPath     = serverEntry.ServerPath;
            serverInfo.IsInvalid      = serverEntry.IsInvalid;
            serverInfo.Association    = associationType + " " + string.Join(", ", associations);
            serverInfo.Info32         = SharpShell.ServerRegistration.ServerRegistrationManager.GetServerRegistrationInfo(serverEntry.Server.ServerClsid, RegistrationType.OS32Bit);
            serverInfo.Info64         = SharpShell.ServerRegistration.ServerRegistrationManager.GetServerRegistrationInfo(serverEntry.Server.ServerClsid, RegistrationType.OS64Bit);

            return(serverInfo);
        }
Exemplo n.º 2
0
        public void Initialise(ServerEntry serverEntry)
        {
            if (serverEntry != null)
            {
                textBoxServerName.Text     = serverEntry.ServerName;
                textBoxServerType.Text     = serverEntry.ServerType.ToString();
                textBoxServerCLSID.Text    = serverEntry.ClassId.ToString();
                textBoxServerSecurity.Text = serverEntry.GetSecurityStatus();
                textBoxAssemblyPath.Text   = serverEntry.ServerPath;

                //  Get the specified associations.
                var associationType = COMServerAssociationAttribute.GetAssociationType(serverEntry.Server.GetType());
                var associations    = COMServerAssociationAttribute.GetAssociations(serverEntry.Server.GetType());
                textBoxAssociations.Text = associationType.ToString() + " " + string.Join(", ", associations);


                //  Now use the server registration manager to get the registration info
                //  for the different operating system architectures.
                var info32 = ServerRegistrationManager.GetServerRegistrationInfo(serverEntry.Server.ServerClsid, RegistrationType.OS32Bit);
                var info64 = ServerRegistrationManager.GetServerRegistrationInfo(serverEntry.Server.ServerClsid, RegistrationType.OS64Bit);

                //  By default, our installation info is going to be empty.
                textBox32BitServer.Text = "Not Installed";
                textBox64BitServer.Text = "Not Installed";

                //  Do we have 32 bit registration info?
                if (info32 != null)
                {
                    //  Do we have a codebase?
                    if (!string.IsNullOrEmpty(info32.CodeBase))
                    {
                        textBox32BitServer.Text = info32.CodeBase;
                    }
                    else if (!string.IsNullOrEmpty(info32.Assembly))
                    {
                        textBox32BitServer.Text = info32.Assembly + " (GAC)";
                    }
                }

                //  Do we have 32 bit registration info?
                if (info64 != null)
                {
                    //  Do we have a codebase?
                    if (!string.IsNullOrEmpty(info64.CodeBase))
                    {
                        textBox64BitServer.Text = info64.CodeBase;
                    }
                    else if (!string.IsNullOrEmpty(info64.Assembly))
                    {
                        textBox64BitServer.Text = info64.Assembly + " (GAC)";
                    }
                }
            }
        }
        public void Initialise(ServerEntry serverEntry)
        {
            if (serverEntry != null)
            {
                textBoxServerName.Text = serverEntry.ServerName;
                textBoxServerType.Text = serverEntry.ServerType.ToString();
                textBoxServerCLSID.Text = serverEntry.ClassId.ToString();
                textBoxServerSecurity.Text = serverEntry.GetSecurityStatus();
                textBoxAssemblyPath.Text = serverEntry.ServerPath;

                //  Get the specified associations.
                var associationType = COMServerAssociationAttribute.GetAssociationType(serverEntry.Server.GetType());
                var associations = COMServerAssociationAttribute.GetAssociations(serverEntry.Server.GetType());
                textBoxAssociations.Text = associationType.ToString() + " " + string.Join(", ", associations);


                //  Now use the server registration manager to get the registration info
                //  for the different operating system architectures.
                var info32 = ServerRegistrationManager.GetServerRegistrationInfo(serverEntry.Server.ServerClsid, RegistrationType.OS32Bit);
                var info64 = ServerRegistrationManager.GetServerRegistrationInfo(serverEntry.Server.ServerClsid, RegistrationType.OS64Bit);

                //  By default, our installation info is going to be empty.
                textBox32BitServer.Text = "Not Installed";
                textBox64BitServer.Text = "Not Installed";

                //  Do we have 32 bit registration info?
                if (info32 != null)
                {
                    //  Do we have a codebase?
                    if (!string.IsNullOrEmpty(info32.CodeBase))
                        textBox32BitServer.Text = info32.CodeBase;
                    else if (!string.IsNullOrEmpty(info32.Assembly))
                        textBox32BitServer.Text = info32.Assembly + " (GAC)";
                }
                
                //  Do we have 32 bit registration info?
                if (info64 != null)
                {
                    //  Do we have a codebase?
                    if (!string.IsNullOrEmpty(info64.CodeBase))
                        textBox64BitServer.Text = info64.CodeBase;
                    else if (!string.IsNullOrEmpty(info64.Assembly))
                        textBox64BitServer.Text = info64.Assembly + " (GAC)";
                }
            }
        }