public static IVsXMLMemberIndex GetXmlDocFile(Assembly assembly, XProject project) { IVsXMLMemberIndex index = null; var location = assembly.Location; if (!string.IsNullOrWhiteSpace(location)) { if (!_memberIndexes.TryGetValue(location, out index)) { _XMLMemberIndexService.CreateXMLMemberIndex(location, out index); if (index != null) { _memberIndexes.Add(location, index); } } } if (index == null) // Sometimes we get a type in the Microsoft.Net folder and not the reference assemblies folder { string refasm = ""; foreach (var asm in project.AssemblyReferences) { if (asm.FullName == assembly.FullName) { refasm = asm.FileName; break; } if (!string.IsNullOrEmpty(asm.FileName) && asm.FileName.EndsWith("System.DLL", StringComparison.OrdinalIgnoreCase)) { if (assembly.FullName.Contains("mscorlib")) { refasm = Path.Combine(Path.GetDirectoryName(asm.FileName), "mscorlib.dll"); break; } } } if (refasm != location && !String.IsNullOrEmpty(refasm)) { if (!_memberIndexes.TryGetValue(refasm, out index)) { _XMLMemberIndexService.CreateXMLMemberIndex(refasm, out index); if (index != null) { if (!String.IsNullOrWhiteSpace(location)) { _memberIndexes.Add(location, index); } _memberIndexes.Add(refasm, index); } } } } return(index); }
private IVsXMLMemberIndex CreateXmlMemberIndex() { // This may fail if there is no XML file available for this assembly. We'll just leave // memberIndex null in this case. _memberIndexService.CreateXMLMemberIndex(_filePath, out var memberIndex); return(memberIndex); }
private static async Task LoadCoreDllAsync() { var node = IntPtr.Size == 8 ? Constants.RegistryKey64 : Constants.RegistryKey; node = "HKEY_LOCAL_MACHINE\\" + node; var InstallPath = (string)Microsoft.Win32.Registry.GetValue(node, "XSharpPath", ""); var assemblies = Path.Combine(InstallPath, "Assemblies"); coreLoc = Path.Combine(assemblies, "XSharp.Core.dll"); coreIndex = null; await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _XMLMemberIndexService.CreateXMLMemberIndex(coreLoc, out IVsXMLMemberIndex index); if (index != null) { _memberIndexes.Add(coreLoc, index); coreIndex = index; } return; }
static XSharpXMLDocTools() { _XMLMemberIndexService = (IVsXMLMemberIndexService)XSharpProjectPackage.GetGlobalService(typeof(SVsXMLMemberIndexService)); // create default entry so our own xml lookup will work var node = @"HKEY_LOCAL_MACHINE\Software\XSharpBV\XSharp"; var InstallPath = (string)Microsoft.Win32.Registry.GetValue(node, "XSharpPath", ""); var assemblies = Path.Combine(InstallPath, "Assemblies"); var location = Path.Combine(assemblies, "XSharp.Core.dll"); IVsXMLMemberIndex index; _XMLMemberIndexService.CreateXMLMemberIndex(location, out index); if (index != null) { _memberIndexes.Add(location, index); coreLoc = location; coreIndex = index; } }
async static Task <int> InitXML() { var lang = XSharpProjectPackage.Instance; _XMLMemberIndexService = (IVsXMLMemberIndexService)await lang.GetServiceAsync(typeof(SVsXMLMemberIndexService)); // create default entry so our own xml lookup will work var node = @"HKEY_LOCAL_MACHINE\Software\XSharpBV\XSharp"; var InstallPath = (string)Microsoft.Win32.Registry.GetValue(node, "XSharpPath", ""); var assemblies = Path.Combine(InstallPath, "Assemblies"); var location = Path.Combine(assemblies, "XSharp.Core.dll"); IVsXMLMemberIndex index; _XMLMemberIndexService.CreateXMLMemberIndex(location, out index); if (index != null) { _memberIndexes.Add(location, index); coreLoc = location; coreIndex = index; } return(0); }