public static void Unregister(Type t) { if (t != null && t.IsSubclassOf(typeof(PreviewHandlerBase))) { object[] attrs = (object[])t.GetCustomAttributes(typeof(PreviewHandlerAttribute), true); if (attrs != null && attrs.Length == 1) { PreviewHandlerAttribute attr = attrs[0] as PreviewHandlerAttribute; UnregisterPreviewHandler(attr.Extension, t.GUID.ToString("B"), attr.AppId); } } }
public static void Register(Type t) { if (t != null && t.IsSubclassOf(typeof(PreviewHandler))) { object[] attrs = (object[])t.GetCustomAttributes(typeof(PreviewHandlerAttribute), true); try { if (attrs != null && attrs.Length == 1) { PreviewHandlerAttribute attr = attrs[0] as PreviewHandlerAttribute; RegisterPreviewHandler(attr.Name, attr.Extension, t.GUID.ToString("B"), attr.AppId); } } catch (Exception e) { Trace.WriteLine(e); } } }