mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-15 17:05:03 +03:00
Use LibraryImport for native APIs
This commit is contained in:
@@ -5,7 +5,7 @@ using Microsoft.Win32;
|
|||||||
|
|
||||||
namespace v2rayN.Common;
|
namespace v2rayN.Common;
|
||||||
|
|
||||||
internal static class WindowsUtils
|
internal static partial class WindowsUtils
|
||||||
{
|
{
|
||||||
private static readonly string _tag = "WindowsUtils";
|
private static readonly string _tag = "WindowsUtils";
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@ internal static class WindowsUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("dwmapi.dll")]
|
[LibraryImport("dwmapi.dll")]
|
||||||
public static extern int DwmSetWindowAttribute(nint hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
|
public static partial int DwmSetWindowAttribute(nint hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
|
||||||
|
|
||||||
public static ImageSource IconToImageSource(Icon icon)
|
public static ImageSource IconToImageSource(Icon icon)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace v2rayN.Manager;
|
namespace v2rayN.Manager;
|
||||||
|
|
||||||
public sealed class HotkeyManager
|
public sealed partial class HotkeyManager
|
||||||
{
|
{
|
||||||
private static readonly Lazy<HotkeyManager> _instance = new(() => new());
|
private static readonly Lazy<HotkeyManager> _instance = new(() => new());
|
||||||
public static HotkeyManager Instance = _instance.Value;
|
public static HotkeyManager Instance = _instance.Value;
|
||||||
@@ -165,11 +165,13 @@ public sealed class HotkeyManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[LibraryImport("user32.dll", SetLastError = true)]
|
||||||
private static extern bool RegisterHotKey(nint hWnd, int id, int fsModifiers, int vlc);
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
private static partial bool RegisterHotKey(nint hWnd, int id, int fsModifiers, int vlc);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[LibraryImport("user32.dll", SetLastError = true)]
|
||||||
private static extern bool UnregisterHotKey(nint hWnd, int id);
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
private static partial bool UnregisterHotKey(nint hWnd, int id);
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
private enum KeyModifiers
|
private enum KeyModifiers
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
<ApplicationIcon>Resources\v2rayN.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\v2rayN.ico</ApplicationIcon>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user