private static void UnregisterHandleDocumentInspector(Type type)
 {
     try
     {
         DocumentInspectorAttribute[] attributes = DocumentInspectorAttribute.GetAttributes(type);
         if (attributes.Length > 0)
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             GuidAttribute             typeid   = AttributeReflector.GetGuidAttribute(type);
             foreach (var attribute in attributes)
             {
                 foreach (var version in attribute.ProcessedApplicationVersion)
                 {
                     DocumentInspectorAttribute.TryDeleteKey("Word", attribute.Name, version);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         NetOffice.DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.UnRegister, exception))
         {
             throw;
         }
     }
 }
示例#2
0
 private static void RegisterHandleDocumentInspector(Type type)
 {
     try
     {
         DocumentInspectorAttribute[] attributes = DocumentInspectorAttribute.GetAttributes(type);
         if (attributes.Length > 0)
         {
             GuidAttribute typeid = AttributeReflector.GetGuidAttribute(type);
             foreach (var attribute in attributes)
             {
                 foreach (var version in attribute.ProcessedApplicationVersion)
                 {
                     DocumentInspectorAttribute.CreateKey("Word", attribute.Name, version, attribute.Selected, typeid.Value);
                 }
             }
         }
     }
     catch (NetRuntimeSystem.Exception exception)
     {
         NetOffice.DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.Register, exception))
         {
             throw;
         }
     }
 }
示例#3
0
        public static void UnregisterFunction(Type type)
        {
            if (null == type)
            {
                throw new ArgumentNullException("type");
            }
            if (null != type.GetCustomAttribute <DontRegisterAddinAttribute>())
            {
                return;
            }

            UnregisterHandleProgrammable(type, InstallScope.System);
            UnregisterHandleCodebase(type, InstallScope.System);

            MethodInfo registerMethod = null;
            UnRegisterFunctionAttribute registerAttribute = null;
            bool registerMethodPresent = AttributeReflector.GetUnRegisterAttribute(type, ref registerMethod, ref registerAttribute);

            if (null != registerAttribute && true == registerMethodPresent)
            {
                if (!TryCallDerivedUnRegisterMethod(registerMethod, type, InstallScope.System))
                {
                    if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type,
                                                                            RegisterErrorMethodKind.UnRegister,
                                                                            new UnregisterException()))
                    {
                        return;
                    }
                }
            }
        }
 private static void UnregisterHandleProgrammable(Type type, InstallScope scope)
 {
     try
     {
         ProgrammableAttribute programmable = AttributeReflector.GetProgrammableAttribute(type);
         if (null != programmable)
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             bool isSystemComponent             = location.IsMachineComponentTarget(scope);
             ProgrammableAttribute.DeleteKeys(type.GUID, isSystemComponent, false);
         }
     }
     catch (Exception exception)
     {
         NetOffice.DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.UnRegister, exception))
         {
             throw;
         }
     }
 }
示例#5
0
 private static void RegisterHandleRequireShutdownNotificationAttribute(Type type)
 {
     try
     {
         if (null != RequireShutdownNotificationAttribute.GetAttribute(type))
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             bool            isSystem           = location.IsMachineAddinTarget();
             ProgIdAttribute progId             = AttributeReflector.GetProgIDAttribute(type);
             RequireShutdownNotificationAttribute.CreateApplicationKey(isSystem, _addinOfficeRegistryKey, progId.Value);
         }
     }
     catch (System.Exception exception)
     {
         DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.Register, exception))
         {
             throw;
         }
     }
 }
示例#6
0
        public static void UnregisterFunction(Type type)
        {
            try
            {
                MultiRegisterAttribute attribute = MultiRegisterAttribute.GetAttribute(type);
                string[] product = new string[attribute.Products.Length];
                for (int i = 0; i < attribute.Products.Length; i++)
                {
                    product[i] = String.Format(_addinOfficeRegistryKey, MultiRegisterAttribute.RegistryEntry(attribute.Products[i]));
                }

                COMAddinUnRegisterHandler.Proceed(type, product, InstallScope.System, OfficeUnRegisterKeyState.NeedToDelete);
            }
            catch (Exception exception)
            {
                if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.UnRegister, new NetOfficeException(exception.Message, exception)))
                {
                    throw;
                }
            }
        }
示例#7
0
 private static void UnregisterHandleFormRegionAttribute(Type type)
 {
     try
     {
         var formAttributes = FormRegionAttribute.GetAttributes(type);
         foreach (var item in formAttributes)
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             bool            isSystem           = location.IsMachineAddinTarget();
             ProgIdAttribute progId             = AttributeReflector.GetProgIDAttribute(type);
             FormRegionAttribute.TryDeleteKey(isSystem, _formRegionsOfficeRegistryKey, progId.Value, item.Category, item.Name);
         }
     }
     catch (System.Exception exception)
     {
         DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.Register, exception))
         {
             throw;
         }
     }
 }
 private static void UnregisterHandleCodebase(Type type, InstallScope scope)
 {
     try
     {
         CodebaseAttribute codebase = AttributeReflector.GetCodebaseAttribute(type);
         if (null != codebase && codebase.Value == true)
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             bool     isSystemComponent         = location.IsMachineComponentTarget(scope);
             Assembly thisAssembly    = Assembly.GetAssembly(type);
             string   assemblyVersion = thisAssembly.GetName().Version.ToString();
             CodebaseAttribute.DeleteValue(type.GUID, isSystemComponent, assemblyVersion, false);
         }
     }
     catch (Exception exception)
     {
         NetOffice.DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.UnRegister, exception))
         {
             throw;
         }
     }
 }