in JetBrains.HabitatDetector/src/Impl/Helper.cs [132:148]
internal static Version NormalizeVersion(Version version) => version.Build > 0
? version.Revision == -1
? version
: new(version.Major, version.Minor, version.Build)
: new(version.Major, version.Minor);
internal static Version? NormalizeVersionNullable(Version? version) => version != null ? NormalizeVersion(version) : null;
internal static unsafe JetArchitecture GetProcessArchitecture(int processId) => Platform switch
{
JetPlatform.FreeBSD or JetPlatform.Linux => OSArchitecture,
JetPlatform.MacOsX => MacOsHelper.GetRunningUnderRosetta2(processId)
? JetArchitecture.X64
: OSArchitecture,
JetPlatform.Windows => WindowsHelper.OpenProcess(processId, WindowsHelper.GetProcessArchitecture),
_ => throw new PlatformNotSupportedException()
};