make some projects compatible with netframework4.8 again

This commit is contained in:
2025-02-11 07:18:14 +01:00
parent f08c94908a
commit 07ab60666a
32 changed files with 57 additions and 55 deletions

View File

@@ -1,6 +1,4 @@
using Microsoft.VisualBasic.CompilerServices;
using Pilz.Win32.Native;
using Pilz.Win32.Native;
using Keys = System.Windows.Forms.Keys;
namespace Pilz.Win32.Mapped;
@@ -11,7 +9,7 @@ public class Keyboard
public static bool IsKeyDown(int keyCode)
{
return Conversions.ToDouble(User32.GetKeyState(keyCode).ToString() + 0x8000) < 0d;
return Convert.ToDouble(User32.GetKeyState(keyCode).ToString() + 0x8000) < 0d;
}
public static bool IsKeyDown(Keys keyCode)

View File

@@ -8,8 +8,10 @@ public static class NativeTools
[Obsolete("Use \"Environment.ProcessPath\" instead.")]
public static string GetExecutablePath(bool checkRealOS = false)
{
#if NET8_0_OR_GREATER
if (RuntimeInformationsEx.IsOSPlatform(OSType.Windows, checkRealOS))
return Environment.ProcessPath;
#endif
return Process.GetCurrentProcess().MainModule.FileName;
}
}

View File

@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows</TargetFrameworks>
<TargetFrameworks>net8.0-windows;netframework4.8</TargetFrameworks>
<LangVersion>latest</LangVersion>
<UseWindowsForms>true</UseWindowsForms>
<Version>2.1.0</Version>
<Version>2.1.1</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>annotations</Nullable>
</PropertyGroup>