示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="objName">Descriptive name of the object</param>
        /// <param name="pObject">Managed wrapper to the object</param>
        /// <param name="properties">List of textual properties to display</param>
        /// <param name="interfaces">List of available interfaces</param>
        public ObjectInformation(COMRegistry registry, ICOMClassEntry entry, string objName, object pObject, Dictionary <string, string> properties, COMInterfaceEntry[] interfaces)
        {
            m_entry = entry;
            if (m_entry == null)
            {
                Guid clsid = COMUtilities.GetObjectClass(pObject);
                if (registry.Clsids.ContainsKey(clsid))
                {
                    m_entry = registry.MapClsidToEntry(clsid);
                }
            }

            m_registry   = registry;
            m_pEntry     = ObjectCache.Add(registry, objName, pObject, interfaces);
            m_pObject    = pObject;
            m_properties = properties;
            m_interfaces = interfaces.OrderBy(i => i.Name).ToArray();
            m_objName    = objName;

            InitializeComponent();

            LoadProperties();
            LoadInterfaces();
            Text = m_objName;
            listViewInterfaces.ListViewItemSorter = new ListItemComparer(0);
        }
示例#2
0
        public async Task HostObject(ICOMClassEntry ent, object obj, bool factory)
        {
            Dictionary <string, string> props = new Dictionary <string, string>();

            if (ent == null)
            {
                ent = new COMCLSIDEntry(m_registry, Guid.Empty, COMServerType.UnknownServer);
            }
            props.Add("CLSID", ent.Clsid.FormatGuid());
            props.Add("Name", ent.Name);
            props.Add("Server", ent.DefaultServer);

            /* Need to implement a type library reader */
            Type dispType = COMUtilities.GetDispatchTypeInfo(this, obj);

            if (!ent.InterfacesLoaded)
            {
                await ent.LoadSupportedInterfacesAsync(false, null);
            }

            IEnumerable <COMInterfaceInstance> intfs = factory ? ent.FactoryInterfaces : ent.Interfaces;

            ObjectInformation view = new ObjectInformation(m_registry, ent, ent.Name, obj,
                                                           props, intfs.Select(i => m_registry.MapIidToInterface(i.Iid)).ToArray());

            HostControl(view);
        }
示例#3
0
 public static Type GetFactoryType(ICOMClassEntry cls)
 {
     if (cls is COMRuntimeClassEntry)
     {
         return(typeof(IActivationFactory));
     }
     return(typeof(IClassFactory));
 }
示例#4
0
 public ClassFactoryTypeViewer(COMRegistry registry, ICOMClassEntry entry, string objName, object obj)
 {
     InitializeComponent();
     _obj      = obj;
     _name     = objName;
     _registry = registry;
     _entry    = entry;
     Text      = objName + " ClassFactory";
 }
示例#5
0
        public override Control CreateInstance(COMRegistry registry, ICOMClassEntry entry, string strObjName, ObjectEntry pObject)
        {
            COMCLSIDEntry clsid_entry = entry as COMCLSIDEntry;

            if (clsid_entry == null)
            {
                throw new ArgumentException("Entry must be a COM class", "entry");
            }
            return(new ElevatedFactoryServerTypeViewer(registry, clsid_entry, strObjName, pObject.Instance));
        }
示例#6
0
        private async void btnRefreshInterfaces_Click(object sender, EventArgs e)
        {
            try
            {
                ICOMClassEntry entry = (ICOMClassEntry)tabPageSupportedInterfaces.Tag;
                await entry.LoadSupportedInterfacesAsync(true);

                LoadInterfaceList(entry.Interfaces, listViewInterfaces);
                LoadInterfaceList(entry.FactoryInterfaces, listViewFactoryInterfaces);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#7
0
 public override Control CreateInstance(COMRegistry registry,
                                        ICOMClassEntry entry, string strObjName, ObjectEntry pObject)
 {
     return(new TypedObjectViewer(registry, strObjName, pObject, m_type));
 }
示例#8
0
 abstract public Control CreateInstance(COMRegistry registry, ICOMClassEntry entry, string strObjName, ObjectEntry pObject);
示例#9
0
 public Control CreateInstance(COMRegistry registry, ICOMClassEntry entry, string strObjName, ObjectEntry pObject)
 {
     return(new PersistStreamTypeViewer(strObjName, pObject.Instance));
 }
示例#10
0
 public override Control CreateInstance(COMRegistry registry, ICOMClassEntry entry, string strObjName, ObjectEntry pObject)
 {
     return(new ClassFactoryTypeViewer(registry, entry, strObjName, pObject.Instance));
 }