private void ReadRecentFileList() { var recentFiles = _recentFileList.GetRecentFiles(); _recentFileInfos.Clear(); foreach (var rfile in recentFiles) { if (!File.Exists(rfile)) { continue; // ignore non-existing files } var file = new FileInfo(rfile); var fileExt = file.Extension.ToLower().Substring(1); if (ComponentInformations.EditorExtension != null && ComponentInformations.EditorExtension.ContainsKey(fileExt)) { bool cte = (fileExt == "cte"); Type editorType = ComponentInformations.EditorExtension[fileExt]; string xmlFile = Path.Combine(file.Directory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".xml"); string iconFile = null; Span description = new Span(); string title = null; if (File.Exists(xmlFile)) { try { XElement xml = XElement.Load(xmlFile); var titleElement = XMLHelper.GetGlobalizedElementFromXML(xml, "title"); if (titleElement != null) { title = titleElement.Value; } var summaryElement = XMLHelper.GetGlobalizedElementFromXML(xml, "summary"); var descriptionElement = XMLHelper.GetGlobalizedElementFromXML(xml, "description"); if (summaryElement != null) { description.Inlines.Add(new Bold(XMLHelper.ConvertFormattedXElement(summaryElement))); } if (descriptionElement != null && descriptionElement.Value.Length > 1) { description.Inlines.Add(new LineBreak()); description.Inlines.Add(new LineBreak()); description.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); } } 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 = Path.GetFileNameWithoutExtension(file.Name).Replace("-", " ").Replace("_", " "); } if (description.Inlines.Count == 0) { string desc; if (cte) { desc = Properties.Resources.This_is_an_AnotherEditor_file_; } else { desc = Properties.Resources.This_is_a_WorkspaceManager_file_; } description.Inlines.Add(new Run(desc)); } if (iconFile == null || !File.Exists(iconFile)) { iconFile = Path.Combine(file.Directory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".png"); } var image = File.Exists(iconFile) ? ImageLoader.LoadImage(new Uri(iconFile)) : editorType.GetImage(0).Source; _recentFileInfos.Add(new RecentFileInfo() { File = rfile, Title = title, Description = new TextBlock(description) { MaxWidth = 400, TextWrapping = TextWrapping.Wrap }, Icon = image, EditorType = editorType }); } } _recentFileInfos.Reverse(); }