mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Added logitech support (unfinished: HID-Ids and layouts are missing)
This commit is contained in:
1 parent
5bd1012fbe
commit
2af55146cc
22 files changed
+1310
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <summary>
|
||||
/// Offers some helper-methods for culture related things.
|
||||
/// </summary>
|
||||
public static class CultureHelper
|
||||
{
|
||||
#region DLLImports
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern IntPtr GetKeyboardLayout(uint thread);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current keyboard-layout from the OS.
|
||||
/// </summary>
|
||||
/// <returns>The current keyboard-layout</returns>
|
||||
public static CultureInfo GetCurrentCulture()
|
||||
{
|
||||
try
|
||||
{
|
||||
int keyboardLayout = GetKeyboardLayout(0).ToInt32() & 0xFFFF;
|
||||
return new CultureInfo(keyboardLayout);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new CultureInfo(1033); // en-US on error.
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user