Exemple #1
0
 public static ImageSource GetImageResource(IResourceLibraryCache cache, string uri, out string resourceName)
 {
     byte[] resource = MediaCenterUtil.GetResource(cache, uri, 10, out resourceName);
     if (resource == null)
         return (ImageSource)null;
     else
         return (ImageSource)BitmapDecoder.Create((Stream)new MemoryStream(resource), BitmapCreateOptions.None, BitmapCacheOption.Default).Frames[0];
 }
Exemple #2
0
 internal ImageSet(IResourceLibraryCache cache, string setName, string defaultImageName, IDictionary<string, string> imageSources)
 {
     this.cache = cache;
     this.setName = setName;
     this.defaultImageName = defaultImageName;
     this.images = (IDictionary<string, ImageSource>)new Dictionary<string, ImageSource>();
     this.imageSources = imageSources;
 }
Exemple #3
0
 public static string GetMagicString(IResourceLibraryCache cache, string proc, out int resourceID)
 {
     resourceID = MediaCenterUtil.GetMagicStringResourceID(proc);
     if (resourceID >= 0)
     {
         string stringResource = ResourceExtensions.GetStringResource(cache["ehres.dll"], resourceID);
         if (stringResource != null)
             return stringResource;
     }
     return proc;
 }
Exemple #4
0
 public void ApplyTo(IResourceLibraryCache libraryCache)
 {
     foreach (string index in this.Libraries)
     {
         IResourceLibrary resourceLibrary1 = this[index];
         IResourceLibrary resourceLibrary2 = libraryCache[index];
         foreach (int num in resourceLibrary1.ResourceTypes)
         {
             foreach (IResource resource in resourceLibrary1[(object)num])
                 ResourceExtensions.Update(resourceLibrary2.GetResource(resource.Name, (object)num), ResourceExtensions.GetBytes(resource));
         }
     }
 }
Exemple #5
0
 internal static ImageSet FromXml(IResourceLibraryCache cache, XmlElement element)
 {
     string attribute1 = element.GetAttribute("Name");
     string attribute2 = element.GetAttribute("DefaultImageName");
     Dictionary<string, string> dictionary = new Dictionary<string, string>();
     foreach (XmlElement xmlElement in element.GetElementsByTagName("Image"))
     {
         string attribute3 = xmlElement.GetAttribute("Name");
         string attribute4 = xmlElement.GetAttribute("Source");
         if (string.IsNullOrEmpty(attribute4))
             attribute4 = xmlElement.GetAttribute("Image");
         if (attribute3 != null && attribute4 != null)
             dictionary[attribute3] = attribute4;
     }
     return new ImageSet(cache, attribute1, attribute2, (IDictionary<string, string>)dictionary);
 }
 public override void Save(IResourceLibraryCache cache, bool forceSave)
 {
     base.Save(cache, forceSave);
 }
Exemple #7
0
 public DefaultStartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
 }
 public Windows7StartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
     this.m_deletedStrips = new List<Windows7MenuStrip>();
     this.Strips.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Strips_CollectionChanged);
 }
Exemple #9
0
 public Windows7StartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
     this.m_deletedStrips           = new List <Windows7MenuStrip>();
     this.Strips.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Strips_CollectionChanged);
 }
Exemple #10
0
 public override void Save(IResourceLibraryCache cache, bool forceSave)
 {
     base.Save(cache, forceSave);
 }
Exemple #11
0
 public static string GetStringResource(IResourceLibraryCache cache, string uri, bool throwIfNotFound)
 {
     string dll;
     string resource;
     if (MediaCenterUtil.TryParseResourceUri(uri, out dll, out resource))
         return ResourceExtensions.GetStringResource(cache[dll], MediaCenterUtil.GetMagicStringResourceID("#" + resource));
     if (throwIfNotFound)
         throw new Exception("Could not find string resource: " + uri);
     else
         return (string)null;
 }
Exemple #12
0
 public static ImageSource GetImageResource(IResourceLibraryCache cache, string uri)
 {
     string resourceName;
     return MediaCenterUtil.GetImageResource(cache, uri, out resourceName);
 }
Exemple #13
0
 public static byte[] GetResource(IResourceLibraryCache cache, string uri, int resourceType, out string resourceName)
 {
     string dll;
     if (MediaCenterUtil.TryParseResourceUri(uri, out dll, out resourceName))
         return ResourceExtensions.GetBytes(cache[dll].GetResource(resourceName, (object)resourceType));
     else
         throw new Exception("Could not find resource: " + uri);
 }
Exemple #14
0
 public virtual void Save(IResourceLibraryCache cache, bool forceSave)
 {
     try
     {
         if (!this.IsDirty && !forceSave)
         {
             return;
         }
         this.OnSaving(EventArgs.Empty);
         IResourceLibrary resourceLibrary = cache["ehres.dll"];
         this.SaveInternal(resourceLibrary);
         List <XmlNode> list = new List <XmlNode>();
         foreach (XmlElement element in this.StripParentNode.ChildNodes)
         {
             int index;
             if (this.IsOemPlaceholderElement(element, out index))
             {
                 list.Add((XmlNode)element);
             }
         }
         foreach (XmlNode oldChild in list)
         {
             this.StripParentNode.RemoveChild(oldChild);
         }
         int index1 = 0;
         foreach (IMenuStrip menuStrip in (Collection <IMenuStrip>) this.managerStrips)
         {
             BaseXmlMenuStrip strip1 = menuStrip as BaseXmlMenuStrip;
             if (strip1 != null)
             {
                 if (strip1.StartMenuElement.ParentNode != null)
                 {
                     strip1.StartMenuElement.ParentNode.RemoveChild((XmlNode)strip1.StartMenuElement);
                 }
                 this.StripParentNode.AppendChild(this.GetNodeForSave(strip1));
                 strip1.Save(resourceLibrary);
             }
             else
             {
                 OemMenuStrip strip2 = menuStrip as OemMenuStrip;
                 if (strip2 != null)
                 {
                     strip2.TimeStamp = int.MaxValue - index1;
                     this.StripParentNode.AppendChild(this.CreateOemStripNode(strip2, index1));
                     ++index1;
                 }
             }
         }
         int customStripCount;
         for (customStripCount = this.MinCustomStripCount; index1 < customStripCount; ++index1)
         {
             this.StripParentNode.AppendChild(this.CreateOemStripNode((OemMenuStrip)null, index1));
         }
         this.UpdateOemStripCount(customStripCount);
         if (this.oemManager != null)
         {
             this.oemManager.Save();
         }
         MediaCenterUtil.SaveXmlResource(resourceLibrary, "STARTMENU.XML", 23, this.StartMenuDocument);
         this.IsDirty = false;
     }
     finally
     {
         this.OnSaved(EventArgs.Empty);
     }
 }
Exemple #15
0
 protected StartMenuManager(IResourceLibraryCache resourceLibrary)
     : this(resourceLibrary, new OemManager())
 {
 }
Exemple #16
0
 public static StartMenuManager Create(IResourceLibraryCache cache)
 {
     return(StartMenuManager.Create(cache, (OemManager)null));
 }
Exemple #17
0
 public static string GetStringResource(IResourceLibraryCache cache, string uri)
 {
     return MediaCenterUtil.GetStringResource(cache, uri, true);
 }
Exemple #18
0
 public static string GetMagicString(IResourceLibraryCache cache, string proc)
 {
     int resourceID;
     return MediaCenterUtil.GetMagicString(cache, proc, out resourceID);
 }
Exemple #19
0
 public static XmlReader GetXmlResource(IResourceLibraryCache cache, string uri)
 {
     string resourceName;
     return MediaCenterUtil.GetXmlResource(cache, uri, out resourceName);
 }
Exemple #20
0
        public static XmlReader GetXmlResource(IResourceLibraryCache cache, string uri)
        {
            string resourceName;

            return(MediaCenterUtil.GetXmlResource(cache, uri, out resourceName));
        }
Exemple #21
0
 private static ThemeSummary[] GetAppliedThemes(IResourceLibraryCache cache)
 {
     IResource resource = cache["ehres.dll"].GetResource("VmcStudio.Themes.xml", (object)23);
     if (!resource.Exists(new ushort?()))
         return new ThemeSummary[0];
     using (MemoryStream memoryStream = new MemoryStream(ResourceExtensions.GetBytes(resource)))
         return ((ThemeManager.AppliedThemesDocument)new XmlSerializer(typeof(ThemeManager.AppliedThemesDocument)).Deserialize((Stream)memoryStream)).AppliedThemes;
 }
Exemple #22
0
 public static string GetStringResource(IResourceLibraryCache cache, string uri)
 {
     return(MediaCenterUtil.GetStringResource(cache, uri, true));
 }
 public DefaultStartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
 }
Exemple #24
0
 public void Save(IResourceLibraryCache cache)
 {
     this.Save(cache, false);
 }
Exemple #25
0
 public static XmlReader GetXmlResource(IResourceLibraryCache cache, string uri, out string resourceName)
 {
     byte[] resource = MediaCenterUtil.GetResource(cache, uri, 23, out resourceName);
     if (resource != null)
         return MediaCenterUtil.GetXmlResource(resource);
     else
         return (XmlReader)null;
 }