public void LoadTaxonomyDocument(string path) { //remove hash if (path.Contains("#")) { path = path.Remove(path.IndexOf("#")); } var loaded = _LoadedSourcePathes.FirstOrDefault(i => i == path); if (loaded == null) { _LoadedSourcePathes.Add(path); var fullpath = path; //var taxonomydocument = Engine.CurrentEngine.TaxonomyDocuments.FirstOrDefault(i => i.SourcePath == path); var sourcepath = path; if (Utilities.Strings.IsRelativePath(sourcepath)) { sourcepath = Utilities.Strings.ResolveRelativePath(SourceFolder, path); } var localpath = Utilities.Strings.GetLocalPath(XbrlEngine.LocalFolder, sourcepath); var localrelpath = Utilities.Strings.GetRelativePath(LogicalModel.TaxonomyEngine.LocalFolder, localpath); //Logger.WriteLine(localpath); var taxonomydocument = Taxonomy.FindDocument(localrelpath); if (taxonomydocument == null) { //Logger.WriteLine(path); taxonomydocument = new XbrlTaxonomyDocument(path, this); Taxonomy.AddTaxonomyDocument(taxonomydocument); taxonomydocument.LoadReferences(); } //var reference = References.FirstOrDefault(i => i.SourcePath == path); var reference = References.FirstOrDefault(i => i.LocalRelPath == localrelpath); if (reference == null) { References.Add(taxonomydocument); ReferencedFiles.Add(taxonomydocument.LocalRelPath); } } }
public void Refresh() { ReferencedFiles.Clear(); if (ReferencedFileSave != null) { TaskManager.Self.AddAsyncTask(() => { var contentDirectory = GlueState.Self.ContentDirectory; var files = GlueCommands.Self.FileCommands.GetFilesReferencedBy(ReferencedFileSave, EditorObjects.Parsing.TopLevelOrRecursive.Recursive); files = files .Select(item => { if (FileManager.IsRelativeTo(item, contentDirectory)) { return(FileManager.MakeRelative(item, contentDirectory)); } else { return(item); } }) .Distinct() .OrderBy(item => item); MainGlueWindow.Self.Invoke(() => { foreach (var file in files) { ReferencedFiles.Add(file); } }); }, "Refreshing unreferenced files"); } }