Ejemplo n.º 1
0
        public static void RegisterWithMmc(Type type)
        {
            try
            {
                RegistryConfigurationProvider provider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WSATRegisterSnapinWsatPropertySheetKey, null);

                using (provider)
                {
                    provider.WriteString(WsatKeys.WSATRegisterSnapinWsatPropertySheetAboutEntry, WsatKeys.WSATRegisterSnapinWsatPropertySheetAboutValue);
                    provider.WriteString(WsatKeys.WSATRegisterSnapinWsatPropertySheetNameEntry, WsatKeys.WSATRegisterSnapinWsatPropertySheetNameValue);
                }

                provider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WSATRegisterNodeTypesCompServCompNodeKey, null);
                using (provider)
                {
                    provider.WriteString(WsatKeys.WSATRegisterNodeTypesWsatPropertySheetGUIDEntry, WsatKeys.WSATRegisterNodeTypesWsatPropertySheetGUIDValue);
                }

                // put binary path
                string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
                provider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WsatRegKey, null);
                using (provider)
                {
                    provider.WriteString(WsatKeys.WSATAssemblyPathEntry, assemblyLocation);
                }
            }
#pragma warning suppress 56500
            catch (Exception ex)
            {
                if (Utilities.IsCriticalException(ex))
                {
                    throw;
                }

                ShowErrorDialog(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public static void RegisterWithMmc(Type type)
        {
            try
            {
                RegistryConfigurationProvider provider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WSATRegisterSnapinWsatPropertySheetKey, null);

                using (provider)
                {
                    provider.WriteString(WsatKeys.WSATRegisterSnapinWsatPropertySheetAboutEntry, WsatKeys.WSATRegisterSnapinWsatPropertySheetAboutValue);
                    provider.WriteString(WsatKeys.WSATRegisterSnapinWsatPropertySheetNameEntry, WsatKeys.WSATRegisterSnapinWsatPropertySheetNameValue);
                }

                provider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WSATRegisterNodeTypesCompServCompNodeKey, null);
                using (provider)
                {
                    provider.WriteString(WsatKeys.WSATRegisterNodeTypesWsatPropertySheetGUIDEntry, WsatKeys.WSATRegisterNodeTypesWsatPropertySheetGUIDValue);
                }

                // put binary path
                string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
                provider = new RegistryConfigurationProvider(RegistryHive.LocalMachine, WsatKeys.WsatRegKey, null);
                using (provider)
                {
                    provider.WriteString(WsatKeys.WSATAssemblyPathEntry, assemblyLocation);
                }
            }
#pragma warning suppress 56500
            catch (Exception ex)
            {
                if (Utilities.IsCriticalException(ex))
                {
                    throw;
                }

                ShowErrorDialog(ex.Message);
            }
        }