public object LoadAssembly(string file) { DotNetProject project = null; foreach (DotNetProject p in solution.GetAllSolutionItems <DotNetProject> ()) { foreach (var conf in p.Configurations) { if (p.GetOutputFileName(conf.Selector) == file) { project = p; break; } } } if (project != null) { return(ProjectDomService.GetProjectDom(project)); } else { if (!loadedDoms.Contains(file)) { loadedDoms.Add(file); ProjectDomService.LoadAssembly(Runtime.SystemAssemblyService.DefaultRuntime, file); } return(ProjectDomService.GetAssemblyDom(Runtime.SystemAssemblyService.DefaultRuntime, file)); } }
public ProjectDom ResolveAssemblyDom(string assemblyName) { var parsed = SystemAssemblyService.ParseAssemblyName(assemblyName); if (string.IsNullOrEmpty(parsed.Name)) { return(null); } var dllName = parsed.Name + ".dll"; foreach (var reference in References) { if (reference.ReferenceType == ReferenceType.Package || reference.ReferenceType == ReferenceType.Assembly) { foreach (string refPath in reference.GetReferencedFileNames(null)) { if (Path.GetFileName(refPath) == dllName) { return(ProjectDomService.GetAssemblyDom(TargetRuntime, refPath)); } } } else if (reference.ReferenceType == ReferenceType.Project && parsed.Name == reference.Reference) { var p = ParentSolution.FindProjectByName(reference.Reference) as DotNetProject; if (p == null) { LoggingService.LogWarning("Project '{0}' referenced from '{1}' could not be found", reference.Reference, this.Name); continue; } return(ProjectDomService.GetProjectDom(p)); } } string path = GetAssemblyPath(assemblyName); if (path != null) { return(ProjectDomService.GetAssemblyDom(TargetRuntime, path)); } return(null); }
static ProjectDom GetSystemWebDom(TargetRuntime runtime, TargetFramework targetFramework) { string file = runtime.AssemblyContext.GetAssemblyNameForVersion(sysWebAssemblyName, targetFramework); if (string.IsNullOrEmpty(file)) { throw new Exception("System.Web assembly name not found for framework " + targetFramework.Id); } file = runtime.AssemblyContext.GetAssemblyLocation(file, targetFramework); if (string.IsNullOrEmpty(file)) { throw new Exception("System.Web assembly file not found for framework " + targetFramework.Id); } ProjectDom dom = ProjectDomService.GetAssemblyDom(runtime, file); if (dom == null) { throw new Exception("System.Web parse database not found for framework " + targetFramework.Id + " file '" + file + "'"); } return(dom); }
void LoadExceptions() { ProjectDom dom; if (IdeApp.ProjectOperations.CurrentSelectedProject != null) { dom = ProjectDomService.GetProjectDom(IdeApp.ProjectOperations.CurrentSelectedProject); } else { string asm = typeof(Uri).Assembly.Location; if (!systemLoaded) { ProjectDomService.LoadAssembly(Runtime.SystemAssemblyService.CurrentRuntime, asm); systemLoaded = true; } dom = ProjectDomService.GetAssemblyDom(Runtime.SystemAssemblyService.CurrentRuntime, asm); } classes.Add("System.Exception"); foreach (IType t in dom.GetSubclasses(dom.GetType("System.Exception", true))) { classes.Add(t.FullName); } }