Пример #1
0
        private void RemoveAssociatedClassIds(RegistryKey capabilitieskey, string subkeyname, string classidprefix)
        {
            classidprefix = _productName + "." + classidprefix + ".";

            using (RegistryKey associationskey = capabilitieskey.OpenSubKey(subkeyname))
            {
                if (associationskey != null)
                {
                    foreach (string ext in associationskey.GetValueNames())
                    {
                        string classid = associationskey.GetValue(ext) as string;
                        if (string.IsNullOrEmpty(classid))
                        {
                            continue;
                        }

                        // Only remove classid's created by this FileAssociationManager.
                        if (!classid.StartsWith(classidprefix, StringComparison.CurrentCultureIgnoreCase))
                        {
                            continue;
                        }

                        // Remove the association to this
                        using (ApplicationAssociation association = new ApplicationAssociation(this, ext, classid, null))
                        {
                            association.Associated = false;
                        }

                        Registry.ClassesRoot.DeleteSubKeyTree(classid, false);
                    }
                }
            }
        }
Пример #2
0
        private void RemoveAssociatedClassIds(RegistryKey capabilitieskey, string subkeyname, string classidprefix)
        {
            classidprefix = _productName + "." + classidprefix + ".";

            using (RegistryKey associationskey = capabilitieskey.OpenSubKey(subkeyname))
            {
                if (associationskey != null)
                {
                    foreach (string ext in associationskey.GetValueNames())
                    {
                        string classid = associationskey.GetValue(ext) as string;
                        if (string.IsNullOrEmpty(classid))
                            continue;

                        // Only remove classid's created by this FileAssociationManager.
                        if (!classid.StartsWith(classidprefix, StringComparison.CurrentCultureIgnoreCase))
                            continue;

                        // Remove the association to this
                        using (ApplicationAssociation association = new ApplicationAssociation(this, ext, classid, null))
                        {
                            association.Associated = false;
                        }

                        Registry.ClassesRoot.DeleteSubKeyTree(classid, false);
                    }
                }
            }
        }