예제 #1
0
 private static IEnumerable <ListViewItem> FormatProxyInstanceComplexTypes(COMProxyInstance proxy)
 {
     foreach (var type in proxy.ComplexTypes.OrderBy(p => p.Name))
     {
         ListViewItem item = new ListViewItem(type.Name);
         item.SubItems.Add(type.GetSize().ToString());
         item.Tag = type;
         yield return(item);
     }
 }
예제 #2
0
 private static IEnumerable <ListViewItemWithGuid> FormatProxyInstance(COMProxyInstance proxy)
 {
     foreach (var t in proxy.Entries.OrderBy(t => COMUtilities.DemangleWinRTName(t.Name)))
     {
         ListViewItemWithGuid item = new ListViewItemWithGuid(COMUtilities.DemangleWinRTName(t.Name), t.Iid);
         item.SubItems.Add(t.Iid.FormatGuid());
         item.Tag = t;
         yield return(item);
     }
 }
예제 #3
0
 public TypeLibControl(COMRegistry registry, string name, COMProxyInstance proxy, Guid guid_to_view, string comClassIdName = null, Guid?comClassId = null)
     : this(registry.InterfacesToNames, name, guid_to_view,
            FormatProxyInstance(proxy),
            new ListViewItemWithGuid[0], FormatProxyInstanceComplexTypes(proxy), new ListViewItem[0])
 {
     // controls on this panel are not enabled by default, activating them in the proxy view only
     this.btnDqs.Enabled             = true;
     this.cbProxyRenderStyle.Enabled = true;
     this.comClassId     = comClassId;
     this.comClassIdName = comClassIdName;
 }
예제 #4
0
 private void menuFileOpenProxyDll_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "Executable Files (*.dll;*.ocx)|*.dll;*.ocx|All Files (*.*)|*.*";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             try
             {
                 using (var resolver = EntryPoint.GetProxyParserSymbolResolver())
                 {
                     COMProxyInstance proxy = COMProxyInstance.GetFromFile(dlg.FileName, resolver, m_registry);
                     HostControl(new TypeLibControl(m_registry, Path.GetFileName(dlg.FileName), proxy, Guid.Empty));
                 }
             }
             catch (Exception ex)
             {
                 EntryPoint.ShowError(this, ex);
             }
         }
     }
 }
예제 #5
0
        private void viewProxyDefinitionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ListView view = GetListViewForMenu(sender);
                if (view != null && view.SelectedIndices.Count > 0)
                {
                    ListViewItem item = view.SelectedItems[0];
                    Tuple <COMInterfaceInstance, COMInterfaceEntry> intf =
                        item.Tag as Tuple <COMInterfaceInstance, COMInterfaceEntry>;

                    if (m_registry.Clsids.ContainsKey(intf.Item2.ProxyClsid))
                    {
                        COMCLSIDEntry clsid = m_registry.Clsids[intf.Item2.ProxyClsid];
                        using (var resolver = EntryPoint.GetProxyParserSymbolResolver())
                        {
                            EntryPoint.GetMainForm(m_registry).HostControl(new TypeLibControl(m_registry,
                                                                                              COMUtilities.GetFileName(clsid.DefaultServerName),
                                                                                              COMProxyInstance.GetFromCLSID(clsid, resolver), intf.Item1.Iid));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                EntryPoint.ShowError(this, ex);
            }
        }
예제 #6
0
 public TypeLibControl(COMRegistry registry, string name, COMProxyInstance proxy, Guid guid_to_view)
     : this(registry.InterfacesToNames, name, guid_to_view,
            FormatProxyInstance(proxy),
            new ListViewItemWithGuid[0], FormatProxyInstanceComplexTypes(proxy), new ListViewItem[0])
 {
 }
 public static void Convert(COMProxyInstance proxy, string output_path)
 {
     Convert(proxy.Entries, output_path);
 }