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]; }
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; }
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; }
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)); } } }
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); }
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); }
public Windows7StartMenuManager(IResourceLibraryCache cache, OemManager oemManager) : base(cache, oemManager) { this.m_deletedStrips = new List <Windows7MenuStrip>(); this.Strips.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Strips_CollectionChanged); }
public override void Save(IResourceLibraryCache cache, bool forceSave) { base.Save(cache, forceSave); }
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; }
public static ImageSource GetImageResource(IResourceLibraryCache cache, string uri) { string resourceName; return MediaCenterUtil.GetImageResource(cache, uri, out resourceName); }
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); }
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); } }
protected StartMenuManager(IResourceLibraryCache resourceLibrary) : this(resourceLibrary, new OemManager()) { }
public static StartMenuManager Create(IResourceLibraryCache cache) { return(StartMenuManager.Create(cache, (OemManager)null)); }
public static string GetStringResource(IResourceLibraryCache cache, string uri) { return MediaCenterUtil.GetStringResource(cache, uri, true); }
public static string GetMagicString(IResourceLibraryCache cache, string proc) { int resourceID; return MediaCenterUtil.GetMagicString(cache, proc, out resourceID); }
public static XmlReader GetXmlResource(IResourceLibraryCache cache, string uri) { string resourceName; return MediaCenterUtil.GetXmlResource(cache, uri, out resourceName); }
public static XmlReader GetXmlResource(IResourceLibraryCache cache, string uri) { string resourceName; return(MediaCenterUtil.GetXmlResource(cache, uri, out resourceName)); }
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; }
public static string GetStringResource(IResourceLibraryCache cache, string uri) { return(MediaCenterUtil.GetStringResource(cache, uri, true)); }
public DefaultStartMenuManager(IResourceLibraryCache cache, OemManager oemManager) : base(cache, oemManager) { }
public void Save(IResourceLibraryCache cache) { this.Save(cache, false); }
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; }