Esempio n. 1
0
        private void AddCategories(RegistryKey key)
        {
            foreach (string name in key.GetSubKeyNames())
            {
                using (RegistryKey key1 = key.OpenSubKey(name))
                {
                    if (key1.SubKeyCount != 0)
                    {
                        this.AddCategories(key1);
                    }
                }
            }
            if (MediaCenterUtil.IsGuid(key.Name.Substring(key.Name.LastIndexOf('\\') + 1)))
            {
                return;
            }
            OemCategory oemCategory1 = (OemCategory)this.RegistrySerialiser.Deserialise(this.CategoryType, key);
            OemCategory oemCategory2 = this.managerCategories[oemCategory1.CategoryPath];

            if (oemCategory2 != null)
            {
                this.RegistrySerialiser.Deserialise((object)oemCategory2, key);
            }
            else
            {
                if (oemCategory1.QuickLinks.Count <= 0)
                {
                    return;
                }
                this.managerCategories.Add(oemCategory1);
            }
        }
Esempio n. 2
0
        private bool DeleteIfEmpty()
        {
            bool   flag = true;
            string str  = this.IsSaved ? this.RegPath : "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Categories\\" + this.CategoryPath;

            using (RegistryKey key = this.RegHive.OpenSubKey(str, true))
            {
                if (key != null)
                {
                    this.PurgeDeletedLinks(key);
                    if (key.SubKeyCount == 0)
                    {
                        if (this.IsSaved)
                        {
                            flag = base.DeleteKey();
                        }
                        else
                        {
                            this.RegHive.DeleteSubKey(str);
                        }
                        if (!string.IsNullOrEmpty(this.ParentCategory))
                        {
                            OemCategory oemCategory = this.Manager.Categories[this.ParentCategory];
                            if (oemCategory != null)
                            {
                                oemCategory.DeleteIfEmpty();
                            }
                        }
                    }
                }
            }
            return(flag);
        }
Esempio n. 3
0
 public OemQuickLinkCollection(OemCategory category)
 {
     this.oemCategory = category;
 }
Esempio n. 4
0
        public void Save()
        {
            foreach (MediaCenterRegistryObject centerRegistryObject in this.EntryPoints.DeletedItems)
            {
                centerRegistryObject.DeleteKey();
            }
            this.EntryPoints.ClearDeletedItems();
            foreach (MediaCenterRegistryObject centerRegistryObject in this.Applications.DeletedItems)
            {
                centerRegistryObject.DeleteKey();
            }
            this.Applications.ClearDeletedItems();
            foreach (MediaCenterRegistryObject centerRegistryObject in this.Categories.DeletedItems)
            {
                centerRegistryObject.DeleteKey();
            }
            this.Categories.ClearDeletedItems();
            foreach (EntryPoint entryPoint in (Collection <EntryPoint>) this.EntryPoints)
            {
                entryPoint.Save();
            }
            foreach (OemMenuStrip oemMenuStrip in this.managerDeletedStrips)
            {
                oemMenuStrip.DeleteKey();
                if (!string.IsNullOrEmpty(oemMenuStrip.Category))
                {
                    OemCategory oemCategory = this.Categories[oemMenuStrip.Category];
                    if (oemCategory != null)
                    {
                        oemCategory.DeleteKey();
                    }
                }
            }
            foreach (OemMenuStrip oemMenuStrip in (Collection <OemMenuStrip>) this.managerStrips)
            {
                using (RegistryKey subKey = oemMenuStrip.RegHive.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Start Menu\\Applications"))
                    this.RegistrySerialiser.Serialise((object)oemMenuStrip, subKey);
            }
            List <OemCategory> list = new List <OemCategory>();

            foreach (OemCategory oemCategory in (Collection <OemCategory>) this.Categories)
            {
                if (oemCategory.IsDirty || !oemCategory.IsSaved)
                {
                    if (oemCategory.QuickLinks.Count > 0)
                    {
                        oemCategory.Save();
                    }
                    else if (oemCategory.IsSaved)
                    {
                        list.Add(oemCategory);
                        oemCategory.DeleteKey();
                    }
                }
            }
            foreach (OemCategory oemCategory in list)
            {
                this.Categories.Remove(oemCategory);
            }
            this.Categories.ClearDeletedItems();
            this.IsDirty = false;
        }