Ejemplo n.º 1
0
        public static RegistrySerialiser CreateRegistrySerialiser(OemManager mcm)
        {
            RegistrySerialiser registrySerialiser = new RegistrySerialiser();

            registrySerialiser.Context[(object)"mcm"] = (object)mcm;
            return(registrySerialiser);
        }
Ejemplo n.º 2
0
 bool IRegistryKeySerialisable.BeforeSerialise(RegistrySerialiser rs, RegistryKey key)
 {
     this.Manager = this.GetMediaCenterManager(rs);
     if (this.saving != null)
     {
         this.saving((object)this, EventArgs.Empty);
     }
     return(this.OnBeforeSerialise(rs, key));
 }
Ejemplo n.º 3
0
 protected override void OnAfterSerialise(RegistrySerialiser rs, RegistryKey key)
 {
     this.PurgeDeletedLinks(key);
     foreach (OemQuickLink oemQuickLink in (Collection <IQuickLink>) this.categoryQuickLinks)
     {
         rs.Serialise((object)oemQuickLink, key);
     }
     base.OnAfterSerialise(rs, key);
 }
Ejemplo n.º 4
0
        protected override bool OnBeforeSerialise(RegistrySerialiser rs, RegistryKey key)
        {
            EntryPoint entryPoint = this.EntryPoint;

            if (entryPoint != null && !entryPoint.RegKey.Contains("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Entry Points"))
            {
                rs.Serialise((object)entryPoint, key, false);
            }
            return(true);
        }
Ejemplo n.º 5
0
 void IRegistryKeySerialisable.AfterDeserialise(RegistrySerialiser rs, RegistryKey key)
 {
     this.Manager = this.GetMediaCenterManager(rs);
     this.OnAfterDeserialise(rs, key);
     if (this.RegKey == null)
     {
         this.RegKey = key.Name;
     }
     this.EndInit();
 }
Ejemplo n.º 6
0
 protected override void OnAfterDeserialise(RegistrySerialiser rs, RegistryKey key)
 {
     this.EntryPoints.Clear();
     foreach (EntryPoint entryPoint in (Collection <EntryPoint>) this.Manager.EntryPoints)
     {
         if (entryPoint.ApplicationID == this.ID)
         {
             this.EntryPoints.Add(entryPoint);
         }
     }
 }
Ejemplo n.º 7
0
 void IRegistryKeySerialisable.AfterSerialise(RegistrySerialiser rs, RegistryKey key)
 {
     this.Manager = this.GetMediaCenterManager(rs);
     this.OnAfterSerialise(rs, key);
     this.RegKey  = key.Name;
     this.IsDirty = false;
     if (this.saved == null)
     {
         return;
     }
     this.saved((object)this, EventArgs.Empty);
 }
Ejemplo n.º 8
0
        protected virtual OemManager GetMediaCenterManager(RegistrySerialiser rs)
        {
            OemManager oemManager = rs.Context[(object)"mcm"] as OemManager;

            if (oemManager == null)
            {
                throw new ArgumentException("The registry serialiser must contain a MediaCenterManager.");
            }
            else
            {
                return(oemManager);
            }
        }
Ejemplo n.º 9
0
 protected override bool OnBeforeSerialise(RegistrySerialiser rs, RegistryKey key)
 {
     if (this.Application == null)
     {
         throw new InvalidOperationException("The menu strip must have an application.");
     }
     if (!this.Application.IsSaved || this.Application.IsDirty)
     {
         using (RegistryKey subKey = this.Application.RegHive.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Applications"))
             this.Manager.RegistrySerialiser.Serialise((object)this.Application, subKey);
     }
     return(true);
 }
Ejemplo n.º 10
0
 protected override bool OnBeforeSerialise(RegistrySerialiser rs, RegistryKey key)
 {
     if (this.ID == null || this.ID.Trim() == string.Empty)
     {
         throw new InvalidOperationException("The application must have an ID.");
     }
     if (this.Title == null || this.Title.Trim() == string.Empty)
     {
         throw new InvalidOperationException("The application must have a title.");
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 11
0
        public void Reset()
        {
            this.managerApps        = new OemManager.ApplicationCollection(this);
            this.managerEntryPoints = new OemManager.EntryPointCollection(this);
            this.managerCategories  = new OemManager.CategoryCollection(this);
            List <OemMenuStrip> list = new List <OemMenuStrip>();

            this.managerDeletedStrips = new List <OemMenuStrip>();
            this.managerRs            = MediaCenterRegistryObject.CreateRegistrySerialiser(this);
            this.BuildInfo((ICollection <OemMenuStrip>)list);
            this.isDirty = false;
            list.Sort((Comparison <OemMenuStrip>)((x, y) => y.TimeStamp.CompareTo(x.TimeStamp)));
            this.managerStrips = new ObservableCollection <OemMenuStrip>(list);
            this.managerStrips.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Strips_CollectionChanged);
        }
Ejemplo n.º 12
0
 protected override void OnAfterSerialise(RegistrySerialiser rs, RegistryKey key)
 {
     if (this.CapabilitiesRequired != EntryPointCapabilities.None)
     {
         string str = ((object)this.CapabilitiesRequired).ToString().ToLower();
         key.SetValue("CapabilitiesRequired", (object)str);
     }
     else
     {
         key.DeleteValue("CapabilitiesRequired", false);
     }
     if (this.Application == null || this.Application.IsSaved)
     {
         return;
     }
     using (RegistryKey subKey = this.Application.RegHive.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Applications"))
         rs.Serialise((object)this.Application, subKey);
 }
Ejemplo n.º 13
0
        protected override void OnAfterSerialise(RegistrySerialiser rs, RegistryKey key)
        {
            if (this.RegHive == Registry.CurrentUser)
            {
                return;
            }
            string regPath = this.RegPath;

            if (string.IsNullOrEmpty(regPath))
            {
                return;
            }
            foreach (object obj in Registry.Users.GetSubKeyNames())
            {
                string subkey = string.Format("{0}\\{1}", obj, (object)regPath);
                Registry.Users.DeleteSubKey(subkey, false);
            }
        }
Ejemplo n.º 14
0
        protected override void OnAfterDeserialise(RegistrySerialiser rs, RegistryKey key)
        {
            List <IQuickLink> list = new List <IQuickLink>();

            foreach (string str in key.GetSubKeyNames())
            {
                if (MediaCenterUtil.IsGuid(str))
                {
                    using (RegistryKey key1 = key.OpenSubKey(str))
                    {
                        OemQuickLink l         = (OemQuickLink)rs.Deserialise(this.Manager.QuickLinkType, key1);
                        OemQuickLink quickLink = this.GetQuickLink(l);
                        if (quickLink != null)
                        {
                            rs.Deserialise((object)quickLink, key1);
                            list.Add((IQuickLink)quickLink);
                        }
                        else if (l.EntryPoint != null)
                        {
                            if (l.Application != null)
                            {
                                list.Add((IQuickLink)l);
                            }
                        }
                    }
                }
            }
            foreach (IQuickLink quickLink in list)
            {
                if (!this.categoryQuickLinks.Contains(quickLink))
                {
                    int index = 0;
                    while (index < this.categoryQuickLinks.Count && quickLink.Priority >= this.categoryQuickLinks[index].Priority)
                    {
                        ++index;
                    }
                    this.categoryQuickLinks.Insert(index, quickLink);
                }
            }
            this.categoryName = key.Name.Substring(key.Name.LastIndexOf("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Categories") + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Extensibility\\Categories".Length + 1);
            base.OnAfterDeserialise(rs, key);
        }
Ejemplo n.º 15
0
        protected override void OnAfterDeserialise(RegistrySerialiser rs, RegistryKey key)
        {
            string text = key.GetValue("CapabilitiesRequired") as string;

            if (text != null)
            {
                try
                {
                    this.CapabilitiesRequired = (EntryPointCapabilities) new EnumConverter(typeof(EntryPointCapabilities)).ConvertFromString(text);
                }
                catch
                {
                }
            }
            if (this.ApplicationID == null)
            {
                return;
            }
            this.Application = this.Manager.Applications[this.ApplicationID];
        }
Ejemplo n.º 16
0
 protected virtual void OnAfterDeserialise(RegistrySerialiser rs, RegistryKey key)
 {
 }
Ejemplo n.º 17
0
 bool IRegistryKeySerialisable.BeforeDeserialise(RegistrySerialiser rs, RegistryKey key)
 {
     this.BeginInit();
     this.Manager = this.GetMediaCenterManager(rs);
     return(this.OnBeforeDeserialise(rs, key));
 }
Ejemplo n.º 18
0
 protected virtual bool OnBeforeDeserialise(RegistrySerialiser rs, RegistryKey key)
 {
     return(true);
 }