public async Task <string?> GetLocalAppDataFolderAsync(ProjectSystem.VS.IVsService <IVsShell> vsShellService) { await _threadingService.SwitchToUIThread(); IVsShell shell = await vsShellService.GetValueAsync(); if (ErrorHandler.Succeeded(shell.GetProperty((int)__VSSPROPID4.VSSPROPID_LocalAppDataDir, out object value))) { return(value as string); } return(null); }
public async Task <string?> GetRegistryRootAsync(ProjectSystem.VS.IVsService <IVsShell> vsShellService) { await _threadingService.SwitchToUIThread(); IVsShell shell = await vsShellService.GetValueAsync(); if (ErrorHandler.Succeeded(shell.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out object value))) { return(value as string); } return(null); }
public async Task <Version?> GetVSVersionAsync(ProjectSystem.VS.IVsService <IVsAppId> vsAppIdService) { await _threadingService.SwitchToUIThread(); IVsAppId vsAppId = await vsAppIdService.GetValueAsync(); if (ErrorHandler.Succeeded(vsAppId.GetProperty((int)VSAPropID.VSAPROPID_ProductSemanticVersion, out object oVersion)) && oVersion is string semVersion) { // This is a semantic version string. We only care about the non-semantic version part int index = semVersion.IndexOfAny(Delimiter.PlusAndMinus); if (index != -1) { semVersion = semVersion.Substring(0, index); } if (Version.TryParse(semVersion, out Version vsVersion)) { return(vsVersion); } } return(null); }