public IEnumerable <FontClass> GetFontClasses(MediaCenterLibraryCache cache) { XDocument xdocument = XDocument.Load(MediaCenterUtil.GetXml(cache["Microsoft.MediaCenter.Shell.dll"].GetResource("FONTNAMES.MCML", (object)this.DocumentResourceType))); List <FontClass> list = new List <FontClass>(); XNamespace xnamespace = (XNamespace)"assembly://MSCorLib/System"; foreach (XElement element in xdocument.Root.Elements(xnamespace + "String")) { FontFace fontFaceInfo = FontUtilities.GetFontFaceInfo(MediaCenterUtil.AttributeValue(element, (XName)"String"), (MediaCenterTheme)null); if (fontFaceInfo != null) { list.Add(new FontClass() { FontFace = fontFaceInfo, Name = MediaCenterUtil.AttributeValue(element, (XName)"Name") }); } } return((IEnumerable <FontClass>)list); }
public IEnumerable <FontOverride> GetFontOverrides(MediaCenterLibraryCache cache, MediaCenterTheme theme) { XDocument xdocument = XDocument.Load(MediaCenterUtil.GetXml(cache["Microsoft.MediaCenter.Shell.dll"].GetResource("FONTS.MCML", (object)this.DocumentResourceType))); string str1 = string.Format("global://{0}:", (object)"me"); List <FontOverride> list = new List <FontOverride>(); XNamespace xnamespace = (XNamespace)"http://schemas.microsoft.com/2006/mcml"; foreach (XElement element in xdocument.Root.Elements(xnamespace + "Font")) { FontOverride fontOverride = new FontOverride(); fontOverride.Name = MediaCenterUtil.AttributeValue(element, (XName)"Name"); string font = MediaCenterUtil.AttributeValue(element, (XName)"FontName"); if (font.StartsWith(str1)) { fontOverride.FontClass = font.Substring(str1.Length); } else { fontOverride.FontFace = FontUtilities.GetFontFaceInfo(font, theme); } if (!string.IsNullOrEmpty(fontOverride.FontClass) || fontOverride.FontFace != null) { int result; if (int.TryParse(MediaCenterUtil.AttributeValue(element, (XName)"FontSize"), out result)) { fontOverride.Size = result; } string str2 = MediaCenterUtil.AttributeValue(element, (XName)"FontStyle"); if (str2 != null) { fontOverride.IsBold = str2.Contains("Bold"); fontOverride.IsItalic = str2.Contains("Italic"); } list.Add(fontOverride); } } return((IEnumerable <FontOverride>)list); }