Exemple #1
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;
         }
     }
 }
 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;
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Reflect a type and returns DocumentInspectorAttribute instances
 /// </summary>
 /// <param name="type">type to reflect</param>
 /// <returns>DocumentInspectorAttribute instances</returns>
 public static DocumentInspectorAttribute[] GetAttributes(NetRuntimeSystem.Type type)
 {
     object[] attributes = type.GetCustomAttributes(typeof(DocumentInspectorAttribute), true);
     DocumentInspectorAttribute[] result = new DocumentInspectorAttribute[attributes.Length];
     for (int i = 0; i < attributes.Length; i++)
     {
         result[i] = attributes[i] as DocumentInspectorAttribute;
     }
     return(result);
 }