updating: require dotnet >=3.1.10 (#9060)

This commit is contained in:
Andrey Nekrasov 2021-01-12 21:52:17 +03:00 committed by GitHub
parent 9073ce8884
commit 6ecf8b60b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 12 deletions

View File

@ -38,7 +38,6 @@ AGGREGATABLE
AHybrid AHybrid
Aissue Aissue
akamaihd akamaihd
alannt
ALarger ALarger
alekhyareddy alekhyareddy
alertsolid alertsolid
@ -117,8 +116,8 @@ atlfile
atlstr atlstr
attr attr
Attribs Attribs
aumid
AUMID AUMID
aumid
AUTHN AUTHN
AUTOAPPEND AUTOAPPEND
autocomplete autocomplete
@ -222,6 +221,7 @@ CENTERALIGN
cfg cfg
changecursor changecursor
Changemove Changemove
charconv
charset charset
chdir chdir
checkbox checkbox
@ -279,7 +279,6 @@ codeofconduct
codeql codeql
codereview codereview
COINIT COINIT
Colorbrush
colorconv colorconv
colorhistory colorhistory
colorhistorylimit colorhistorylimit
@ -467,8 +466,8 @@ DISPIDAMBIENTDLCONTROL
DISPINFO DISPINFO
Displayandhidethedesktop Displayandhidethedesktop
DISPLAYCHANGE DISPLAYCHANGE
displayname
DISPLAYNAME DISPLAYNAME
displayname
divyan divyan
DLACTIVEXCTLS DLACTIVEXCTLS
DLCONTROL DLCONTROL
@ -655,7 +654,7 @@ ERASEBKGND
EREOF EREOF
EResize EResize
eriawan eriawan
ERRORLEVEL errc
errorlevel errorlevel
ERRORMESSAGE ERRORMESSAGE
ERRORTITLE ERRORTITLE
@ -797,7 +796,6 @@ globalplugins
globals globals
gmx gmx
google google
gordonwatts
GPTR GPTR
grayscale grayscale
GText GText
@ -857,8 +855,8 @@ HLSL
hmenu hmenu
hmodule hmodule
hmon hmon
hmonitor
HMONITOR HMONITOR
hmonitor
HOLDENTER HOLDENTER
HOLDESC HOLDESC
homljgmgpmcbpjbnjpfijnhipfkiclkd homljgmgpmcbpjbnjpfijnhipfkiclkd
@ -1338,7 +1336,6 @@ modulekey
MONITORINFO MONITORINFO
MONITORINFOEX MONITORINFOEX
MONITORINFOEXW MONITORINFOEXW
MONITORINFOF
monitorinfof monitorinfof
Monthand Monthand
Moq Moq
@ -1803,6 +1800,7 @@ resw
resx resx
returnvalue returnvalue
retval retval
rexit
rfind rfind
rgb rgb
RGBQUAD RGBQUAD
@ -2003,6 +2001,7 @@ sql
src src
SRCCOPY SRCCOPY
sre sre
sregex
SResize SResize
srme srme
srre srre
@ -2077,7 +2076,6 @@ SVGIn
svgpreviewhandler svgpreviewhandler
svgr svgr
SVGSVG SVGSVG
SWAPBUTTON
Switchbetweenvirtualdesktops Switchbetweenvirtualdesktops
SWP SWP
swprintf swprintf
@ -2167,7 +2165,6 @@ toggleright
toggleswitch toggleswitch
toolbar toolbar
Toolchain Toolchain
Toolset
toolset toolset
tooltip tooltip
toolwindow toolwindow

View File

@ -17,8 +17,30 @@ namespace updating
{ {
return false; return false;
} }
const char DESKTOP_DOTNET_RUNTIME_STRING[] = "Microsoft.WindowsDesktop.App 3.1."; constexpr size_t REQUIRED_MINIMAL_PATCH = 10;
return runtimes->find(DESKTOP_DOTNET_RUNTIME_STRING) != std::string::npos; std::regex dotnet3_1_x{ R"(Microsoft\.WindowsDesktop\.App\s3\.1\.(\d+))" };
size_t latestPatchInstalled = 0;
using rexit = std::sregex_iterator;
for (auto it = rexit{ begin(*runtimes), end(*runtimes), dotnet3_1_x }; it != rexit{}; ++it)
{
if (!it->ready() || it->size() < 2)
{
continue;
}
auto patchNumberGroup = (*it)[1];
if (!patchNumberGroup.matched)
{
continue;
}
const auto patchString = patchNumberGroup.str();
size_t patch = 0;
if (auto [_, ec] = std::from_chars(&*begin(patchString), &*end(patchString), patch); ec == std::errc())
{
latestPatchInstalled = std::max(patch, latestPatchInstalled);
}
}
return latestPatchInstalled >= REQUIRED_MINIMAL_PATCH;
} }
std::optional<fs::path> download_dotnet() std::optional<fs::path> download_dotnet()

View File

@ -7,6 +7,7 @@
#include <winrt/base.h> #include <winrt/base.h>
#pragma warning(default : 5205) #pragma warning(default : 5205)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h> #include <Windows.h>
#include <MsiQuery.h> #include <MsiQuery.h>
#include <Shlwapi.h> #include <Shlwapi.h>
@ -19,6 +20,8 @@
#include <PathCch.h> #include <PathCch.h>
#include <optional> #include <optional>
#include <regex>
#include <charconv>
#include <expected.hpp> #include <expected.hpp>