Ejemplo n.º 1
0
        private void UpdateAssemblyLocation()
        {
            this.toolTip.RemoveAll();

            TypeLibraryConverter converter = new TypeLibraryConverter();

            if (this.typeLibraryComboBox.SelectedItem != null)
            {
                TypeLibraryItem item = (TypeLibraryItem)this.typeLibraryComboBox.SelectedItem;
                toolTip.SetToolTip(this.typeLibraryComboBox, item.Location);

                converter.TypeLibraryLocation = item.Location;
            }
            else
            {
                converter.TypeLibraryLocation = this.typeLibraryComboBox.Text;
            }

            string fileName = "Interop." + converter.AssemblyLocation;

            string outputPath = null;

            if (this.assemblyTextBox.Text.Length > 0)
            {
                outputPath = Path.GetDirectoryName(this.assemblyTextBox.Text);
            }
            else
            {
                outputPath = this.OutputPath;
            }

            this.assemblyTextBox.Text = Path.Combine(outputPath, fileName);
        }
Ejemplo n.º 2
0
        private void PopulateTypeLibraryList()
        {
            using (RegistryKey listKey = Registry.ClassesRoot.OpenSubKey("TypeLib"))
            {
                foreach (string guid in listKey.GetSubKeyNames())
                {
                    using (RegistryKey libraryKey = listKey.OpenSubKey(guid))
                    {
                        foreach (string version in libraryKey.GetSubKeyNames())
                        {
                            using (RegistryKey versionKey = libraryKey.OpenSubKey(version))
                            {
                                string name = (string)versionKey.GetValue(null);
                                if ((name != null) && (name.Length > 0))
                                {
                                    foreach (string sv in versionKey.GetSubKeyNames())
                                    {
                                        if ((sv != "FLAGS") && (sv != "HELPDIR"))
                                        {
                                            using (RegistryKey locationKey = versionKey.OpenSubKey(sv + @"\win32"))
                                            {
                                                if (locationKey != null)
                                                {
                                                    string location = (string)locationKey.GetValue(null);

                                                    TypeLibraryItem item = new TypeLibraryItem(name, version, location);
                                                    this.typeLibraryComboBox.Items.Add(item);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            ArrayList list = new ArrayList();

            list.AddRange(this.typeLibraryComboBox.Items);
            list.Sort();
            this.typeLibraryComboBox.Items.Clear();
            this.typeLibraryComboBox.Items.AddRange(list.ToArray());
        }