Эх сурвалжийг харах

formated code

formated code
zhiqiang.yu 7 сар өмнө
parent
commit
70b25631a0

+ 9 - 10
smsdemo/HidSharp/AsyncResult.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,24 +13,22 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#endregion
 
 
-using System;
-using System.Threading;
+#endregion
 
 
 namespace HidSharp
 namespace HidSharp
 {
 {
-    class AsyncResult<T> : IAsyncResult
+    internal class AsyncResult<T> : IAsyncResult
     {
     {
-        volatile bool _isCompleted;
-        ManualResetEvent _waitHandle;
+        private volatile bool _isCompleted;
+        private ManualResetEvent _waitHandle;
 
 
-        AsyncResult(AsyncCallback callback, object state)
+        private AsyncResult(AsyncCallback callback, object state)
         {
         {
             AsyncCallback = callback; AsyncState = state;
             AsyncCallback = callback; AsyncState = state;
         }
         }
 
 
-        void Complete()
+        private void Complete()
         {
         {
             lock (this)
             lock (this)
             {
             {
@@ -107,13 +106,13 @@ namespace HidSharp
             get { return _isCompleted; }
             get { return _isCompleted; }
         }
         }
 
 
-        Exception Exception
+        private Exception Exception
         {
         {
             get;
             get;
             set;
             set;
         }
         }
 
 
-        T Result
+        private T Result
         {
         {
             get;
             get;
             set;
             set;

+ 4 - 3
smsdemo/HidSharp/HidDevice.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2010-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2010-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,9 +13,9 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
-using System;
 using System.Globalization;
 using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 
 
@@ -65,7 +66,7 @@ namespace HidSharp
 
 
         /// <summary>
         /// <summary>
         /// The operating system's name for the device.
         /// The operating system's name for the device.
-        /// 
+        ///
         /// If you have multiple devices with the same Vendor ID, Product ID, Serial Number. etc.,
         /// If you have multiple devices with the same Vendor ID, Product ID, Serial Number. etc.,
         /// this may be useful for differentiating them.
         /// this may be useful for differentiating them.
         /// </summary>
         /// </summary>
@@ -149,4 +150,4 @@ namespace HidSharp
                 SerialNumber.Length > 0 ? "serial " + SerialNumber.Trim() + ", " : "", VendorID, ProductID, ProductVersion);
                 SerialNumber.Length > 0 ? "serial " + SerialNumber.Trim() + ", " : "", VendorID, ProductID, ProductVersion);
         }
         }
     }
     }
-}
+}

+ 3 - 5
smsdemo/HidSharp/HidDeviceLoader.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2010, 2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2010, 2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,12 +13,10 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
-using System;
 using System.Collections;
 using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 
 
 namespace HidSharp
 namespace HidSharp
@@ -33,7 +32,6 @@ namespace HidSharp
         /// </summary>
         /// </summary>
         public HidDeviceLoader()
         public HidDeviceLoader()
         {
         {
-
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -93,4 +91,4 @@ namespace HidSharp
             return GetDevices(vendorID, productID, productVersion, serialNumber).FirstOrDefault();
             return GetDevices(vendorID, productID, productVersion, serialNumber).FirstOrDefault();
         }
         }
     }
     }
-}
+}

+ 9 - 12
smsdemo/HidSharp/HidStream.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,13 +13,10 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
-using System;
-using System.Collections.Generic;
-using System.IO;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
-using System.Threading;
 
 
 #pragma warning disable 420
 #pragma warning disable 420
 
 
@@ -30,8 +28,8 @@ namespace HidSharp
     [ComVisible(true), Guid("0C263D05-0D58-4c6c-AEA7-EB9E0C5338A2")]
     [ComVisible(true), Guid("0C263D05-0D58-4c6c-AEA7-EB9E0C5338A2")]
     public abstract class HidStream : Stream
     public abstract class HidStream : Stream
     {
     {
-        int _opened, _closed;
-        volatile int _refCount;
+        private int _opened, _closed;
+        private volatile int _refCount;
 
 
         internal class CommonOutputReport
         internal class CommonOutputReport
         {
         {
@@ -156,7 +154,6 @@ namespace HidSharp
         /// <exclude />
         /// <exclude />
         public override void Flush()
         public override void Flush()
         {
         {
-
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -359,11 +356,11 @@ namespace HidSharp
 
 
         /// <summary>
         /// <summary>
         /// The maximum amount of time, in milliseconds, to wait for to receive a HID report.
         /// The maximum amount of time, in milliseconds, to wait for to receive a HID report.
-        /// 
+        ///
         /// The default is 3000 milliseconds.
         /// The default is 3000 milliseconds.
         /// To disable the timeout, set this to <see cref="Timeout.Infinite"/>.
         /// To disable the timeout, set this to <see cref="Timeout.Infinite"/>.
         /// </summary>
         /// </summary>
-        public sealed override int ReadTimeout
+        public override sealed int ReadTimeout
         {
         {
             get;
             get;
             set;
             set;
@@ -371,14 +368,14 @@ namespace HidSharp
 
 
         /// <summary>
         /// <summary>
         /// The maximum amount of time, in milliseconds, to wait for the device to acknowledge a HID report.
         /// The maximum amount of time, in milliseconds, to wait for the device to acknowledge a HID report.
-        /// 
+        ///
         /// The default is 3000 milliseconds.
         /// The default is 3000 milliseconds.
         /// To disable the timeout, set this to <see cref="Timeout.Infinite"/>.
         /// To disable the timeout, set this to <see cref="Timeout.Infinite"/>.
         /// </summary>
         /// </summary>
-        public sealed override int WriteTimeout
+        public override sealed int WriteTimeout
         {
         {
             get;
             get;
             set;
             set;
         }
         }
     }
     }
-}
+}

+ 5 - 11
smsdemo/HidSharp/LEDBlink.cs

@@ -1,5 +1,4 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
 
 
 namespace smsdemo.HidSharp
 namespace smsdemo.HidSharp
 {
 {
@@ -35,7 +34,6 @@ namespace smsdemo.HidSharp
 
 
                 actions++;
                 actions++;
                 led.TestBlink();
                 led.TestBlink();
-
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
@@ -48,8 +46,8 @@ namespace smsdemo.HidSharp
                     led.Dispose();
                     led.Dispose();
                 }
                 }
             }
             }
-
         }
         }
+
         public void TestBlinkViolet()
         public void TestBlinkViolet()
         {
         {
             int actions = 0; //Track if any actions are executed
             int actions = 0; //Track if any actions are executed
@@ -80,7 +78,6 @@ namespace smsdemo.HidSharp
 
 
                 actions++;
                 actions++;
                 led.TestBlinkViolet();
                 led.TestBlinkViolet();
-
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
@@ -93,8 +90,8 @@ namespace smsdemo.HidSharp
                     led.Dispose();
                     led.Dispose();
                 }
                 }
             }
             }
-
         }
         }
+
         public void TestBlinkYellow()
         public void TestBlinkYellow()
         {
         {
             int actions = 0; //Track if any actions are executed
             int actions = 0; //Track if any actions are executed
@@ -125,7 +122,6 @@ namespace smsdemo.HidSharp
 
 
                 actions++;
                 actions++;
                 led.TestBlinkYellow();
                 led.TestBlinkYellow();
-
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
@@ -138,8 +134,8 @@ namespace smsdemo.HidSharp
                     led.Dispose();
                     led.Dispose();
                 }
                 }
             }
             }
-
         }
         }
+
         public void TestBlinkGreen()
         public void TestBlinkGreen()
         {
         {
             int actions = 0; //Track if any actions are executed
             int actions = 0; //Track if any actions are executed
@@ -170,7 +166,6 @@ namespace smsdemo.HidSharp
 
 
                 actions++;
                 actions++;
                 led.TestBlinkGreen();
                 led.TestBlinkGreen();
-
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
@@ -183,7 +178,6 @@ namespace smsdemo.HidSharp
                     led.Dispose();
                     led.Dispose();
                 }
                 }
             }
             }
-
         }
         }
     }
     }
-}
+}

+ 6 - 9
smsdemo/HidSharp/Platform/HidManager.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,18 +13,15 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#endregion
 
 
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
+#endregion
 
 
 namespace HidSharp.Platform
 namespace HidSharp.Platform
 {
 {
-    abstract class HidManager
+    internal abstract class HidManager
     {
     {
-        Dictionary<object, HidDevice> _deviceList;
-        object _syncRoot;
+        private Dictionary<object, HidDevice> _deviceList;
+        private object _syncRoot;
 
 
         protected HidManager()
         protected HidManager()
         {
         {
@@ -33,7 +31,6 @@ namespace HidSharp.Platform
 
 
         public virtual void Init()
         public virtual void Init()
         {
         {
-
         }
         }
 
 
         public virtual void Run()
         public virtual void Run()
@@ -116,4 +113,4 @@ namespace HidSharp.Platform
             get { return _syncRoot; }
             get { return _syncRoot; }
         }
         }
     }
     }
-}
+}

+ 5 - 5
smsdemo/HidSharp/Platform/HidSelector.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,16 +13,15 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#endregion
 
 
-using System.Threading;
+#endregion
 
 
 namespace HidSharp.Platform
 namespace HidSharp.Platform
 {
 {
-    sealed class HidSelector
+    internal sealed class HidSelector
     {
     {
         public static readonly HidManager Instance;
         public static readonly HidManager Instance;
-        static readonly Thread ManagerThread;
+        private static readonly Thread ManagerThread;
 
 
         static HidSelector()
         static HidSelector()
         {
         {
@@ -46,4 +46,4 @@ namespace HidSharp.Platform
             }
             }
         }
         }
     }
     }
-}
+}

+ 6 - 6
smsdemo/HidSharp/Platform/Libusb/NativeMethods.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,16 +13,16 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
-using System;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 
 
 namespace HidSharp.Platform.Libusb
 namespace HidSharp.Platform.Libusb
 {
 {
-    static class NativeMethods
+    internal static class NativeMethods
     {
     {
-        const string Libusb = "libusb-1.0";
+        private const string Libusb = "libusb-1.0";
 
 
         public struct DeviceDescriptor
         public struct DeviceDescriptor
         {
         {
@@ -183,7 +184,7 @@ namespace HidSharp.Platform.Libusb
         [DllImport(Libusb)]
         [DllImport(Libusb)]
         public static extern void libusb_free_config_descriptor(IntPtr configuration);
         public static extern void libusb_free_config_descriptor(IntPtr configuration);
 
 
-        static Error libusb_get_descriptor_core(IntPtr deviceHandle, DescriptorType type, byte index, byte[] data, ushort wLength, ushort wIndex)
+        private static Error libusb_get_descriptor_core(IntPtr deviceHandle, DescriptorType type, byte index, byte[] data, ushort wLength, ushort wIndex)
         {
         {
             return libusb_control_transfer(deviceHandle,
             return libusb_control_transfer(deviceHandle,
                                            (byte)EndpointDirection.In, (byte)Request.GetDescriptor,
                                            (byte)EndpointDirection.In, (byte)Request.GetDescriptor,
@@ -225,5 +226,4 @@ namespace HidSharp.Platform.Libusb
                                                                 out int transferred,
                                                                 out int transferred,
                                                                 uint timeout);
                                                                 uint timeout);
     }
     }
-}
-
+}

+ 4 - 4
smsdemo/HidSharp/Platform/Unsupported/UnsupportedHidManager.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,13 +13,12 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#endregion
 
 
-using System;
+#endregion
 
 
 namespace HidSharp.Platform.Unsupported
 namespace HidSharp.Platform.Unsupported
 {
 {
-    class UnsupportedHidManager : HidManager
+    internal class UnsupportedHidManager : HidManager
     {
     {
         protected override object[] Refresh()
         protected override object[] Refresh()
         {
         {
@@ -40,4 +40,4 @@ namespace HidSharp.Platform.Unsupported
             get { return true; }
             get { return true; }
         }
         }
     }
     }
-}
+}

+ 13 - 13
smsdemo/HidSharp/Platform/Windows/WinHidDevice.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2010, 2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2010, 2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,34 +13,33 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
 #pragma warning disable 618
 #pragma warning disable 618
 
 
-using System;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
-using System.Threading;
 
 
 namespace HidSharp.Platform.Windows
 namespace HidSharp.Platform.Windows
 {
 {
-    sealed class WinHidDevice : HidDevice
+    internal sealed class WinHidDevice : HidDevice
     {
     {
-        string _path;
-        string _manufacturer;
-        string _productName;
-        string _serialNumber;
-        int _vid, _pid, _version;
-        int _maxInput, _maxOutput, _maxFeature;
+        private string _path;
+        private string _manufacturer;
+        private string _productName;
+        private string _serialNumber;
+        private int _vid, _pid, _version;
+        private int _maxInput, _maxOutput, _maxFeature;
 
 
-        object _completeSync = new object();
-        volatile bool _complete;
+        private object _completeSync = new object();
+        private volatile bool _complete;
 
 
         internal WinHidDevice(string path)
         internal WinHidDevice(string path)
         {
         {
             _path = path;
             _path = path;
         }
         }
 
 
-        void WaitForCompletion()
+        private void WaitForCompletion()
         {
         {
             lock (_completeSync)
             lock (_completeSync)
             {
             {
@@ -149,4 +149,4 @@ namespace HidSharp.Platform.Windows
             get { return _vid; }
             get { return _vid; }
         }
         }
     }
     }
-}
+}

+ 4 - 5
smsdemo/HidSharp/Platform/Windows/WinHidManager.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,16 +13,14 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 
 
 namespace HidSharp.Platform.Windows
 namespace HidSharp.Platform.Windows
 {
 {
-    class WinHidManager : HidManager
+    internal class WinHidManager : HidManager
     {
     {
         protected override object[] Refresh()
         protected override object[] Refresh()
         {
         {
@@ -105,4 +104,4 @@ namespace HidSharp.Platform.Windows
             }
             }
         }
         }
     }
     }
-}
+}

+ 13 - 16
smsdemo/HidSharp/Platform/Windows/WinHidStream.cs

@@ -1,4 +1,5 @@
 #region License
 #region License
+
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 /* Copyright 2012-2013 James F. Bellinger <http://www.zer7.com/software/hidsharp>
 
 
    Permission to use, copy, modify, and/or distribute this software for any
    Permission to use, copy, modify, and/or distribute this software for any
@@ -12,21 +13,19 @@
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
 #endregion
 #endregion
 
 
-using System;
 using System.ComponentModel;
 using System.ComponentModel;
-using System.IO;
-using System.Threading;
 
 
 namespace HidSharp.Platform.Windows
 namespace HidSharp.Platform.Windows
 {
 {
-    class WinHidStream : HidStream
+    internal class WinHidStream : HidStream
     {
     {
-        object _readSync = new object(), _writeSync = new object();
-        byte[] _readBuffer, _writeBuffer;
-        IntPtr _handle, _closeEventHandle;
-        WinHidDevice _device;
+        private object _readSync = new object(), _writeSync = new object();
+        private byte[] _readBuffer, _writeBuffer;
+        private IntPtr _handle, _closeEventHandle;
+        private WinHidDevice _device;
 
 
         internal WinHidStream()
         internal WinHidStream()
         {
         {
@@ -64,9 +63,8 @@ namespace HidSharp.Platform.Windows
             NativeMethods.CloseHandle(ref _closeEventHandle);
             NativeMethods.CloseHandle(ref _closeEventHandle);
         }
         }
 
 
-        public unsafe override void GetFeature(byte[] buffer, int offset, int count)
+        public override unsafe void GetFeature(byte[] buffer, int offset, int count)
         {
         {
-
             HandleAcquireIfOpenOrFail();
             HandleAcquireIfOpenOrFail();
             try
             try
             {
             {
@@ -84,9 +82,9 @@ namespace HidSharp.Platform.Windows
 
 
         // Buffer needs to be big enough for the largest report, plus a byte
         // Buffer needs to be big enough for the largest report, plus a byte
         // for the Report ID.
         // for the Report ID.
-        public unsafe override int Read(byte[] buffer, int offset, int count)
+        public override unsafe int Read(byte[] buffer, int offset, int count)
         {
         {
-             uint bytesTransferred;
+            uint bytesTransferred;
             IntPtr @event = NativeMethods.CreateManualResetEventOrThrow();
             IntPtr @event = NativeMethods.CreateManualResetEventOrThrow();
 
 
             HandleAcquireIfOpenOrFail();
             HandleAcquireIfOpenOrFail();
@@ -119,9 +117,8 @@ namespace HidSharp.Platform.Windows
             }
             }
         }
         }
 
 
-        public unsafe override void SetFeature(byte[] buffer, int offset, int count)
+        public override unsafe void SetFeature(byte[] buffer, int offset, int count)
         {
         {
-
             HandleAcquireIfOpenOrFail();
             HandleAcquireIfOpenOrFail();
             try
             try
             {
             {
@@ -137,7 +134,7 @@ namespace HidSharp.Platform.Windows
             }
             }
         }
         }
 
 
-        public unsafe override void Write(byte[] buffer, int offset, int count)
+        public override unsafe void Write(byte[] buffer, int offset, int count)
         {
         {
             uint bytesTransferred;
             uint bytesTransferred;
             IntPtr @event = NativeMethods.CreateManualResetEventOrThrow();
             IntPtr @event = NativeMethods.CreateManualResetEventOrThrow();
@@ -179,4 +176,4 @@ namespace HidSharp.Platform.Windows
             get { return _device; }
             get { return _device; }
         }
         }
     }
     }
-}
+}

+ 1 - 1
smsdemo/Program.cs

@@ -6,7 +6,7 @@ namespace smsdemo
         ///  The main entry point for the application.
         ///  The main entry point for the application.
         /// </summary>
         /// </summary>
         [STAThread]
         [STAThread]
-        static void Main()
+        private static void Main()
         {
         {
             // To customize application configuration such as set high DPI settings or default font,
             // To customize application configuration such as set high DPI settings or default font,
             // see https://aka.ms/applicationconfiguration.
             // see https://aka.ms/applicationconfiguration.