From: <an...@us...> - 2007-09-06 16:53:27
|
Revision: 898 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=898&view=rev Author: and-81 Date: 2007-09-06 09:50:58 -0700 (Thu, 06 Sep 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Keyboard.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/NotifyWindow.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -20,7 +20,7 @@ #region Enumerations [Flags] - enum Digcfs + enum Digcfs : uint { None = 0x00, Default = 0x01, @@ -31,15 +31,24 @@ } [Flags] - public enum FileShares + protected enum CreateFileAccessTypes : uint { + GenericRead = 0x80000000, + GenericWrite = 0x40000000, + GenericExecute = 0x20000000, + GenericAll = 0x10000000, + } + + [Flags] + protected enum CreateFileShares : uint + { None = 0x00, Read = 0x01, Write = 0x02, Delete = 0x04, } - public enum CreationDisposition + protected enum CreateFileDisposition : uint { None = 0, New = 1, @@ -50,7 +59,7 @@ } [Flags] - public enum FileAttributes : uint + protected enum CreateFileAttributes : uint { Readonly = 0x00000001, Hidden = 0x00000002, @@ -79,15 +88,6 @@ FirstPipeInstance = 0x00080000, } - [Flags] - public enum FileAccessTypes : uint - { - GenericRead = 0x80000000, - GenericWrite = 0x40000000, - GenericExecute = 0x20000000, - GenericAll = 0x10000000, - } - #endregion Enumerations #region Structures @@ -185,9 +185,12 @@ #region Constructors - public Driver() { } - public Driver(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) + protected Driver() { } + protected Driver(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) { + if (String.IsNullOrEmpty(devicePath)) + throw new ArgumentException("Null or Empty device path supplied", "devicePath"); + _deviceGuid = deviceGuid; _devicePath = devicePath; Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -23,16 +23,16 @@ SafeFileHandle handle, ref NativeOverlapped overlapped, out int bytesTransferred, - bool wait); + [MarshalAs(UnmanagedType.Bool)] bool wait); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern SafeFileHandle CreateFile( [MarshalAs(UnmanagedType.LPTStr)] string fileName, - [MarshalAs(UnmanagedType.U4)] FileAccessTypes fileAccess, - [MarshalAs(UnmanagedType.U4)] FileShares fileShare, + [MarshalAs(UnmanagedType.U4)] CreateFileAccessTypes fileAccess, + [MarshalAs(UnmanagedType.U4)] CreateFileShares fileShare, IntPtr securityAttributes, - [MarshalAs(UnmanagedType.U4)] CreationDisposition creationDisposition, - [MarshalAs(UnmanagedType.U4)] FileAttributes flags, + [MarshalAs(UnmanagedType.U4)] CreateFileDisposition creationDisposition, + [MarshalAs(UnmanagedType.U4)] CreateFileAttributes flags, IntPtr templateFile); [DllImport("kernel32.dll", SetLastError = true)] @@ -109,8 +109,8 @@ #region Constants // Vendor ID's for SMK and Topseed devices. - const string VidSMK = "vid_1784"; - const string VidTopseed = "vid_0609"; + const string VidSMK = "vid_1784"; + const string VidTopseed = "vid_0609"; // Device variables const int DeviceBufferSize = 100; @@ -188,12 +188,12 @@ int lastError; - _readHandle = CreateFile(_devicePath + "\\Pipe01", FileAccessTypes.GenericRead, FileShares.None, IntPtr.Zero, CreationDisposition.OpenExisting, FileAttributes.Overlapped, IntPtr.Zero); + _readHandle = CreateFile(_devicePath + "\\Pipe01", CreateFileAccessTypes.GenericRead, CreateFileShares.None, IntPtr.Zero, CreateFileDisposition.OpenExisting, CreateFileAttributes.Overlapped, IntPtr.Zero); lastError = Marshal.GetLastWin32Error(); if (_readHandle.IsInvalid) throw new Win32Exception(lastError); - _writeHandle = CreateFile(_devicePath + "\\Pipe00", FileAccessTypes.GenericWrite, FileShares.None, IntPtr.Zero, CreationDisposition.OpenExisting, FileAttributes.Overlapped, IntPtr.Zero); + _writeHandle = CreateFile(_devicePath + "\\Pipe00", CreateFileAccessTypes.GenericWrite, CreateFileShares.None, IntPtr.Zero, CreateFileDisposition.OpenExisting, CreateFileAttributes.Overlapped, IntPtr.Zero); lastError = Marshal.GetLastWin32Error(); if (_writeHandle.IsInvalid) throw new Win32Exception(lastError); @@ -296,7 +296,7 @@ #region Implementation - byte[] CarrierPacket(IrCode code) + static byte[] CarrierPacket(IrCode code) { byte[] carrierPacket = new byte[SetCarrierFreqPacket.Length]; SetCarrierFreqPacket.CopyTo(carrierPacket, 0); @@ -319,7 +319,7 @@ return carrierPacket; } - byte[] DataPacket(IrCode code) + static byte[] DataPacket(IrCode code) { if (code.TimingData.Length == 0) return null; @@ -518,7 +518,7 @@ continue; sinceLastPacket = DateTime.Now.Subtract(lastPacketTime); - if (sinceLastPacket.TotalMilliseconds >= PacketTimeout) + if (sinceLastPacket.TotalMilliseconds >= PacketTimeout + 50) IrDecoder.DecodeIR(null, null, null, null); lastPacketTime = DateTime.Now; @@ -609,7 +609,7 @@ } } - catch + catch (Exception) { CancelIo(_readHandle); } @@ -693,7 +693,7 @@ } } - int[] GetTimingDataFromPacket(byte[] packet) + static int[] GetTimingDataFromPacket(byte[] packet) { List<int> timingData = new List<int>(); @@ -737,7 +737,7 @@ return timingData.ToArray(); } - void GetIrCodeLengths(IrCode code, out int onTime, out int onCount) + static void GetIrCodeLengths(IrCode code, out int onTime, out int onCount) { onTime = 0; onCount = 0; Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -220,30 +220,20 @@ [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - static extern bool DeviceIoControl( - SafeFileHandle handle, - [MarshalAs(UnmanagedType.U4)] IoCtrl ioControlCode, - IntPtr inBuffer, int inBufferSize, - IntPtr outBuffer, int outBufferSize, - out int bytesReturned, - IntPtr overlapped); - - [DllImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] static extern bool GetOverlappedResult( SafeFileHandle handle, ref NativeOverlapped overlapped, out int bytesTransferred, - bool wait); + [MarshalAs(UnmanagedType.Bool)] bool wait); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern SafeFileHandle CreateFile( [MarshalAs(UnmanagedType.LPTStr)] string fileName, - [MarshalAs(UnmanagedType.U4)] FileAccessTypes fileAccess, - [MarshalAs(UnmanagedType.U4)] FileShares fileShare, + [MarshalAs(UnmanagedType.U4)] CreateFileAccessTypes fileAccess, + [MarshalAs(UnmanagedType.U4)] CreateFileShares fileShare, IntPtr securityAttributes, - [MarshalAs(UnmanagedType.U4)] CreationDisposition creationDisposition, - [MarshalAs(UnmanagedType.U4)] FileAttributes flags, + [MarshalAs(UnmanagedType.U4)] CreateFileDisposition creationDisposition, + [MarshalAs(UnmanagedType.U4)] CreateFileAttributes flags, IntPtr templateFile); [DllImport("kernel32.dll")] @@ -262,16 +252,16 @@ #region Device Details - uint _numTxPorts = 0; - uint _numRxPorts = 0; + uint _numTxPorts = 0; + //uint _numRxPorts = 0; uint _learnPortMask = 0; - bool _legacyDevice = false; - bool _canFlashLed = false; + //bool _legacyDevice = false; + //bool _canFlashLed = false; bool[] _blasters; - uint _receivePort = 0; - uint _learnPort = 0; + uint _receivePort = 0; + uint _learnPort = 0; #endregion Device Details @@ -358,7 +348,7 @@ } _numTxPorts = structure.TransmitPorts; - _numRxPorts = structure.ReceivePorts; + //_numRxPorts = structure.ReceivePorts; _learnPortMask = structure.LearningMask; int receivePort = FirstLowBit(_learnPortMask); @@ -371,9 +361,9 @@ else _learnPort = _receivePort; - DeviceCapabilityFlags flags = structure.DetailsFlags; - _legacyDevice = (int)(flags & DeviceCapabilityFlags.Legacy) != 0; - _canFlashLed = (int)(flags & DeviceCapabilityFlags.FlashLed) != 0; + //DeviceCapabilityFlags flags = structure.DetailsFlags; + //_legacyDevice = (int)(flags & DeviceCapabilityFlags.Legacy) != 0; + //_canFlashLed = (int)(flags & DeviceCapabilityFlags.FlashLed) != 0; } void GetBlasters() @@ -520,7 +510,7 @@ _notifyWindow = new NotifyWindow(); _notifyWindow.Class = _deviceGuid; - _eHomeHandle = CreateFile(_devicePath, FileAccessTypes.GenericRead | FileAccessTypes.GenericWrite, FileShares.None, IntPtr.Zero, CreationDisposition.OpenExisting, FileAttributes.Overlapped, IntPtr.Zero); + _eHomeHandle = CreateFile(_devicePath, CreateFileAccessTypes.GenericRead | CreateFileAccessTypes.GenericWrite, CreateFileShares.None, IntPtr.Zero, CreateFileDisposition.OpenExisting, CreateFileAttributes.Overlapped, IntPtr.Zero); int lastError = Marshal.GetLastWin32Error(); if (_eHomeHandle.IsInvalid) throw new Win32Exception(lastError); @@ -613,7 +603,7 @@ #region Implementation - byte[] DataPacket(IrCode code) + static byte[] DataPacket(IrCode code) { if (code.TimingData.Length == 0) return null; @@ -755,7 +745,7 @@ } } } - catch + catch (Exception) { CancelIo(_eHomeHandle); } @@ -790,20 +780,15 @@ return rawData; } - static byte ConvertBcdToByte(byte b) + static int FirstHighBit(uint mask) { - return (byte)(((b >> 4) * 10) + (b & 15)); - } - - int FirstHighBit(uint mask) - { for (int i = 0; i < 32; i++) if ((mask & (1 << i)) != 0) return i; return -1; } - int FirstLowBit(uint mask) + static int FirstLowBit(uint mask) { for (int i = 0; i < 32; i++) if ((mask & (1 << i)) == 0) Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -23,16 +23,16 @@ SafeFileHandle handle, ref NativeOverlapped overlapped, out int bytesTransferred, - bool wait); + [MarshalAs(UnmanagedType.Bool)] bool wait); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern SafeFileHandle CreateFile( [MarshalAs(UnmanagedType.LPTStr)] string fileName, - [MarshalAs(UnmanagedType.U4)] FileAccessTypes fileAccess, - [MarshalAs(UnmanagedType.U4)] FileShares fileShare, + [MarshalAs(UnmanagedType.U4)] CreateFileAccessTypes fileAccess, + [MarshalAs(UnmanagedType.U4)] CreateFileShares fileShare, IntPtr securityAttributes, - [MarshalAs(UnmanagedType.U4)] CreationDisposition creationDisposition, - [MarshalAs(UnmanagedType.U4)] FileAttributes flags, + [MarshalAs(UnmanagedType.U4)] CreateFileDisposition creationDisposition, + [MarshalAs(UnmanagedType.U4)] CreateFileAttributes flags, IntPtr templateFile); [DllImport("kernel32.dll", SetLastError = true)] @@ -109,8 +109,8 @@ #region Constants // Vendor ID's for SMK and Topseed devices. - const string VidSMK = "vid_1784"; - const string VidTopseed = "vid_0609"; + const string VidSMK = "vid_1784"; + const string VidTopseed = "vid_0609"; // Device variables const int DeviceBufferSize = 100; @@ -187,7 +187,7 @@ int lastError; - _eHomeHandle = CreateFile(_devicePath, FileAccessTypes.GenericRead | FileAccessTypes.GenericWrite, FileShares.None, IntPtr.Zero, CreationDisposition.OpenExisting, FileAttributes.Overlapped, IntPtr.Zero); + _eHomeHandle = CreateFile(_devicePath, CreateFileAccessTypes.GenericRead | CreateFileAccessTypes.GenericWrite, CreateFileShares.None, IntPtr.Zero, CreateFileDisposition.OpenExisting, CreateFileAttributes.Overlapped, IntPtr.Zero); lastError = Marshal.GetLastWin32Error(); if (_eHomeHandle.IsInvalid) throw new Win32Exception(lastError); @@ -274,7 +274,7 @@ throw new Exception("Invalid device type"); } - //_debugFile.WriteLine(code.ToByteArray()); + //Dump(code.ToByteArray()); // Set port WriteSync(portPacket); @@ -290,7 +290,7 @@ #region Implementation - byte[] CarrierPacket(IrCode code) + static byte[] CarrierPacket(IrCode code) { byte[] carrierPacket = new byte[SetCarrierFreqPacket.Length]; SetCarrierFreqPacket.CopyTo(carrierPacket, 0); @@ -313,7 +313,7 @@ return carrierPacket; } - byte[] DataPacket(IrCode code) + static byte[] DataPacket(IrCode code) { if (code.TimingData.Length == 0) return null; @@ -600,7 +600,7 @@ } } - catch + catch (Exception) { CancelIo(_eHomeHandle); } @@ -684,7 +684,7 @@ } } - int[] GetTimingDataFromPacket(byte[] packet) + static int[] GetTimingDataFromPacket(byte[] packet) { List<int> timingData = new List<int>(); @@ -728,7 +728,7 @@ return timingData.ToArray(); } - void GetIrCodeLengths(IrCode code, out int onTime, out int onCount) + static void GetIrCodeLengths(IrCode code, out int onTime, out int onCount) { onTime = 0; onCount = 0; Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -108,8 +108,8 @@ /// <summary> /// Add timing data to this IR code. /// </summary> - /// <param name="addTimingData">Addition timing data.</param> - public void AddTimingData(int[] addTimingData) + /// <param name="timingData">Addition timing data.</param> + public void AddTimingData(int[] timingData) { List<int> newTimingData = new List<int>(); @@ -122,28 +122,25 @@ } else if (_timingData.Length == 0) { - _timingData = new int[addTimingData.Length]; - addTimingData.CopyTo(_timingData, 0); + _timingData = new int[timingData.Length]; + timingData.CopyTo(_timingData, 0); return; } - if (addTimingData.Length == 0 || index >= _timingData.Length) - { + if (timingData.Length == 0 || index >= _timingData.Length) return; - } - - if (Math.Sign(addTimingData[0]) == Math.Sign(_timingData[index])) + if (Math.Sign(timingData[0]) == Math.Sign(_timingData[index])) { - newTimingData.Add(_timingData[index] + addTimingData[0]); + newTimingData.Add(_timingData[index] + timingData[0]); - for (index = 1; index < addTimingData.Length; index++) - newTimingData.Add(addTimingData[index]); + for (index = 1; index < timingData.Length; index++) + newTimingData.Add(timingData[index]); } else { newTimingData.Add(_timingData[index]); - newTimingData.AddRange(addTimingData); + newTimingData.AddRange(timingData); } _timingData = newTimingData.ToArray(); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Keyboard.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Keyboard.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Keyboard.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -28,146 +28,146 @@ /// </summary> public enum VKey { - None = 0, - VK_0 = 0x30, - VK_1 = 0x31, - VK_2 = 0x32, - VK_3 = 0x33, - VK_4 = 0x34, - VK_5 = 0x35, - VK_6 = 0x36, - VK_7 = 0x37, - VK_8 = 0x38, - VK_9 = 0x39, - VK_A = 0x41, - VK_B = 0x42, - VK_C = 0x43, - VK_D = 0x44, - VK_E = 0x45, - VK_F = 0x46, - VK_G = 0x47, - VK_H = 0x48, - VK_I = 0x49, - VK_J = 0x4A, - VK_K = 0x4B, - VK_L = 0x4C, - VK_M = 0x4D, - VK_N = 0x4E, - VK_O = 0x4F, - VK_P = 0x50, - VK_Q = 0x51, - VK_R = 0x52, - VK_S = 0x53, - VK_T = 0x54, - VK_U = 0x55, - VK_V = 0x56, - VK_W = 0x57, - VK_X = 0x58, - VK_Y = 0x59, - VK_Z = 0x5A, - VK_ADD = 0x6B, - VK_APPS = 0x5D, - VK_ATTN = 0xF6, - VK_BACK = 0x8, - VK_CANCEL = 0x3, - VK_CAPITAL = 0x14, - VK_CLEAR = 0xC, - VK_CONTROL = 0x11, - VK_CRSEL = 0xF7, - VK_DECIMAL = 0x6E, - VK_DELETE = 0x2E, - VK_DIVIDE = 0x6F, - VK_DOWN = 0x28, - VK_END = 0x23, - VK_EREOF = 0xF9, - VK_ESCAPE = 0x1B, - VK_EXECUTE = 0x2B, - VK_EXSEL = 0xF8, - VK_F1 = 0x70, - VK_F2 = 0x71, - VK_F3 = 0x72, - VK_F4 = 0x73, - VK_F5 = 0x74, - VK_F6 = 0x75, - VK_F7 = 0x76, - VK_F8 = 0x77, - VK_F9 = 0x78, - VK_F10 = 0x79, - VK_F11 = 0x7A, - VK_F12 = 0x7B, - VK_F13 = 0x7C, - VK_F14 = 0x7D, - VK_F15 = 0x7E, - VK_F16 = 0x7F, - VK_F17 = 0x80, - VK_F18 = 0x81, - VK_F19 = 0x82, - VK_F20 = 0x83, - VK_F21 = 0x84, - VK_F22 = 0x85, - VK_F23 = 0x86, - VK_F24 = 0x87, - VK_HELP = 0x2F, - VK_HOME = 0x24, - VK_INSERT = 0x2D, - VK_LBUTTON = 0x1, + None = 0, + VK_0 = 0x30, + VK_1 = 0x31, + VK_2 = 0x32, + VK_3 = 0x33, + VK_4 = 0x34, + VK_5 = 0x35, + VK_6 = 0x36, + VK_7 = 0x37, + VK_8 = 0x38, + VK_9 = 0x39, + VK_A = 0x41, + VK_B = 0x42, + VK_C = 0x43, + VK_D = 0x44, + VK_E = 0x45, + VK_F = 0x46, + VK_G = 0x47, + VK_H = 0x48, + VK_I = 0x49, + VK_J = 0x4A, + VK_K = 0x4B, + VK_L = 0x4C, + VK_M = 0x4D, + VK_N = 0x4E, + VK_O = 0x4F, + VK_P = 0x50, + VK_Q = 0x51, + VK_R = 0x52, + VK_S = 0x53, + VK_T = 0x54, + VK_U = 0x55, + VK_V = 0x56, + VK_W = 0x57, + VK_X = 0x58, + VK_Y = 0x59, + VK_Z = 0x5A, + VK_ADD = 0x6B, + VK_APPS = 0x5D, + VK_ATTN = 0xF6, + VK_BACK = 0x8, + VK_CANCEL = 0x3, + VK_CAPITAL = 0x14, + VK_CLEAR = 0xC, + VK_CONTROL = 0x11, + VK_CRSEL = 0xF7, + VK_DECIMAL = 0x6E, + VK_DELETE = 0x2E, + VK_DIVIDE = 0x6F, + VK_DOWN = 0x28, + VK_END = 0x23, + VK_EREOF = 0xF9, + VK_ESCAPE = 0x1B, + VK_EXECUTE = 0x2B, + VK_EXSEL = 0xF8, + VK_F1 = 0x70, + VK_F2 = 0x71, + VK_F3 = 0x72, + VK_F4 = 0x73, + VK_F5 = 0x74, + VK_F6 = 0x75, + VK_F7 = 0x76, + VK_F8 = 0x77, + VK_F9 = 0x78, + VK_F10 = 0x79, + VK_F11 = 0x7A, + VK_F12 = 0x7B, + VK_F13 = 0x7C, + VK_F14 = 0x7D, + VK_F15 = 0x7E, + VK_F16 = 0x7F, + VK_F17 = 0x80, + VK_F18 = 0x81, + VK_F19 = 0x82, + VK_F20 = 0x83, + VK_F21 = 0x84, + VK_F22 = 0x85, + VK_F23 = 0x86, + VK_F24 = 0x87, + VK_HELP = 0x2F, + VK_HOME = 0x24, + VK_INSERT = 0x2D, + VK_LBUTTON = 0x1, VK_LCONTROL = 0xA2, - VK_LEFT = 0x25, - VK_LMENU = 0xA4, - VK_LSHIFT = 0xA0, - VK_LWIN = 0x5B, - VK_MBUTTON = 0x4, - VK_MENU = 0x12, + VK_LEFT = 0x25, + VK_LMENU = 0xA4, + VK_LSHIFT = 0xA0, + VK_LWIN = 0x5B, + VK_MBUTTON = 0x4, + VK_MENU = 0x12, VK_MULTIPLY = 0x6A, - VK_NEXT = 0x22, - VK_NONAME = 0xFC, - VK_NUMLOCK = 0x90, - VK_NUMPAD0 = 0x60, - VK_NUMPAD1 = 0x61, - VK_NUMPAD2 = 0x62, - VK_NUMPAD3 = 0x63, - VK_NUMPAD4 = 0x64, - VK_NUMPAD5 = 0x65, - VK_NUMPAD6 = 0x66, - VK_NUMPAD7 = 0x67, - VK_NUMPAD8 = 0x68, - VK_NUMPAD9 = 0x69, - VK_OEM_1 = 0xBA, // ";:" - VK_OEM_2 = 0xBF, // "/?" - VK_OEM_3 = 0xC0, // "`~" for US - VK_OEM_4 = 0xDB, // "[{" for US - VK_OEM_5 = 0xDC, // "\|" for US - VK_OEM_6 = 0xDD, // "]}" for US - VK_OEM_7 = 0xDE, // "'"" for US - VK_OEM_102 = 0xE2, + VK_NEXT = 0x22, + VK_NONAME = 0xFC, + VK_NUMLOCK = 0x90, + VK_NUMPAD0 = 0x60, + VK_NUMPAD1 = 0x61, + VK_NUMPAD2 = 0x62, + VK_NUMPAD3 = 0x63, + VK_NUMPAD4 = 0x64, + VK_NUMPAD5 = 0x65, + VK_NUMPAD6 = 0x66, + VK_NUMPAD7 = 0x67, + VK_NUMPAD8 = 0x68, + VK_NUMPAD9 = 0x69, + VK_OEM_1 = 0xBA, // ";:" + VK_OEM_2 = 0xBF, // "/?" + VK_OEM_3 = 0xC0, // "`~" for US + VK_OEM_4 = 0xDB, // "[{" for US + VK_OEM_5 = 0xDC, // "\|" for US + VK_OEM_6 = 0xDD, // "]}" for US + VK_OEM_7 = 0xDE, // "'"" for US + VK_OEM_102 = 0xE2, VK_OEM_CLEAR = 0xFE, VK_OEM_COMMA = 0xBC, VK_OEM_MINUS = 0xBD, VK_OEM_PERIOD = 0xBE, VK_OEM_PLUS = 0xBB, // "+=" - VK_PA1 = 0xFD, - VK_PAUSE = 0x13, - VK_PLAY = 0xFA, - VK_PRINT = 0x2A, - VK_PRIOR = 0x21, + VK_PA1 = 0xFD, + VK_PAUSE = 0x13, + VK_PLAY = 0xFA, + VK_PRINT = 0x2A, + VK_PRIOR = 0x21, VK_PROCESSKEY = 0xE5, - VK_RBUTTON = 0x2, + VK_RBUTTON = 0x2, VK_RCONTROL = 0xA3, - VK_RETURN = 0xD, - VK_RIGHT = 0x27, - VK_RMENU = 0xA5, - VK_RSHIFT = 0xA1, - VK_RWIN = 0x5C, - VK_SCROLL = 0x91, - VK_SELECT = 0x29, + VK_RETURN = 0xD, + VK_RIGHT = 0x27, + VK_RMENU = 0xA5, + VK_RSHIFT = 0xA1, + VK_RWIN = 0x5C, + VK_SCROLL = 0x91, + VK_SELECT = 0x29, VK_SEPARATOR = 0x6C, - VK_SHIFT = 0x10, + VK_SHIFT = 0x10, VK_SNAPSHOT = 0x2C, - VK_SPACE = 0x20, + VK_SPACE = 0x20, VK_SUBTRACT = 0x6D, - VK_TAB = 0x9, - VK_UP = 0x26, - VK_ZOOM = 0xFB, + VK_TAB = 0x9, + VK_UP = 0x26, + VK_ZOOM = 0xFB, } /// <summary> @@ -176,11 +176,11 @@ [Flags] public enum KeyEvents { - KeyDown = 0, - ExtendedKey = 1, - KeyUp = 2, - Unicode = 4, - ScanCode = 8, + KeyDown = 0x00, + ExtendedKey = 0x01, + KeyUp = 0x02, + Unicode = 0x04, + ScanCode = 0x08, } #endregion Enumerations Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -101,8 +101,6 @@ Mouse.MouseEvents _mouseButtons = Mouse.MouseEvents.None; - DateTime _lastPacketTime = DateTime.Now; - RemoteHandler _remoteHandler = null; KeyboardHandler _keyboardHandler = null; MouseHandler _mouseHandler = null; Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/NotifyWindow.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/NotifyWindow.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/NotifyWindow.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -68,7 +68,8 @@ [DllImport("kernel32")] [return: MarshalAs(UnmanagedType.Bool)] - static extern bool CancelIo(IntPtr handle); + static extern bool CancelIo( + IntPtr handle); #endregion Interop Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs 2007-09-06 15:59:39 UTC (rev 897) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs 2007-09-06 16:50:58 UTC (rev 898) @@ -78,33 +78,31 @@ /// </summary> /// <param name="fileName">File to write Pronto data to.</param> /// <param name="prontoData">Pronto data to write.</param> - /// <returns>Success.</returns> - public static bool WriteProntoFile(string fileName, ushort[] prontoData) + public static void WriteProntoFile(string fileName, ushort[] prontoData) { - try - { - StreamWriter file = new StreamWriter(fileName, false); + if (String.IsNullOrEmpty(fileName)) + throw new ArgumentException("Null or Empty filename provided.", "fileName"); - for (int index = 0; index < prontoData.Length; index++) - { - file.Write(String.Format("{0:X4}", prontoData[index])); - if (index != prontoData.Length - 1) - file.Write(' '); - } + if (prontoData == null || prontoData.Length == 0) + throw new ArgumentException("Null or Empty pronto data provided.", "prontoData"); - file.Flush(); - file.Close(); - } - catch + StreamWriter file = new StreamWriter(fileName, false); + + for (int index = 0; index < prontoData.Length; index++) { - return false; + file.Write(String.Format("{0:X4}", prontoData[index])); + if (index != prontoData.Length - 1) + file.Write(' '); } - return true; + file.Close(); } public static IrCode ConvertProntoDataToIrCode(ushort[] prontoData) { + if (prontoData == null || prontoData.Length == 0) + throw new ArgumentException("Null or Empty pronto data provided.", "prontoData"); + switch ((CodeType)prontoData[0]) { case CodeType.RawOscillated: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |