From: <an...@us...> - 2008-02-26 14:53:38
|
Revision: 1397 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1397&view=rev Author: and-81 Date: 2008-02-26 06:53:36 -0800 (Tue, 26 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs trunk/plugins/IR Server Suite/Applications/Web Remote/Setup.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs trunk/plugins/IR Server Suite/Common/IrssUtils/IrssLog.cs trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs trunk/plugins/IR Server Suite/IR Server Plugins/Ads Tech PTV-335 Receiver/Ads Tech PTV-335 Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/IR501 Receiver/IR501Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507 Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDrive Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.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/Microsoft MCE Transceiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs trunk/plugins/IR Server Suite/IR Server Plugins/RC102 Receiver/RC102Receiver.cs trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi trunk/plugins/IR Server Suite/IR Server Suite - Release.nsi trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs trunk/plugins/IR Server Suite/Input Service/Input Service/Program.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Program.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/PluginSetup.cs Property Changed: ---------------- trunk/plugins/IR Server Suite/IR Server Plugins/IR501 Receiver/ trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/ Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -517,7 +517,8 @@ { try { - Help.ShowHelp(this, SystemRegistry.GetInstallFolder() + "\\IR Server Suite.chm"); + string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm"); + Help.ShowHelp(this, file); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -78,60 +78,46 @@ /// <returns>Array of plugin instances.</returns> internal static PluginBase[] AvailablePlugins() { - try - { - List<PluginBase> plugins = new List<PluginBase>(); + List<PluginBase> plugins = new List<PluginBase>(); - string installFolder = SystemRegistry.GetInstallFolder(); - if (String.IsNullOrEmpty(installFolder)) - return null; + string installFolder = SystemRegistry.GetInstallFolder(); + if (String.IsNullOrEmpty(installFolder)) + return null; - string[] files = Directory.GetFiles(installFolder + "\\IR Server Plugins\\", "*.dll", SearchOption.TopDirectoryOnly); - - foreach (string file in files) + string[] files = Directory.GetFiles(installFolder + "\\IR Server Plugins\\", "*.dll", SearchOption.TopDirectoryOnly); + foreach (string file in files) + { + try { - try - { - Assembly assembly = Assembly.LoadFrom(file); - Type[] types = assembly.GetExportedTypes(); + Assembly assembly = Assembly.LoadFrom(file); + Type[] types = assembly.GetExportedTypes(); - foreach (Type type in types) + foreach (Type type in types) + { + if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(PluginBase))) { - if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(PluginBase))) - { - PluginBase plugin = (PluginBase)assembly.CreateInstance(type.FullName); + PluginBase plugin = (PluginBase)assembly.CreateInstance(type.FullName); - if (plugin != null) - plugins.Add(plugin); - } + if (plugin != null) + plugins.Add(plugin); } } - catch (BadImageFormatException) - { - // Ignore Bad Image Format Exceptions, just keep checking for IR Server Plugins - } - catch (TypeLoadException) - { - // Ignore Type Load Exceptions, just keep checking for IR Server Plugins - } - catch (Exception ex) - { - MessageBox.Show(ex.ToString(), "IR Server Plugin Error"); - } } - - return plugins.ToArray(); + catch (BadImageFormatException) + { + // Ignore Bad Image Format Exceptions, just keep checking for IR Server Plugins + } + catch (TypeLoadException) + { + // Ignore Type Load Exceptions, just keep checking for IR Server Plugins + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString(), "IR Server Plugin Error"); + } } -#if TRACE - catch (Exception ex) - { - Trace.WriteLine("IRServer: " + ex.ToString()); -#else - catch - { -#endif - return null; - } + + return plugins.ToArray(); } /// <summary> @@ -152,7 +138,7 @@ if (plugin.Name.Equals(pluginName, StringComparison.OrdinalIgnoreCase)) return plugin; - return null; + throw new ApplicationException(String.Format("Plugin not found ({0})", pluginName)); } /// <summary> @@ -161,44 +147,16 @@ /// <returns>String array of plugin names.</returns> internal static string[] DetectReceivers() { - try - { - PluginBase[] plugins = AvailablePlugins(); + PluginBase[] plugins = AvailablePlugins(); - List<string> receivers = new List<string>(); + List<string> receivers = new List<string>(); - foreach (PluginBase plugin in plugins) - { - try - { - if ((plugin is IRemoteReceiver || plugin is IKeyboardReceiver || plugin is IMouseReceiver) && plugin.Detect()) - receivers.Add(plugin.Name); - } -#if TRACE - catch (Exception ex) - { - Trace.WriteLine("IRServer: " + ex.ToString()); - } -#else - catch - { - } -#endif - } + foreach (PluginBase plugin in plugins) + if ((plugin is IRemoteReceiver || plugin is IKeyboardReceiver || plugin is IMouseReceiver) && plugin.Detect()) + receivers.Add(plugin.Name); - if (receivers.Count > 0) - return receivers.ToArray(); - } -#if TRACE - catch (Exception ex) - { - Trace.WriteLine("IRServer: " + ex.ToString()); - } -#else - catch - { - } -#endif + if (receivers.Count > 0) + return receivers.ToArray(); return null; } @@ -209,29 +167,16 @@ /// <returns>String array of plugin names.</returns> internal static string[] DetectBlasters() { - try - { - PluginBase[] plugins = Program.AvailablePlugins(); + PluginBase[] plugins = Program.AvailablePlugins(); - List<string> blasters = new List<string>(); + List<string> blasters = new List<string>(); - foreach (PluginBase plugin in plugins) - if (plugin is ITransmitIR && plugin.Detect()) - blasters.Add(plugin.Name); + foreach (PluginBase plugin in plugins) + if (plugin is ITransmitIR && plugin.Detect()) + blasters.Add(plugin.Name); - if (blasters.Count > 0) - return blasters.ToArray(); - } -#if TRACE - catch (Exception ex) - { - Trace.WriteLine("IRServer: " + ex.ToString()); - } -#else - catch - { - } -#endif + if (blasters.Count > 0) + return blasters.ToArray(); return null; } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -625,7 +625,8 @@ { try { - Help.ShowHelp(this, SystemRegistry.GetInstallFolder() + "\\IR Server Suite.chm", HelpNavigator.Topic, "Common\\keystrokes_info.html"); + string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm"); + Help.ShowHelp(this, file, HelpNavigator.Topic, "Common\\keystrokes_info.html"); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -159,7 +159,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\user32.dll"; + string file = Path.Combine(folder, "user32.dll"); Win32.ExtractIcons(file, 1, out large, out small); imageListPrograms.Images.Add(large); @@ -1143,7 +1143,8 @@ { try { - Help.ShowHelp(this, SystemRegistry.GetInstallFolder() + "\\IR Server Suite.chm", HelpNavigator.Topic, "Translator\\index.html"); + string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm"); + Help.ShowHelp(this, file, HelpNavigator.Topic, "Translator\\index.html"); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -167,7 +167,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, IconLaunch, out large, out small); _listMain.Images.Add(large); @@ -231,7 +231,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, IconDesktop, out large, out small); newList.Images.Add(large); @@ -307,7 +307,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, IconWindows, out large, out small); newList.Images.Add(large); @@ -360,7 +360,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, IconTasks, out large, out small); newList.Images.Add(large); @@ -421,7 +421,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, 15, out large, out small); newList.Images.Add(large); @@ -469,7 +469,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, IconAudio, out large, out small); newList.Images.Add(large); @@ -508,7 +508,7 @@ Icon small; string folder = Environment.GetFolderPath(Environment.SpecialFolder.System); - string file = folder + "\\shell32.dll"; + string file = Path.Combine(folder, "shell32.dll"); Win32.ExtractIcons(file, IconEject, out large, out small); newList.Images.Add(large); Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -112,7 +112,8 @@ { try { - string[] skins = Directory.GetFiles(Program.InstallFolder + "\\Skins\\", "*.png", SearchOption.TopDirectoryOnly); + string path = Path.Combine(Program.InstallFolder, "Skins"); + string[] skins = Directory.GetFiles(path, "*.png", SearchOption.TopDirectoryOnly); for (int index = 0; index < skins.Length; index++) skins[index] = Path.GetFileNameWithoutExtension(skins[index]); @@ -205,7 +206,8 @@ { try { - Help.ShowHelp(this, SystemRegistry.GetInstallFolder() + "\\IR Server Suite.chm", HelpNavigator.Topic, "Virtual Remote\\index.html"); + string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm"); + Help.ShowHelp(this, file, HelpNavigator.Topic, "Virtual Remote\\index.html"); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -135,7 +135,8 @@ { try { - Help.ShowHelp(this, SystemRegistry.GetInstallFolder() + "\\IR Server Suite.chm", HelpNavigator.Topic, "Virtual Remote\\Skin Editor\\index.html"); + string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm"); + Help.ShowHelp(this, file, HelpNavigator.Topic, "Virtual Remote\\Skin Editor\\index.html"); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Web Remote/Setup.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Web Remote/Setup.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Applications/Web Remote/Setup.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -102,7 +102,8 @@ { try { - string[] skins = Directory.GetFiles(Program.InstallFolder + "\\Skins\\", "*.png", SearchOption.TopDirectoryOnly); + string path = Path.Combine(Program.InstallFolder, "Skins"); + string[] skins = Directory.GetFiles(path, "*.png", SearchOption.TopDirectoryOnly); for (int index = 0; index < skins.Length; index++) skins[index] = Path.GetFileNameWithoutExtension(skins[index]); Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -897,7 +897,8 @@ if (String.IsNullOrEmpty(installFolder)) return null; - string[] files = Directory.GetFiles(installFolder + "\\Commands\\", "*.dll", SearchOption.TopDirectoryOnly); + string folder = Path.Combine(installFolder, "Commands"); + string[] files = Directory.GetFiles(folder, "*.dll", SearchOption.TopDirectoryOnly); foreach (string file in files) { Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/IrssLog.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/IrssLog.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/IrssLog.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -116,9 +116,17 @@ string message = String.Format("{0:yyyy-MM-dd HH:mm:ss.ffffff} - Log Opened", DateTime.Now); _streamWriter.WriteLine(message); + #if TRACE Trace.WriteLine(message); #endif + + message = String.Format("{0:yyyy-MM-dd HH:mm:ss.ffffff} - {1}", DateTime.Now, System.Reflection.Assembly.GetCallingAssembly().FullName); + _streamWriter.WriteLine(message); + +#if TRACE + Trace.WriteLine(message); +#endif } #if TRACE catch (Exception ex) Modified: trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Text; using MediaPortal.Configuration; @@ -22,17 +23,17 @@ /// <summary> /// Folder for Custom Input Device data files. /// </summary> - public static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice) + "\\"; + public static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice) + Path.DirectorySeparatorChar; /// <summary> /// Folder for Input Device data default files. /// </summary> - public static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault) + "\\"; + public static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault) + Path.DirectorySeparatorChar; /// <summary> /// Path to the MediaPortal configuration file. /// </summary> - public static readonly string MPConfigFile = Config.GetFolder(Config.Dir.Config) + "\\MediaPortal.xml"; + public static readonly string MPConfigFile = Path.Combine(Config.GetFolder(Config.Dir.Config), "MediaPortal.xml"); #endregion Paths Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Ads Tech PTV-335 Receiver/Ads Tech PTV-335 Receiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Ads Tech PTV-335 Receiver/Ads Tech PTV-335 Receiver.csproj 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Ads Tech PTV-335 Receiver/Ads Tech PTV-335 Receiver.csproj 2008-02-26 14:53:36 UTC (rev 1397) @@ -21,7 +21,7 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <DocumentationFile>bin\Debug\Ads Tech PTV-335 Receiver.XML</DocumentationFile> + <DocumentationFile>bin\Debug\Ads Tech PTV-335 Receiver.xml</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.csproj 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.csproj 2008-02-26 14:53:36 UTC (rev 1397) @@ -24,7 +24,7 @@ <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <UseVSHostingProcess>false</UseVSHostingProcess> - <DocumentationFile>bin\Debug\Custom HID Receiver.XML</DocumentationFile> + <DocumentationFile>bin\Debug\Custom HID Receiver.xml</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>none</DebugType> Property changes on: trunk/plugins/IR Server Suite/IR Server Plugins/IR501 Receiver ___________________________________________________________________ Name: svn:ignore + bin obj Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IR501 Receiver/IR501Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IR501 Receiver/IR501Receiver.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IR501 Receiver/IR501Receiver.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -141,10 +141,10 @@ #region Constants - const int DeviceBufferSize = 4; + const int DeviceBufferSize = 255; const string DeviceID = "vid_147a&pid_e001"; - + #endregion Constants #region Variables @@ -217,7 +217,7 @@ if (String.IsNullOrEmpty(devicePath)) throw new ApplicationException("Device not found"); - SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); + SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); int lastError = Marshal.GetLastWin32Error(); if (deviceHandle.IsInvalid) @@ -348,7 +348,7 @@ { try { - if (_deviceStream.EndRead(asyncResult) == DeviceBufferSize && _deviceBuffer[1] == 0) + if (_deviceStream.EndRead(asyncResult) == 4 && _deviceBuffer[1] == 0) { TimeSpan timeSpan = DateTime.Now - _lastCodeTime; Property changes on: trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver ___________________________________________________________________ Name: svn:ignore + bin obj Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507 Receiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507 Receiver.csproj 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507 Receiver.csproj 2008-02-26 14:53:36 UTC (rev 1397) @@ -10,6 +10,8 @@ <RootNamespace>InputService.Plugin</RootNamespace> <AssemblyName>IR507 Receiver</AssemblyName> <ApplicationIcon>Icon.ico</ApplicationIcon> + <StartupObject> + </StartupObject> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -42,7 +44,7 @@ <ProjectReference Include="..\IR Server Plugin Interface\IR Server Plugin Interface.csproj"> <Project>{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}</Project> <Name>IR Server Plugin Interface</Name> - <Private>False</Private> + <Private>True</Private> </ProjectReference> </ItemGroup> <ItemGroup> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -141,9 +141,10 @@ #region Constants - const int DeviceBufferSize = 4; + const int DeviceBufferSize = 255; - const string DeviceID = "vid_0e6a&pid_6002"; + //const string DeviceID = "vid_0e6a&pid_6002"; + const string DeviceID = "vid_147a&pid_e02a"; #endregion Constants @@ -217,9 +218,13 @@ if (String.IsNullOrEmpty(devicePath)) throw new ApplicationException("Device not found"); - SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); + //Console.WriteLine("Opening device: {0}", devicePath); + + SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); int lastError = Marshal.GetLastWin32Error(); + //Console.WriteLine("Last Error: {0}", lastError); + if (deviceHandle.IsInvalid) throw new Win32Exception(lastError, "Failed to open device"); @@ -348,7 +353,10 @@ { try { - if (_deviceStream.EndRead(asyncResult) == DeviceBufferSize && _deviceBuffer[1] == 0) + //int read = _deviceStream.EndRead(asyncResult); + //Console.WriteLine(BitConverter.ToString(_deviceBuffer, 0, read)); + + if (_deviceStream.EndRead(asyncResult) == 4 && _deviceBuffer[1] == 0) { TimeSpan timeSpan = DateTime.Now - _lastCodeTime; @@ -374,6 +382,31 @@ #endregion Implementation + #region Debug + + [STAThread] + static void Main() + { + try + { + IR507Receiver c = new IR507Receiver(); + c.Start(); + + while (Console.ReadKey().Key != ConsoleKey.Escape) + { + Console.WriteLine("Press escape to quit"); + } + + c.Stop(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + } + + #endregion Debug + } } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDrive Receiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDrive Receiver.csproj 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDrive Receiver.csproj 2008-02-26 14:53:36 UTC (rev 1397) @@ -7,7 +7,7 @@ <ProjectGuid>{ABA2DAF3-B4CF-42BF-8686-DD662B0D6406}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>LiveDriveReceiver</RootNamespace> + <RootNamespace>InputService.Plugin</RootNamespace> <AssemblyName>LiveDrive Receiver</AssemblyName> <ApplicationIcon>Icon.ico</ApplicationIcon> </PropertyGroup> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; +using System.ServiceProcess; using System.Text; using System.Windows.Forms; @@ -52,6 +53,11 @@ get { return Decimal.ToInt32(numericUpDownButtonHeldDelay.Value); } set { numericUpDownButtonHeldDelay.Value = new Decimal(value); } } + public bool DisableAutomaticButtons + { + get { return checkBoxDisableAutomaticButtons.Checked; } + set { checkBoxDisableAutomaticButtons.Checked = value; } + } public bool EnableKeyboard { @@ -115,27 +121,39 @@ private void buttonOK_Click(object sender, EventArgs e) { - if (checkBoxDisableAutomaticButtons.Checked) + bool changeMade = false; + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(RegistrySubKey, true)) { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(RegistrySubKey, true)) + bool keysExist = (key.GetValue("CodeSetNum0", null) != null); + + if (checkBoxDisableAutomaticButtons.Checked && keysExist) { key.DeleteValue("CodeSetNum0", false); key.DeleteValue("CodeSetNum1", false); key.DeleteValue("CodeSetNum2", false); key.DeleteValue("CodeSetNum3", false); + + changeMade = true; } - } - else - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(RegistrySubKey, true)) + else if (!checkBoxDisableAutomaticButtons.Checked && !keysExist) { key.SetValue("CodeSetNum0", 1, RegistryValueKind.DWord); key.SetValue("CodeSetNum1", 2, RegistryValueKind.DWord); key.SetValue("CodeSetNum2", 3, RegistryValueKind.DWord); key.SetValue("CodeSetNum3", 4, RegistryValueKind.DWord); + + changeMade = true; } } + if (changeMade) + { + RestartService("blah"); // HidServ? + + MessageBox.Show(this, "You must restart for changes to automatic button handling to take effect", "Restart required", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + this.DialogResult = DialogResult.OK; this.Close(); } @@ -156,6 +174,39 @@ groupBoxKeypressTiming.Enabled = !checkBoxUseSystemRatesKeyboard.Checked; } + + static void RestartService(string serviceName) + { + try + { + ServiceController[] services = ServiceController.GetServices(); + foreach (ServiceController service in services) + { + System.Diagnostics.Trace.WriteLine(service.ServiceName); + + if (service.ServiceName.Equals(serviceName, StringComparison.OrdinalIgnoreCase)) + { + if (service.Status != ServiceControllerStatus.Stopped) + { + service.Stop(); + service.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 30)); + } + + service.Start(); + } + } + } + catch (System.ComponentModel.Win32Exception ex) + { + MessageBox.Show(ex.Message, "Error restarting service", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch (System.ServiceProcess.TimeoutException ex) + { + MessageBox.Show(ex.Message, "Error stopping service", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + } } 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 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -371,7 +371,16 @@ SetCarrierFrequency(code.Carrier); // Send packet - WriteSync(DataPacket(code)); + byte[] data = DataPacket(code); + + // If the code would go longer than the allowable limit, truncate the code + if (data.Length > 341) // 340 minus the overhead of 1 byte in 4 for header is 255 bytes of actual time code data, add one for a terminator byte + { + Array.Resize<byte>(ref data, 341); // Shrink the array to fit + data[340] = 0x80; // Set the terminator byte + } + + WriteSync(data); } #endregion Driver overrides @@ -939,7 +948,7 @@ void WriteSync(byte[] data) { #if DEBUG - DebugWriteLine("WriteSync()"); + DebugWriteLine("WriteSync({0} bytes)", data.Length); DebugDump(data); #endif @@ -1104,19 +1113,19 @@ /// This is used to determine the carrier frequency. /// </summary> /// <param name="code">The IrCode to analyse.</param> - /// <param name="onTime">The total ammount of pulse time.</param> - /// <param name="onCount">The total count of pulses.</param> - static void GetIrCodeLengths(IrCode code, out int onTime, out int onCount) + /// <param name="pulseTime">The total ammount of pulse time.</param> + /// <param name="pulseCount">The total count of pulses.</param> + static void GetIrCodeLengths(IrCode code, out int pulseTime, out int pulseCount) { - onTime = 0; - onCount = 0; + pulseTime = 0; + pulseCount = 0; foreach (int time in code.TimingData) { if (time > 0) { - onTime += time; - onCount++; + pulseTime += time; + pulseCount++; } } } 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 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -455,6 +455,10 @@ void TransmitIR(byte[] irData, int carrier, int transmitPortMask) { +#if DEBUG + DebugWriteLine("TransmitIR({0} bytes, carrier: {1}, port: {2})", irData.Length, carrier, transmitPortMask); +#endif + if (!_deviceAvailable) throw new ApplicationException("Device not available"); 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 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -13,7 +13,7 @@ { /// <summary> - /// Driver class for Windows XP eHome driver. + /// Driver class for the Windows XP eHome driver. /// </summary> class DriverXP : Driver { @@ -370,7 +370,41 @@ SetCarrierFrequency(code.Carrier); // Send packet - WriteSync(DataPacket(code)); + byte[] data = DataPacket(code); + + /* + if (data.Length > 100) + data = new byte[] { 0x84, 0x8A, 0x30, 0x8A, 0x13, 0x84, 0x94, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x30, 0x8A, 0x13, 0x84, 0x94, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, + 0x84, 0x8A, 0x30, 0x8A, 0x13, 0x84, 0x94, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x09, 0x8B, 0x09, 0x84, 0x8A, 0x7F, 0x17, 0x8A, 0x84, 0x30, 0x8A, 0x13, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x8A, 0x84, 0x09, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x95, 0x84, 0x13, 0x94, 0x13, 0x94, 0x84, 0x09, 0x8A, 0x13, 0x8B, 0x84, 0x30, 0x8A, 0x30, 0x8A, 0x84, 0x13, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x8A, 0x84, 0x0A, 0x8A, 0x09, 0x8A, 0x84, 0x0A, 0x8A, 0x09, 0x8A, 0x84, 0x09, 0x95, 0x13, 0x94, 0x84, 0x13, 0x94, 0x09, 0x8A, 0x84, 0x13, 0x8B, 0x30, 0x8A, 0x84, 0x30, 0x8A, 0x13, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x94, 0x84, 0x13, 0x94, 0x13, 0x94, 0x84, 0x09, 0x8A, 0x13, 0x8B, 0x84, 0x30, 0x8A, 0x30, 0x8A, 0x84, 0x13, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x8A, 0x84, 0x0A, 0x8A, 0x09, 0x8A, 0x84, 0x0A, 0x94, 0x13, 0x94, 0x84, 0x13, 0x94, 0x09, 0x8B, 0x84, 0x12, 0x8B, 0x30, 0x8A, 0x84, 0x30, 0x8A, 0x13, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x94, 0x84, 0x13, 0x94, 0x13, 0x94, 0x84, 0x09, 0x8B, 0x12, 0x8B, 0x84, 0x30, 0x8A, 0x30, 0x8A, 0x84, 0x13, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x8B, 0x84, 0x09, 0x8A, 0x09, 0x8A, 0x84, 0x0A, 0x94, 0x13, 0x94, 0x84, 0x13, 0x94, 0x09, 0x8B, 0x84, 0x12, 0x8B, 0x30, 0x8A, 0x84, 0x30, 0x8A, 0x13, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8B, 0x09, 0x8A, 0x84, 0x09, 0x8A, 0x0A, 0x94, 0x84, 0x13, 0x94, 0x13, 0x94, 0x84, 0x09, 0x8B, 0x12, 0x8B, + 0x83, 0x30, 0x8A, 0x13, 0x80 }; + */ + + //data = new byte[259]; + //for (int index = 0; index < data.Length; index++) + //data[index] = (byte)(index % 256); + + /* + while (data.Length > 255) // use 255 to catch the "0x8x" segment boundaries + { + byte[] segment = new byte[255]; + Array.Copy(data, segment, segment.Length); + + WriteSync(segment); + + byte[] newData = new byte[data.Length - 255]; + Array.Copy(data, 255, newData, 0, newData.Length); + data = newData; + } + */ + + // If the code would go longer than the allowable limit, truncate the code + if (data.Length > 341) // 340 minus the overhead of 1 byte in 4 for header is 255 bytes of actual time code data, add one for a terminator byte + { + Array.Resize<byte>(ref data, 341); // Shrink the array to fit + data[340] = 0x80; // Set the terminator byte + } + + WriteSync(data); } #endregion Driver overrides @@ -634,8 +668,10 @@ return; } + int lastError; + _eHomeHandle = CreateFile(_devicePath, CreateFileAccessTypes.GenericRead | CreateFileAccessTypes.GenericWrite, CreateFileShares.None, IntPtr.Zero, CreateFileDisposition.OpenExisting, CreateFileAttributes.Overlapped, IntPtr.Zero); - int lastError = Marshal.GetLastWin32Error(); + lastError = Marshal.GetLastWin32Error(); if (_eHomeHandle.IsInvalid) { _eHomeHandle = null; @@ -915,7 +951,7 @@ void WriteSync(byte[] data) { #if DEBUG - DebugWriteLine("WriteSync()"); + DebugWriteLine("WriteSync({0} bytes)", data.Length); DebugDump(data); #endif @@ -1080,19 +1116,19 @@ /// This is used to determine the carrier frequency. /// </summary> /// <param name="code">The IrCode to analyse.</param> - /// <param name="onTime">The total ammount of pulse time.</param> - /// <param name="onCount">The total count of pulses.</param> - static void GetIrCodeLengths(IrCode code, out int onTime, out int onCount) + /// <param name="pulseTime">The total ammount of pulse time.</param> + /// <param name="pulseCount">The total count of pulses.</param> + static void GetIrCodeLengths(IrCode code, out int pulseTime, out int pulseCount) { - onTime = 0; - onCount = 0; + pulseTime = 0; + pulseCount = 0; foreach (int time in code.TimingData) { if (time > 0) { - onTime += time; - onCount++; + pulseTime += time; + pulseCount++; } } } 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 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -30,9 +30,9 @@ public const int CarrierFrequencyDefault = 36000; /// <summary> - /// How long the longest IR Code space should be (microseconds). + /// How long the longest IR Code space should be (in microseconds). /// </summary> - const int LongestSpace = -100000; + const int LongestSpace = -75000; #endregion Constants @@ -89,8 +89,8 @@ if (_timingData.Length == 0) return false; + // Find long spaces and trim the IR code ... List<int> newData = new List<int>(); - foreach (int time in _timingData) { if (time <= LongestSpace) @@ -152,34 +152,18 @@ /// <summary> /// Creates a byte array representation of this IR Code. /// </summary> - /// <param name="asPronto">Set this parameter true to convert the IR Code into Pronto format.</param> - /// <returns>Byte array representation.</returns> - public byte[] ToByteArray(bool asPronto) + /// <returns>Byte array representation (internally it is in Pronto format).</returns> + public byte[] ToByteArray() { StringBuilder output = new StringBuilder(); - if (asPronto) - { - ushort[] prontoData = Pronto.ConvertIrCodeToProntoRaw(this); + ushort[] prontoData = Pronto.ConvertIrCodeToProntoRaw(this); - for (int index = 0; index < prontoData.Length; index++) - { - output.Append(prontoData[index].ToString("X4")); - if (index != prontoData.Length - 1) - output.Append(' '); - } - } - else // Native format (only benefit is a slightly more accurate Carrier Frequency) + for (int index = 0; index < prontoData.Length; index++) { - output.Append("MCE,"); - output.AppendFormat("{0},", _carrier); - - for (int index = 0; index < _timingData.Length; index++) - { - output.Append(_timingData[index]); - if (index != _timingData.Length - 1) - output.Append(','); - } + output.Append(prontoData[index].ToString("X4")); + if (index != prontoData.Length - 1) + output.Append(' '); } return Encoding.ASCII.GetBytes(output.ToString()); @@ -219,37 +203,30 @@ if (len != 0) timingData.Add(len * 50); - // Seems some old files have excessively long delays in them .. this might fix that problem ... IrCode newCode = new IrCode(timingData.ToArray()); - newCode.FinalizeData(); + newCode.FinalizeData(); // Seems some old files have excessively long delays in them .. this might fix that problem ... return newCode; } /// <summary> - /// Create an IrCode object from Native file bytes. + /// Creates an IrCode object from Pronto format file bytes. /// </summary> /// <param name="data">IR file bytes.</param> /// <returns>New IrCode object.</returns> - static IrCode FromNativeData(string data) + static IrCode FromProntoData(byte[] data) { - if (String.IsNullOrEmpty(data)) - throw new ArgumentNullException("data"); + string code = Encoding.ASCII.GetString(data); - string[] elements = data.Split(new char[] { ',' }); + string[] stringData = code.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - if (elements.Length < 3) - throw new ApplicationException("Invalid native IR file data"); + ushort[] prontoData = new ushort[stringData.Length]; + for (int i = 0; i < stringData.Length; i++) + prontoData[i] = ushort.Parse(stringData[i], System.Globalization.NumberStyles.HexNumber); - IrCode newCode = new IrCode(); - newCode.Carrier = int.Parse(elements[1]); + IrCode newCode = Pronto.ConvertProntoDataToIrCode(prontoData); + newCode.FinalizeData(); // Seems some old files have excessively long delays in them .. this might fix that problem ... - int[] timingData = new int[elements.Length - 2]; - for (int index = 2; index < elements.Length; index++) - timingData[index - 2] = int.Parse(elements[index]); - - newCode.TimingData = timingData; - return newCode; } @@ -261,27 +238,9 @@ public static IrCode FromByteArray(byte[] data) { if (data[4] == ' ') - { - string code = Encoding.ASCII.GetString(data); - - string[] stringData = code.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - - ushort[] prontoData = new ushort[stringData.Length]; - for (int i = 0; i < stringData.Length; i++) - prontoData[i] = ushort.Parse(stringData[i], System.Globalization.NumberStyles.HexNumber); - - return Pronto.ConvertProntoDataToIrCode(prontoData); - } - else if (data[0] == 'M' && data[1] == 'C' && data[2] == 'E') - { - string code = Encoding.ASCII.GetString(data); - - return FromNativeData(code); - } + return FromProntoData(data); else - { return FromOldData(data); - } } #endregion Static Methods Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj 2008-02-26 14:53:36 UTC (rev 1397) @@ -5,12 +5,13 @@ <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BABC30EB-7D0F-4398-9FCB-E517EA8D2AA9}</ProjectGuid> - <OutputType>Exe</OutputType> + <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>MicrosoftMceTransceiver</RootNamespace> + <RootNamespace>InputService.Plugin</RootNamespace> <AssemblyName>Microsoft MCE Transceiver</AssemblyName> <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> - <StartupObject>InputService.Plugin.MicrosoftMceTransceiver</StartupObject> + <StartupObject> + </StartupObject> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>false</DebugSymbols> 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 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -111,13 +111,15 @@ } IrCode code = IrCode.FromByteArray(fileBytes); + //code.Carrier = 37010; + //code.TimingData = new int[] { +150, -5950, +450, -1300, +450, -400, +500, -1250, +450, -450, +450, -400, +450, -450, +450, -400, +450, -450, +450, -400, +450, -450, +450, -400, +450, -450, +450, -400, +500, -400, +450, -400, +500, -400, +450, -1300, +450, -400, +450, -450, +450, -400, +450, -450, +450, -400, +450, -450, +450, -400, +450, -450, +450, -400, +500, -1250, +450, -10250, +3450, -1750, +450, -400, +500, -1250, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -1300, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -1250, +500, -400, +450, -1250, +500, -400, +500, -350, +500, -400, +500, -350, +500, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -1250, +500, -350, +500, -400, +500, -350, +500, -400, +500, -400, +450, -400, +500, -400, +450, -400, +500, -400, +450, -1250, +500, -10400 }; Dump(code.TimingData); Console.WriteLine("Press any key to begin ..."); Console.ReadKey(); - int length = 750000; + int length = 1725000; //for (int length = 700000; length < 5000000; length += 50000) while (true) { @@ -126,6 +128,7 @@ List<int> newCode = new List<int>(); int total = 0; + int pulseTotal = 0; for (int index = 0; index < code.TimingData.Length; index++) { int time = code.TimingData[index]; @@ -144,14 +147,17 @@ newCode.Add(time); total += Math.Abs(time); + if (time > 0) + pulseTotal += time; } Console.WriteLine("Blasting with actual total time of {0}us ...", total); + Console.WriteLine("Blasting with total pulse time of {0}us ...", pulseTotal); IrCode test = new IrCode(code.Carrier, newCode.ToArray()); Dump(test.TimingData); - c.Transmit("Both", test.ToByteArray(true)); + c.Transmit("Both", test.ToByteArray()); Console.WriteLine("Blast complete, press any key to contiue ..."); if (Console.ReadKey().Key == ConsoleKey.Escape) @@ -192,6 +198,7 @@ bool _useSystemRatesRemote = false; int _remoteFirstRepeat = 400; int _remoteHeldRepeats = 250; + bool _disableAutomaticButtons = false; bool _enableKeyboardInput = false; bool _useSystemRatesKeyboard = true; @@ -204,7 +211,6 @@ double _mouseSensitivity = 1.0d; // Hidden options ... - bool _storeAsPronto = true; bool _forceVistaDriver = false; #endregion Configuration @@ -376,6 +382,7 @@ config.UseSystemRatesForRemote = _useSystemRatesRemote; config.RemoteRepeatDelay = _remoteFirstRepeat; config.RemoteHeldDelay = _remoteHeldRepeats; + config.DisableAutomaticButtons = _disableAutomaticButtons; config.EnableKeyboard = _enableKeyboardInput; config.UseSystemRatesForKeyboard = _useSystemRatesKeyboard; @@ -396,6 +403,7 @@ _useSystemRatesRemote = config.UseSystemRatesForRemote; _remoteFirstRepeat = config.RemoteRepeatDelay; _remoteHeldRepeats = config.RemoteHeldDelay; + _disableAutomaticButtons = config.DisableAutomaticButtons; _enableKeyboardInput = config.EnableKeyboard; _useSystemRatesKeyboard = config.UseSystemRatesForKeyboard; @@ -466,8 +474,6 @@ if (code == null) throw new ArgumentException("Invalid IR Command data", "data"); - //code.Finalize(); - _driver.Send(code, (int)blasterPort); return true; @@ -486,7 +492,7 @@ LearnStatus status = _driver.Learn(_learnTimeout, out code); if (code != null) - data = code.ToByteArray(_storeAsPronto); + data = code.ToByteArray(); else data = null; @@ -507,6 +513,7 @@ try { _useSystemRatesRemote = bool.Parse(doc.DocumentElement.Attributes["UseSystemRatesRemote"].Value); } catch { } try { _remoteFirstRepeat = int.Parse(doc.DocumentElement.Attributes["RemoteFirstRepeat"].Value); } catch {} try { _remoteHeldRepeats = int.Parse(doc.DocumentElement.Attributes["RemoteHeldRepeats"].Value); } catch {} + try { _disableAutomaticButtons = bool.Parse(doc.DocumentElement.Attributes["DisableAutomaticButtons"].Value); } catch {} try { _enableKeyboardInput = bool.Parse(doc.DocumentElement.Attributes["EnableKeyboardInput"].Value); } catch {} try { _useSystemRatesKeyboard = bool.Parse(doc.DocumentElement.Attributes["UseSystemRatesKeyboard"].Value); } catch { } @@ -519,10 +526,7 @@ try { _mouseSensitivity = double.Parse(doc.DocumentElement.Attributes["MouseSensitivity"].Value); } catch {} // Hidden options ... - try { _storeAsPronto = bool.Parse(doc.DocumentElement.Attributes["StoreAsPronto"].Value); } catch {} try { _forceVistaDriver = bool.Parse(doc.DocumentElement.Attributes["ForceVistaDriver"].Value); } catch {} - - } void SaveSettings() { @@ -543,6 +547,7 @@ writer.WriteAttributeString("UseSystemRatesRemote", _useSystemRatesRemote.ToString()); writer.WriteAttributeString("RemoteFirstRepeat", _remoteFirstRepeat.ToString()); writer.WriteAttributeString("RemoteHeldRepeats", _remoteHeldRepeats.ToString()); + writer.WriteAttributeString("DisableAutomaticButtons", _disableAutomaticButtons.ToString()); writer.WriteAttributeString("EnableKeyboardInput", _enableKeyboardInput.ToString()); writer.WriteAttributeString("UseSystemRatesKeyboard", _useSystemRatesKeyboard.ToString()); @@ -555,7 +560,6 @@ writer.WriteAttributeString("MouseSensitivity", _mouseSensitivity.ToString()); // Hidden options ... - writer.WriteAttributeString("StoreAsPronto", _storeAsPronto.ToString()); writer.WriteAttributeString("ForceVistaDriver", _forceVistaDriver.ToString()); writer.WriteEndElement(); // </settings> @@ -694,8 +698,8 @@ int heldRepeats = _remoteHeldRepeats; if (_useSystemRatesRemote) { - firstRepeat = SystemInformation.KeyboardDelay; - heldRepeats = SystemInformation.KeyboardSpeed; + firstRepeat = 250 + (SystemInformation.KeyboardDelay * 250); + heldRepeats = (int)(1000.0 / (2.5 + (SystemInformation.KeyboardSpeed * 0.888))); } if (!_remoteButtonRepeated && timeBetween.TotalMilliseconds < firstRepeat) @@ -800,8 +804,8 @@ int heldRepeats = _keyboardHeldRepeats; if (_useSystemRatesRemote) { - firstRepeat = SystemInformation.KeyboardDelay; - heldRepeats = SystemInformation.KeyboardSpeed; + firstRepeat = 250 + (SystemInformation.KeyboardDelay * 250); + heldRepeats = (int)(1000.0 / (2.5 + (SystemInformation.KeyboardSpeed * 0.888))); } if (!_keyboardKeyRepeated && timeBetween.TotalMilliseconds < firstRepeat) @@ -896,6 +900,7 @@ _mouseHandler(deltaX, deltaY, (int)buttons); } + // TODO: Convert this function to a lookup from an XML file, then provide multiple files and a way to fine-tune... static Keyboard.VKey ConvertMceKeyCodeToVKey(uint keyCode) { switch (keyCode) 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 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -99,6 +99,11 @@ } */ + /// <summary> + /// Converts an IR Code represented in Pronto data to an IrCode object. + /// </summary> + /// <param name="prontoData">The Pronto data to convert.</param> + /// <returns>IrCode object of interpretted Pronto data.</returns> public static IrCode ConvertProntoDataToIrCode(ushort[] prontoData) { if (prontoData == null || prontoData.Length == 0) @@ -532,6 +537,24 @@ return new IrCode(ConvertFromProntoCarrier(prontoCarrier), timingData.ToArray()); } + /* + public static ushort[] ConvertIrCodeToPronto(IrCode irCode) + { + CodeType codeType; + Int64 value; + + if (Decode(irCode, out codeType, out value)) + return EncodePronto(codeType, value); + else + return null; + } + */ + + /// <summary> + /// Converts the ir code into Pronto raw format. + /// </summary> + /// <param name="irCode">The ir code to convert.</param> + /// <returns>Pronto data (raw format).</returns> public static ushort[] ConvertIrCodeToProntoRaw(IrCode irCode) { List<ushort> prontoData = new List<ushort>(); @@ -582,11 +605,21 @@ return prontoData.ToArray(); } + /// <summary> + /// Converts from a Pronto format carrier frequency to an integer format. + /// </summary> + /// <param name="prontoCarrier">The Pronto format carrier.</param> + /// <returns>The carrier frequency as an integer number.</returns> public static int ConvertFromProntoCarrier(ushort prontoCarrier) { return (int)(1000000 / (prontoCarrier * ProntoClock)); } + /// <summary> + /// Converts from an integer number carrier frequency to a Pronto carrier format. + /// </summary> + /// <param name="carrierFrequency">The integer carrier frequency.</param> + /// <returns>The carrier frequency in Pronto format.</returns> public static ushort ConvertToProntoCarrier(int carrierFrequency) { return (ushort)(1000000 / (carrierFrequency * ProntoClock)); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/RC102 Receiver/RC102Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/RC102 Receiver/RC102Receiver.cs 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Plugins/RC102 Receiver/RC102Receiver.cs 2008-02-26 14:53:36 UTC (rev 1397) @@ -145,8 +145,9 @@ const string DeviceID = "vid_147a&pid_e019"; //const string DeviceID = "vid_147a&pid_e001"; // 501 - //const string DeviceID = "vid_0e6a&pid_6002"; // 507 - + //const string DeviceID = "vid_147a&pid_e02a"; // 507 + //const string DeviceID = "vid_0e6a&pid_6002"; // 507?? + #endregion Constants #region Variables @@ -219,7 +220,7 @@ if (String.IsNullOrEmpty(devicePath)) throw new ApplicationException("Device not found"); - SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); + SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); int lastError = Marshal.GetLastWin32Error(); if (deviceHandle.IsInvalid) Modified: trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi 2008-02-25 11:27:01 UTC (rev 1396) +++ trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi 2008-02-26 14:53:36 UTC (rev 1397) @@ -296,27 +296,29 @@ SetOutPath "$DIR_INSTALL\IR Server Plugins" SetOverwrite ifnewer - File "IR Server Plugins\Ads Tech PTV-335 Receiver\bin\Debug\*.*" - File "IR Server Plugins\Custom HID Receiver\bin\Debug\*.*" - ;File "IR Server Plugins\Direct Input Receiver\bin\Debug\*.*" - File "IR Server Plugins\FusionRemote Receiver\bin\Debug\*.*" - File "IR Server Plugins\Girder Plugin\bin\Debug\*.*" - File "IR Server Plugins\HCW Receiver\bin\Debug\*.*" - File "IR Server Plugins\IgorPlug Receiver\bin\Debug\*.*" - File "IR Server Plugins\IRMan Receiver\bin\Debug\*.*" - File "IR Server Plugins\IRTrans Transceiver\bin\Debug\*.*" - File "IR Server Plugins\Keyboard Input\... [truncated message content] |