void OpenFromAssembly (string url, AssemblyLoader currentAssembly) { var cecilObject = loader.GetCecilObject (currentAssembly.UnresolvedAssembly); if (cecilObject == null) return; int i = 0; System.Action loadNext = null; var references = cecilObject.MainModule.AssemblyReferences; loadNext = () => { var reference = references [i]; string fileName = currentAssembly.LookupAssembly (reference.FullName); if (string.IsNullOrEmpty (fileName)) { LoggingService.LogWarning ("Assembly browser: Can't find assembly: " + reference.FullName + "."); if (++i == references.Count) LoggingService.LogError ("Assembly browser: Can't find: " + url + "."); else loadNext (); return; } var result = AddReferenceByFileName (fileName, true); result.LoadingTask.ContinueWith (t2 => { t2.Wait (); if (definitions == null) // disposed return; var nav = SearchMember (url); if (nav == null) { if (++i == references.Count) LoggingService.LogError ("Assembly browser: Can't find: " + url + "."); else loadNext (); } }, TaskScheduler.Current); }; }
public void Open (string url, AssemblyLoader currentAssembly = null) { ITreeNavigator nav = SearchMember (url); if (definitions == null) // we've been disposed return; if (nav == null) { if (currentAssembly != null) { var cecilObject = loader.GetCecilObject (currentAssembly.UnresolvedAssembly); if (cecilObject != null) { foreach (var reference in cecilObject.MainModule.AssemblyReferences) { string fileName = currentAssembly.LookupAssembly (reference.FullName); AddReferenceByFileName (fileName, true); nav = SearchMember (url); if (nav != null) break; } } } else { foreach (var definition in definitions.ToArray ()) { var cecilObject = loader.GetCecilObject (definition.UnresolvedAssembly); if (cecilObject == null) continue; foreach (var assemblyNameReference in cecilObject.MainModule.AssemblyReferences) { AddReferenceByAssemblyName (assemblyNameReference); } } } nav = SearchMember (url); } if (nav == null) { LoggingService.LogError ("Can't open: " + url + " (not found)."); } }