Now using SharpLib.Hid and SharpLib.Win32 as namespaces.
authorStephaneLenclud
Sun, 15 Mar 2015 14:45:40 +0100
changeset 77fb9ea5ad8c2d
parent 76 831ebeeecfdf
child 78 72885c950813
Now using SharpLib.Hid and SharpLib.Win32 as namespaces.
HidDevice.cs
HidEvent.cs
HidHandler.cs
HidUsageTables.cs
HidUtils.cs
MainForm.cs
RawInput.cs
RemoteControlDevice.cs
Win32AppCommand.cs
Win32CreateFile.cs
Win32Hid.cs
Win32RawInput.cs
     1.1 --- a/HidDevice.cs	Sun Mar 15 14:39:21 2015 +0100
     1.2 +++ b/HidDevice.cs	Sun Mar 15 14:45:40 2015 +0100
     1.3 @@ -24,9 +24,9 @@
     1.4  using System.Diagnostics;
     1.5  using System.Text;
     1.6  using Microsoft.Win32.SafeHandles;
     1.7 -using Win32;
     1.8 +using SharpLib.Win32;
     1.9  
    1.10 -namespace SharpLibHid
    1.11 +namespace SharpLib.Hid
    1.12  {
    1.13      /// <summary>
    1.14      /// Represent a HID device.
     2.1 --- a/HidEvent.cs	Sun Mar 15 14:39:21 2015 +0100
     2.2 +++ b/HidEvent.cs	Sun Mar 15 14:45:40 2015 +0100
     2.3 @@ -24,13 +24,13 @@
     2.4  using System.Diagnostics;
     2.5  using System.Text;
     2.6  using Microsoft.Win32.SafeHandles;
     2.7 -using Win32;
     2.8 +using SharpLib.Win32;
     2.9  using System.Collections.Generic;
    2.10  using System.Timers;
    2.11 -using SharpLibHid.Usage;
    2.12 +using SharpLib.Hid.Usage;
    2.13  
    2.14  
    2.15 -namespace SharpLibHid
    2.16 +namespace SharpLib.Hid
    2.17  {
    2.18      /// <summary>
    2.19      /// We provide utility functions to interpret gamepad dpad state.
    2.20 @@ -433,7 +433,7 @@
    2.21          /// <returns></returns>
    2.22          public DirectionPadState GetDirectionPadState()
    2.23          {
    2.24 -            int index=GetValueCapabilitiesIndex((ushort)SharpLibHid.UsagePage.GenericDesktopControls, (ushort)GenericDesktop.HatSwitch);
    2.25 +            int index=GetValueCapabilitiesIndex((ushort)Hid.UsagePage.GenericDesktopControls, (ushort)GenericDesktop.HatSwitch);
    2.26              if (index < 0)
    2.27              {
    2.28                  //No hat switch found
    2.29 @@ -529,11 +529,11 @@
    2.30                  UsagePage usagePage = (UsagePage)UsagePage;
    2.31                  switch (usagePage)
    2.32                  {
    2.33 -                    case SharpLibHid.UsagePage.Consumer:
    2.34 +                    case Hid.UsagePage.Consumer:
    2.35                          usageText += ((ConsumerControl)usage).ToString();
    2.36                          break;
    2.37  
    2.38 -                    case SharpLibHid.UsagePage.WindowsMediaCenterRemoteControl:
    2.39 +                    case Hid.UsagePage.WindowsMediaCenterRemoteControl:
    2.40                          usageText += ((WindowsMediaCenterRemoteControl)usage).ToString();
    2.41                          break;
    2.42  
     3.1 --- a/HidHandler.cs	Sun Mar 15 14:39:21 2015 +0100
     3.2 +++ b/HidHandler.cs	Sun Mar 15 14:45:40 2015 +0100
     3.3 @@ -24,11 +24,11 @@
     3.4  using System.Diagnostics;
     3.5  using System.Text;
     3.6  using Microsoft.Win32.SafeHandles;
     3.7 -using Win32;
     3.8 +using SharpLib.Win32;
     3.9  using System.Collections.Generic;
    3.10  
    3.11  
    3.12 -namespace SharpLibHid
    3.13 +namespace SharpLib.Hid
    3.14  {
    3.15      /// <summary>
    3.16      /// Our HID handler manages raw input registrations, processes WM_INPUT messages and broadcasts HID events in return.
     4.1 --- a/HidUsageTables.cs	Sun Mar 15 14:39:21 2015 +0100
     4.2 +++ b/HidUsageTables.cs	Sun Mar 15 14:45:40 2015 +0100
     4.3 @@ -17,7 +17,7 @@
     4.4  // along with SharpDisplayManager.  If not, see <http://www.gnu.org/licenses/>.
     4.5  //
     4.6  
     4.7 -namespace SharpLibHid
     4.8 +namespace SharpLib.Hid
     4.9  {
    4.10      /// <summary>
    4.11      /// From USB HID usage tables.
     5.1 --- a/HidUtils.cs	Sun Mar 15 14:39:21 2015 +0100
     5.2 +++ b/HidUtils.cs	Sun Mar 15 14:45:40 2015 +0100
     5.3 @@ -21,7 +21,7 @@
     5.4  using System.Collections.Generic;
     5.5  using System.Text;
     5.6  
     5.7 -namespace SharpLibHid
     5.8 +namespace SharpLib.Hid
     5.9  {
    5.10      static class Utils
    5.11      {
     6.1 --- a/MainForm.cs	Sun Mar 15 14:39:21 2015 +0100
     6.2 +++ b/MainForm.cs	Sun Mar 15 14:45:40 2015 +0100
     6.3 @@ -53,7 +53,7 @@
     6.4          private TreeView treeViewDevices;
     6.5  		private Timer _timer;
     6.6  
     6.7 -        public delegate void OnHidEventDelegate(object aSender, SharpLibHid.HidEvent aHidEvent);
     6.8 +        public delegate void OnHidEventDelegate(object aSender, SharpLib.Hid.HidEvent aHidEvent);
     6.9  
    6.10  		public MainForm()
    6.11  		{
    6.12 @@ -101,11 +101,11 @@
    6.13              _remote.iHidHandler.OnHidEvent += HandleHidEventThreadSafe;
    6.14              
    6.15              //
    6.16 -            Win32.RawInput.PopulateDeviceList(treeViewDevices);
    6.17 +            SharpLib.Win32.RawInput.PopulateDeviceList(treeViewDevices);
    6.18  
    6.19  		}
    6.20  
    6.21 -        public void HandleHidEventThreadSafe(object aSender, SharpLibHid.HidEvent aHidEvent)
    6.22 +        public void HandleHidEventThreadSafe(object aSender, SharpLib.Hid.HidEvent aHidEvent)
    6.23          {
    6.24              if (aHidEvent.IsStray)
    6.25              {
    6.26 @@ -147,12 +147,12 @@
    6.27                  //labelButtonName.Text = e.Button.ToString();
    6.28                  processed = true;
    6.29              }
    6.30 -            else if (e.MceButton != SharpLibHid.Usage.WindowsMediaCenterRemoteControl.Null)
    6.31 +            else if (e.MceButton != SharpLib.Hid.Usage.WindowsMediaCenterRemoteControl.Null)
    6.32              {
    6.33                  //Display MCE button name
    6.34                  //labelButtonName.Text = e.MceButton.ToString();
    6.35                  //Check if this is an HP extension
    6.36 -                if (Enum.IsDefined(typeof(SharpLibHid.Usage.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
    6.37 +                if (Enum.IsDefined(typeof(SharpLib.Hid.Usage.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
    6.38                  {
    6.39                      //Also display HP button name
    6.40                      //labelButtonName.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
    6.41 @@ -160,7 +160,7 @@
    6.42  
    6.43                  processed = true;                
    6.44              }
    6.45 -            else if (e.ConsumerControl != SharpLibHid.Usage.ConsumerControl.Null)
    6.46 +            else if (e.ConsumerControl != SharpLib.Hid.Usage.ConsumerControl.Null)
    6.47              {
    6.48                  //Display consumer control name
    6.49                  //labelButtonName.Text = e.ConsumerControl.ToString();
    6.50 @@ -199,7 +199,7 @@
    6.51          private void buttonRefresh_Click(object sender, EventArgs e)
    6.52          {
    6.53              treeViewDevices.Nodes.Clear();
    6.54 -            Win32.RawInput.PopulateDeviceList(treeViewDevices);
    6.55 +            SharpLib.Win32.RawInput.PopulateDeviceList(treeViewDevices);
    6.56          }
    6.57  
    6.58  	}
     7.1 --- a/RawInput.cs	Sun Mar 15 14:39:21 2015 +0100
     7.2 +++ b/RawInput.cs	Sun Mar 15 14:45:40 2015 +0100
     7.3 @@ -22,7 +22,7 @@
     7.4  using System.Diagnostics;
     7.5  using System.Windows.Forms;
     7.6  
     7.7 -namespace Win32
     7.8 +namespace SharpLib.Win32
     7.9  {
    7.10      /// <summary>
    7.11      /// Provide some utility functions for raw input handling.
    7.12 @@ -196,7 +196,7 @@
    7.13              //For each our device add a node to our treeview
    7.14              foreach (RAWINPUTDEVICELIST device in ridList)
    7.15              {
    7.16 -                SharpLibHid.HidDevice hidDevice=new SharpLibHid.HidDevice(device.hDevice);
    7.17 +                SharpLib.Hid.HidDevice hidDevice=new SharpLib.Hid.HidDevice(device.hDevice);
    7.18  
    7.19                  TreeNode node = null;
    7.20                  if (hidDevice.Product != null && hidDevice.Product.Length > 1)
    7.21 @@ -233,7 +233,7 @@
    7.22                  {
    7.23                      foreach (HIDP_VALUE_CAPS caps in hidDevice.InputValueCapabilities)
    7.24                      {
    7.25 -                        string des = SharpLibHid.HidDevice.InputValueCapabilityDescription(caps);
    7.26 +                        string des = SharpLib.Hid.HidDevice.InputValueCapabilityDescription(caps);
    7.27                          if (des != null)
    7.28                          {
    7.29                              node.Nodes.Add(des);
     8.1 --- a/RemoteControlDevice.cs	Sun Mar 15 14:39:21 2015 +0100
     8.2 +++ b/RemoteControlDevice.cs	Sun Mar 15 14:45:40 2015 +0100
     8.3 @@ -24,8 +24,8 @@
     8.4  using System.Text;
     8.5  using Microsoft.Win32.SafeHandles;
     8.6  
     8.7 -using SharpLibHid.Usage;
     8.8 -using Win32;
     8.9 +using SharpLib.Hid.Usage;
    8.10 +using SharpLib.Win32;
    8.11  
    8.12  
    8.13  
    8.14 @@ -185,7 +185,7 @@
    8.15          /// <returns></returns>
    8.16          public delegate bool HidUsageHandler(ushort aUsage);
    8.17  
    8.18 -        public SharpLibHid.HidHandler iHidHandler;
    8.19 +        public SharpLib.Hid.HidHandler iHidHandler;
    8.20  
    8.21  
    8.22          //-------------------------------------------------------------
    8.23 @@ -201,38 +201,38 @@
    8.24              RAWINPUTDEVICE[] rid = new RAWINPUTDEVICE[6];
    8.25  
    8.26              int i = 0;
    8.27 -            rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.WindowsMediaCenterRemoteControl;
    8.28 -            rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl;
    8.29 +            rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.WindowsMediaCenterRemoteControl;
    8.30 +            rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl;
    8.31              rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
    8.32              rid[i].hwndTarget = aHWND;
    8.33  
    8.34              i++;
    8.35 -            rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.Consumer;
    8.36 -            rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.Consumer.ConsumerControl;
    8.37 +            rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.Consumer;
    8.38 +            rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.Consumer.ConsumerControl;
    8.39              rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
    8.40              rid[i].hwndTarget = aHWND;
    8.41  
    8.42              i++;
    8.43 -            rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.Consumer;
    8.44 -            rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.Consumer.Selection;
    8.45 +            rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.Consumer;
    8.46 +            rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.Consumer.Selection;
    8.47              rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
    8.48              rid[i].hwndTarget = aHWND;
    8.49  
    8.50              i++;
    8.51 -            rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.GenericDesktopControls;
    8.52 -            rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.GenericDesktop.SystemControl;
    8.53 +            rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls;
    8.54 +            rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.SystemControl;
    8.55              rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
    8.56              rid[i].hwndTarget = aHWND;
    8.57  
    8.58  			i++;
    8.59 -			rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.GenericDesktopControls;
    8.60 -			rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.GenericDesktop.GamePad;
    8.61 +			rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls;
    8.62 +			rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.GamePad;
    8.63  			rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
    8.64  			rid[i].hwndTarget = aHWND;
    8.65  
    8.66              i++;
    8.67 -            rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.GenericDesktopControls;
    8.68 -            rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.GenericDesktop.Keyboard;
    8.69 +            rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls;
    8.70 +            rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.Keyboard;
    8.71              //rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
    8.72              rid[i].hwndTarget = aHWND;
    8.73  
    8.74 @@ -243,7 +243,7 @@
    8.75              //rid[i].hwndTarget = aHWND;
    8.76  
    8.77  
    8.78 -            iHidHandler = new SharpLibHid.HidHandler(rid);
    8.79 +            iHidHandler = new SharpLib.Hid.HidHandler(rid);
    8.80              if (!iHidHandler.IsRegistered)
    8.81              {
    8.82                  Debug.WriteLine("Failed to register raw input devices: " + Marshal.GetLastWin32Error().ToString());
    8.83 @@ -414,17 +414,17 @@
    8.84          /// </summary>
    8.85          /// <param name="aSender"></param>
    8.86          /// <param name="aHidEvent"></param>
    8.87 -        void HandleHidEvent(object aSender, SharpLibHid.HidEvent aHidEvent)
    8.88 +        void HandleHidEvent(object aSender, SharpLib.Hid.HidEvent aHidEvent)
    8.89          {
    8.90              HidUsageHandler usagePageHandler = null;
    8.91  
    8.92              //Check if this an MCE remote HID message
    8.93 -            if (aHidEvent.UsagePage == (ushort)SharpLibHid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)SharpLibHid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl)
    8.94 +            if (aHidEvent.UsagePage == (ushort)SharpLib.Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)SharpLib.Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl)
    8.95              {
    8.96                  usagePageHandler = HidMceRemoteHandler;
    8.97              }
    8.98              //Check if this is a consumer control HID message
    8.99 -            else if (aHidEvent.UsagePage == (ushort)SharpLibHid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)SharpLibHid.UsageCollection.Consumer.ConsumerControl)
   8.100 +            else if (aHidEvent.UsagePage == (ushort)SharpLib.Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)SharpLib.Hid.UsageCollection.Consumer.ConsumerControl)
   8.101              {
   8.102                  usagePageHandler = HidConsumerDeviceHandler;
   8.103              }
     9.1 --- a/Win32AppCommand.cs	Sun Mar 15 14:39:21 2015 +0100
     9.2 +++ b/Win32AppCommand.cs	Sun Mar 15 14:45:40 2015 +0100
     9.3 @@ -20,7 +20,7 @@
     9.4  using System;
     9.5  using System.Runtime.InteropServices;
     9.6  
     9.7 -namespace Win32
     9.8 +namespace SharpLib.Win32
     9.9  {
    9.10      static public partial class Const
    9.11      {
    10.1 --- a/Win32CreateFile.cs	Sun Mar 15 14:39:21 2015 +0100
    10.2 +++ b/Win32CreateFile.cs	Sun Mar 15 14:45:40 2015 +0100
    10.3 @@ -21,7 +21,7 @@
    10.4  using System.Runtime.InteropServices;
    10.5  using Microsoft.Win32.SafeHandles;
    10.6  
    10.7 -namespace Win32
    10.8 +namespace SharpLib.Win32
    10.9  {
   10.10  
   10.11      static partial class Function
    11.1 --- a/Win32Hid.cs	Sun Mar 15 14:39:21 2015 +0100
    11.2 +++ b/Win32Hid.cs	Sun Mar 15 14:45:40 2015 +0100
    11.3 @@ -22,7 +22,7 @@
    11.4  using Microsoft.Win32.SafeHandles;
    11.5  using System.Text;
    11.6  
    11.7 -namespace Win32
    11.8 +namespace SharpLib.Win32
    11.9  {
   11.10  
   11.11      static partial class Function
   11.12 @@ -42,7 +42,7 @@
   11.13          /// Return Type: NTSTATUS->LONG->int
   11.14          ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
   11.15          ///Capabilities: PHIDP_CAPS->_HIDP_CAPS*
   11.16 -        [DllImportAttribute("hid.dll", EntryPoint = "HidP_GetCaps", CallingConvention = CallingConvention.StdCall)]
   11.17 +        [DllImport("hid.dll", EntryPoint = "HidP_GetCaps", CallingConvention = CallingConvention.StdCall)]
   11.18          public static extern HidStatus HidP_GetCaps(System.IntPtr PreparsedData, ref HIDP_CAPS Capabilities);
   11.19  
   11.20          /// Return Type: NTSTATUS->LONG->int
   11.21 @@ -50,7 +50,7 @@
   11.22          ///ButtonCaps: PHIDP_BUTTON_CAPS->_HIDP_BUTTON_CAPS*
   11.23          ///ButtonCapsLength: PUSHORT->USHORT*
   11.24          ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
   11.25 -        [System.Runtime.InteropServices.DllImportAttribute("hid.dll", EntryPoint = "HidP_GetButtonCaps", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
   11.26 +        [DllImport("hid.dll", EntryPoint = "HidP_GetButtonCaps", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
   11.27          public static extern HidStatus HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] HIDP_BUTTON_CAPS[] ButtonCaps, ref ushort ButtonCapsLength, System.IntPtr PreparsedData);
   11.28  
   11.29          /// Return Type: NTSTATUS->LONG->int
   11.30 @@ -58,7 +58,7 @@
   11.31          ///ValueCaps: PHIDP_VALUE_CAPS->_HIDP_VALUE_CAPS*
   11.32          ///ValueCapsLength: PUSHORT->USHORT*
   11.33          ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
   11.34 -        [System.Runtime.InteropServices.DllImportAttribute("hid.dll", EntryPoint = "HidP_GetValueCaps", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
   11.35 +        [DllImport("hid.dll", EntryPoint = "HidP_GetValueCaps", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
   11.36          public static extern HidStatus HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] HIDP_VALUE_CAPS[] ValueCaps, ref ushort ValueCapsLength, System.IntPtr PreparsedData);
   11.37  
   11.38          /// Return Type: NTSTATUS->LONG->int
   11.39 @@ -70,7 +70,7 @@
   11.40          ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
   11.41          ///Report: PCHAR->CHAR*
   11.42          ///ReportLength: ULONG->unsigned int
   11.43 -        [System.Runtime.InteropServices.DllImportAttribute("hid.dll", EntryPoint = "HidP_GetUsageValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
   11.44 +        [DllImport("hid.dll", EntryPoint = "HidP_GetUsageValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
   11.45          public static extern HidStatus HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, ushort UsagePage, ushort LinkCollection, ushort Usage, ref uint UsageValue, System.IntPtr PreparsedData, [MarshalAs(UnmanagedType.LPArray)] byte[] Report, uint ReportLength);
   11.46  
   11.47  
   11.48 @@ -142,7 +142,7 @@
   11.49      }
   11.50  
   11.51  
   11.52 -    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
   11.53 +    [StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
   11.54      public struct HIDP_CAPS
   11.55      {
   11.56          /// USAGE->USHORT->unsigned short
   11.57 @@ -161,7 +161,7 @@
   11.58          public ushort FeatureReportByteLength;
   11.59  
   11.60          /// USHORT[17]
   11.61 -        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 17, ArraySubType = System.Runtime.InteropServices.UnmanagedType.U2)]
   11.62 +        [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 17, ArraySubType = System.Runtime.InteropServices.UnmanagedType.U2)]
   11.63          public ushort[] Reserved;
   11.64  
   11.65          /// USHORT->unsigned short
   11.66 @@ -198,7 +198,7 @@
   11.67      /// <summary>
   11.68      /// Type created in place of an anonymous struct
   11.69      /// </summary>
   11.70 -    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
   11.71 +    [StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
   11.72      public struct HIDP_BUTTON_CAPS_RANGE
   11.73      {
   11.74  
   11.75 @@ -230,7 +230,7 @@
   11.76      /// <summary>
   11.77      /// Type created in place of an anonymous struct
   11.78      /// </summary>
   11.79 -    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
   11.80 +    [StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
   11.81      public struct HIDP_BUTTON_CAPS_NOT_RANGE
   11.82      {
   11.83  
   11.84 @@ -262,7 +262,7 @@
   11.85      /// <summary>
   11.86      /// 
   11.87      /// </summary>
   11.88 -    [StructLayoutAttribute(LayoutKind.Explicit, Pack = 1)]
   11.89 +    [StructLayout(LayoutKind.Explicit, Pack = 1)]
   11.90      public struct HIDP_BUTTON_CAPS
   11.91      {
   11.92          /// USAGE->USHORT->unsigned short
   11.93 @@ -275,7 +275,7 @@
   11.94  
   11.95          /// BOOLEAN->BYTE->unsigned char
   11.96          [FieldOffset(3)]
   11.97 -        [MarshalAsAttribute(UnmanagedType.U1)]
   11.98 +        [MarshalAs(UnmanagedType.U1)]
   11.99          public bool IsAlias;
  11.100  
  11.101          /// USHORT->unsigned short
  11.102 @@ -296,27 +296,27 @@
  11.103  
  11.104          /// BOOLEAN->BYTE->unsigned char
  11.105          [FieldOffset(12)]
  11.106 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.107 +        [MarshalAs(UnmanagedType.U1)]
  11.108          public bool IsRange;
  11.109  
  11.110          /// BOOLEAN->BYTE->unsigned char
  11.111          [FieldOffset(13)]
  11.112 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.113 +        [MarshalAs(UnmanagedType.U1)]
  11.114          public bool IsStringRange;
  11.115  
  11.116          /// BOOLEAN->BYTE->unsigned char
  11.117          [FieldOffset(14)]
  11.118 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.119 +        [MarshalAs(UnmanagedType.U1)]
  11.120          public bool IsDesignatorRange;
  11.121  
  11.122          /// BOOLEAN->BYTE->unsigned char
  11.123          [FieldOffset(15)]
  11.124 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.125 +        [MarshalAs(UnmanagedType.U1)]
  11.126          public bool IsAbsolute;
  11.127  
  11.128          /// ULONG[10]
  11.129          [FieldOffset(16)]
  11.130 -        [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.U4)]
  11.131 +        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.U4)]
  11.132          public uint[] Reserved;
  11.133  
  11.134          /// Union Range/NotRange
  11.135 @@ -330,7 +330,7 @@
  11.136      /// <summary>
  11.137      /// Type created in place of an anonymous struct
  11.138      /// </summary>
  11.139 -    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  11.140 +    [StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
  11.141      public struct HIDP_VALUE_CAPS_RANGE
  11.142      {
  11.143  
  11.144 @@ -362,7 +362,7 @@
  11.145      /// <summary>
  11.146      /// Type created in place of an anonymous struct
  11.147      /// </summary>
  11.148 -    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  11.149 +    [StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
  11.150      public struct HIDP_VALUE_CAPS_NOT_RANGE
  11.151      {
  11.152  
  11.153 @@ -395,7 +395,7 @@
  11.154      /// <summary>
  11.155      /// 
  11.156      /// </summary>
  11.157 -    [StructLayoutAttribute(LayoutKind.Explicit, Pack = 1)]
  11.158 +    [StructLayout(LayoutKind.Explicit, Pack = 1)]
  11.159      public struct HIDP_VALUE_CAPS
  11.160      {
  11.161  
  11.162 @@ -409,7 +409,7 @@
  11.163  
  11.164          /// BOOLEAN->BYTE->unsigned char
  11.165          [FieldOffset(3)]
  11.166 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.167 +        [MarshalAs(UnmanagedType.U1)]
  11.168          public bool IsAlias;
  11.169  
  11.170          /// USHORT->unsigned short
  11.171 @@ -430,27 +430,27 @@
  11.172  
  11.173          /// BOOLEAN->BYTE->unsigned char
  11.174          [FieldOffset(12)]
  11.175 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.176 +        [MarshalAs(UnmanagedType.U1)]
  11.177          public bool IsRange;
  11.178  
  11.179          /// BOOLEAN->BYTE->unsigned char
  11.180          [FieldOffset(13)]
  11.181 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.182 +        [MarshalAs(UnmanagedType.U1)]
  11.183          public bool IsStringRange;
  11.184  
  11.185          /// BOOLEAN->BYTE->unsigned char
  11.186          [FieldOffset(14)]
  11.187 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.188 +        [MarshalAs(UnmanagedType.U1)]
  11.189          public bool IsDesignatorRange;
  11.190  
  11.191          /// BOOLEAN->BYTE->unsigned char
  11.192          [FieldOffset(15)]
  11.193 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.194 +        [MarshalAs(UnmanagedType.U1)]
  11.195          public bool IsAbsolute;
  11.196  
  11.197          /// BOOLEAN->BYTE->unsigned char
  11.198          [FieldOffset(16)]
  11.199 -        [MarshalAsAttribute(UnmanagedType.U1)]
  11.200 +        [MarshalAs(UnmanagedType.U1)]
  11.201          public bool HasNull;
  11.202  
  11.203          /// UCHAR->unsigned char
    12.1 --- a/Win32RawInput.cs	Sun Mar 15 14:39:21 2015 +0100
    12.2 +++ b/Win32RawInput.cs	Sun Mar 15 14:45:40 2015 +0100
    12.3 @@ -20,7 +20,7 @@
    12.4  using System;
    12.5  using System.Runtime.InteropServices;
    12.6  
    12.7 -namespace Win32
    12.8 +namespace SharpLib.Win32
    12.9  {
   12.10  
   12.11      static partial class Function
   12.12 @@ -372,7 +372,7 @@
   12.13          [FieldOffset(0)]
   12.14          public uint cbSize;
   12.15          [FieldOffset(4)]
   12.16 -        [MarshalAsAttribute(UnmanagedType.U4)]
   12.17 +        [MarshalAs(UnmanagedType.U4)]
   12.18          public RawInputDeviceType dwType;
   12.19          [FieldOffset(8)]
   12.20          public RID_DEVICE_INFO_MOUSE mouse;