public TabInfo GenerateTabInfo(FileInfo file) { bool component = (file.Extension.ToLower() == ".component"); string title = null; Span summary = new Span(); string iconFile = null; string xmlFile = Path.Combine(file.Directory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".xml"); if (File.Exists(xmlFile)) { try { XElement xml = XElement.Load(xmlFile); var titleElement = XMLHelper.GetGlobalizedElementFromXML(xml, "title"); var summaryElement = XMLHelper.GetGlobalizedElementFromXML(xml, "summary"); var descriptionElement = XMLHelper.GetGlobalizedElementFromXML(xml, "description"); if (titleElement != null) { title = titleElement.Value; if (title != null && title.Trim().Length > 0) { summary.Inlines.Add(new Bold(XMLHelper.ConvertFormattedXElement(titleElement))); } } if (summaryElement != null) { if (summary.Inlines.Count > 0) { summary.Inlines.Add(new LineBreak()); summary.Inlines.Add(new LineBreak()); } summary.Inlines.Add(new Bold(XMLHelper.ConvertFormattedXElement(summaryElement))); } if (descriptionElement != null && descriptionElement.Value.Length > 1) { if (summary.Inlines.Count > 0) { summary.Inlines.Add(new LineBreak()); summary.Inlines.Add(new LineBreak()); } summary.Inlines.Add(XMLHelper.ConvertFormattedXElement(descriptionElement)); } if (xml.Element("icon") != null && xml.Element("icon").Attribute("file") != null) { iconFile = Path.Combine(file.Directory.FullName, xml.Element("icon").Attribute("file").Value); } CopyText = (titleElement != null ? (titleElement.Value + Environment.NewLine + Environment.NewLine) : "") + (summaryElement != null ? (summaryElement.Value + Environment.NewLine + Environment.NewLine) : "") + (descriptionElement != null ? XMLHelper.ConvertFormattedXElementToString(descriptionElement) : ""); } catch (Exception) { //we do nothing if the loading of an description xml fails => this is not a hard error } } if ((title == null) || (title.Trim() == "")) { title = component ? file.Name : Path.GetFileNameWithoutExtension(file.Name).Replace("-", " ").Replace("_", " "); } if (summary.Inlines.Count == 0) { string desc = component ? Properties.Resources.This_is_a_standalone_component_ : Properties.Resources.This_is_a_WorkspaceManager_file_; summary.Inlines.Add(new Run(desc)); } if (iconFile == null || !File.Exists(iconFile)) { iconFile = Path.Combine(file.Directory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".png"); } ImageSource image = null; if (File.Exists(iconFile)) { try { image = ImageHelper.LoadImage(new Uri(iconFile)); } catch (Exception) { image = null; } } else { var ext = file.Extension.Remove(0, 1); if (!component && ComponentInformations.EditorExtension.ContainsKey(ext)) { Type editorType = ComponentInformations.EditorExtension[ext]; image = editorType.GetImage(0).Source; } } return(new TabInfo() { Tooltip = summary, Title = title, Icon = image, filename = file }); }