protected override void Load() { string attribute1 = this.XmlElement.GetAttribute("Title"); int stringResourceId = MediaCenterUtil.GetMagicStringResourceID(attribute1); if (stringResourceId >= 0) { string stringResource = ResourceExtensions.GetStringResource(this.Manager.Resources["ehres.dll"], stringResourceId); if (stringResource != null) { this.originalTitle = stringResource; } } if (this.originalTitle == null) { this.originalTitle = attribute1; } this.Title = this.originalTitle; string attribute2 = this.XmlElement.GetAttribute("Icon"); this.images = ((DefaultStartMenuManager)this.Manager).GetImages(attribute2); if (this.images == null) { throw new ApplicationException("Could not find image set \"" + attribute2 + "\"."); } this.SetValue(XmlQuickLink.ImageProperty, (object)this.images["Focus"]); this.SetValue(XmlQuickLink.NonFocusImageProperty, (object)this.images["Default"]); string attribute3 = this.XmlElement.GetAttribute("Visible"); bool result; this.IsEnabled = string.IsNullOrEmpty(attribute3) || bool.TryParse(attribute3, out result) && result; this.originalStripID = this.XmlElement.GetAttribute("AppId"); this.originalStrip = (DefaultMenuStrip)null; }
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 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); } }
protected override void Load() { string attribute = this.LinkElement.GetAttribute("ResourceProviderId"); this.titleId = this.GetTitleId(); int.TryParse(this.titleId, out this.titleID); this.imageBaseName = this.LinkElement.GetAttribute("ImageBaseName"); if (attribute == "Spotlight") { this.resourceFile = PackageQuickLink.GetPackagePath("MCESpotlight", "MCESpotlight", "SpotlightResources.dll"); } else if (attribute == "NetTV") { this.resourceFile = PackageQuickLink.GetPackagePath("NetTV", "Browse", "NetTVResources.dll"); } else { if (!(attribute == "NetOpSM")) { throw new ArgumentException("Unknown provider: " + attribute); } this.resourceFile = PackageQuickLink.GetPackagePath("MCEClientUX", "NetOp", "SMResources.dll"); } if (File.Exists(this.resourceFile)) { using (UnmanagedLibrary unmanagedLibrary = new UnmanagedLibrary(this.resourceFile)) { this.Title = ResourceExtensions.GetStringResource((IResourceLibrary)unmanagedLibrary, this.titleID); byte[] bytes1 = ResourceExtensions.GetBytes(unmanagedLibrary.GetResource(this.imageBaseName + ".NoFocus.png", (object)10)); if (bytes1 != null) { BitmapDecoder bitmapDecoder = BitmapDecoder.Create((Stream) new MemoryStream(bytes1), BitmapCreateOptions.None, BitmapCacheOption.Default); this.SetValue(XmlQuickLink.NonFocusImageProperty, (object)bitmapDecoder.Frames[0]); } byte[] bytes2 = ResourceExtensions.GetBytes(unmanagedLibrary.GetResource(this.imageBaseName + ".Focus.png", (object)10)); if (bytes2 != null) { BitmapDecoder bitmapDecoder = BitmapDecoder.Create((Stream) new MemoryStream(bytes2), BitmapCreateOptions.None, BitmapCacheOption.Default); this.SetValue(XmlQuickLink.ImageProperty, (object)bitmapDecoder.Frames[0]); } } } this.SetValue(XmlQuickLink.IsValidPropertyKey, (object)(string.IsNullOrEmpty(this.Title) ? false : (this.Image != null ? true : false))); }
public static string ResolveString(string s) { if (s == null || !s.StartsWith("@")) { return(s); } s = s.Remove(0, 1); string[] strArray = s.Split(new char[1] { ',' }); int result; if (strArray.Length != 2 || !int.TryParse(strArray[1], out result)) { return(s); } int id = Math.Abs(result); using (IResourceLibrary library = (IResourceLibrary) new UnmanagedLibrary(strArray[0])) return(ResourceExtensions.GetStringResource(library, id)); }