Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }