/// <summary> /// Actually performs unregistration. The ComUnregisterFunction decorated method will call this function /// internally with the flag appropriate for the operating system processor architecture. /// However, this function can also be called manually if needed. /// </summary> /// <param name="type">The type of object to unregister, this must be a SharpShellServer derived class.</param> /// <param name="registrationType">Type of the registration to unregister.</param> internal static void DoUnregister(Type type, RegistrationType registrationType) { Logging.Log($"Preparing to unregister SharpShell Server {type.Name} as {registrationType}"); // Get the association data. var associationAttributes = type.GetCustomAttributes(typeof(COMServerAssociationAttribute), true) .OfType <COMServerAssociationAttribute>().ToList(); // Get the server type and the registration name. var serverType = ServerTypeAttribute.GetServerType(type); var registrationName = RegistrationNameAttribute.GetRegistrationNameOrTypeName(type); // Unregister the server associations, if there are any. if (associationAttributes.Any()) { ServerRegistrationManager.UnregisterServerAssociations( type.GUID, serverType, registrationName, associationAttributes, registrationType); } // Execute the custom unregister function, if there is one. CustomUnregisterFunctionAttribute.ExecuteIfExists(type, registrationType); // Notify the shell we've updated associations. Shell32.SHChangeNotify(Shell32.SHCNE_ASSOCCHANGED, 0, IntPtr.Zero, IntPtr.Zero); Logging.Log($"Unregistration of {type.Name} completed"); }
/// <summary> /// Actually performs unregistration. The ComUnregisterFunction decorated method will call this function /// internally with the flag appropriate for the operating system processor architecture. /// However, this function can also be called manually if needed. /// </summary> /// <param name="type">The type of object to unregister, this must be a SharpShellServer derived class.</param> /// <param name="registrationType">Type of the registration to unregister.</param> internal static void DoUnregister(Type type, RegistrationType registrationType) { Logging.Log($"Preparing to unregister SharpShell Server {type.Name} as {registrationType}"); // Execute the custom unregister function, if there is one. CustomUnregisterFunctionAttribute.ExecuteIfExists(type, registrationType); Logging.Log($"Unregistration of {type.Name} completed"); }
/// <summary> /// Actually performs unregistration. The ComUnregisterFunction decorated method will call this function /// internally with the flag appropriate for the operating system processor architecture. /// However, this function can also be called manually if needed. /// </summary> /// <param name="type">The type of object to unregister, this must be a SharpShellServer derived class.</param> /// <param name="registrationType">Type of the registration to unregister.</param> /// <param name="registrationLocation">Location of the registration.</param> internal static void DoUnregister(Type type, RegistrationType registrationType, RegistrationLocation registrationLocation) { // Get the assoication data. var assocationAttributes = type.GetCustomAttributes(typeof(COMServerAssociationAttribute), true) .OfType <COMServerAssociationAttribute>().ToList(); // Get the server type. var serverType = ServerTypeAttribute.GetServerType(type); // Unregister the server associations, if there are any. if (assocationAttributes.Any()) { ServerRegistrationManager.UnregisterServerAssociations( type.GUID, serverType, type.Name, assocationAttributes, registrationType, registrationLocation); } // Execute the custom unregister function, if there is one. CustomUnregisterFunctionAttribute.ExecuteIfExists(type, registrationType); }
/// <summary> /// Actually performs unregistration. The ComUnregisterFunction decorated method will call this function /// internally with the flag appropriate for the operating system processor architecture. /// However, this function can also be called manually if needed. /// </summary> /// <param name="type">The type of object to unregister, this must be a SharpShellServer derived class.</param> /// <param name="registrationType">Type of the registration to unregister.</param> internal static void DoUnregister(Type type, RegistrationType registrationType) { // Get the assoication data. var associationType = COMServerAssociationAttribute.GetAssociationType(type); var associations = COMServerAssociationAttribute.GetAssociations(type); // Get the server type. var serverType = ServerTypeAttribute.GetServerType(type); // Unregister the server associations, if there are any. if (associationType != AssociationType.None) { ServerRegistrationManager.UnregisterServerAssociations( type.GUID, serverType, type.Name, associationType, associations, registrationType); } // Execute the custom unregister function, if there is one. CustomUnregisterFunctionAttribute.ExecuteIfExists(type, registrationType); }
/// <summary> /// Actually performs unregistration. The ComUnregisterFunction decorated method will call this function /// internally with the flag appropriate for the operating system processor architecture. /// However, this function can also be called manually if needed. /// </summary> /// <param name="type">The type of object to unregister, this must be a SharpShellServer derived class.</param> /// <param name="registrationType">Type of the registration to unregister.</param> internal static void DoUnregister(Type type, RegistrationType registrationType) { // Get the assoication data. var assocationAttributes = type.GetCustomAttributes(typeof(COMServerAssociationAttribute), true) .OfType <COMServerAssociationAttribute>().ToList(); // Get the server type. var serverType = ServerTypeAttribute.GetServerType(type); // Unregister the server associations, if there are any. if (assocationAttributes.Any()) { ServerRegistrationManager.UnregisterServerAssociations( type.GUID, serverType, type.Name, assocationAttributes, registrationType); } // Execute the custom unregister function, if there is one. CustomUnregisterFunctionAttribute.ExecuteIfExists(type, registrationType); // Notify the shell we've updated associations. Shell32.SHChangeNotify(Shell32.SHCNE_ASSOCCHANGED, 0, IntPtr.Zero, IntPtr.Zero); }