From: <an...@us...> - 2007-08-15 14:22:33
|
Revision: 840 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=840&view=rev Author: and-81 Date: 2007-08-15 07:22:31 -0700 (Wed, 15 Aug 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/ExternalProgram.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Keyboard.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Mouse.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs trunk/plugins/IR Server Suite/IPC/AppModule.NamedPipes/APipeConnection.cs trunk/plugins/IR Server Suite/IR Server Plugins/FusionRemote Receiver/FusionRemoteReceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IRServerPluginInterface.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/MceDetectionData.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceIrCode.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Mouse.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs trunk/plugins/IR Server Suite/IR Server Plugins/XBCDRC Receiver/XBCDRC Receiver.cs trunk/plugins/IR Server Suite/IR Server Suite.sln Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -41,11 +41,10 @@ [STAThread] static void Main(string[] args) { + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "IR Blast.log"); - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); - ShowHeader(); try Modified: trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -42,11 +42,10 @@ [STAThread] static void Main(string[] args) { + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "IR Blast (No Window).log"); - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); - try { Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -40,8 +40,6 @@ // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "IR Server.log"); - - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -210,7 +210,7 @@ this.groupBoxButton.Controls.Add(this.textBoxButtonDesc); this.groupBoxButton.Location = new System.Drawing.Point(8, 8); this.groupBoxButton.Name = "groupBoxButton"; - this.groupBoxButton.Size = new System.Drawing.Size(456, 80); + this.groupBoxButton.Size = new System.Drawing.Size(464, 80); this.groupBoxButton.TabIndex = 0; this.groupBoxButton.TabStop = false; this.groupBoxButton.Text = "Button"; @@ -241,7 +241,7 @@ this.textBoxKeyCode.Location = new System.Drawing.Point(88, 16); this.textBoxKeyCode.Name = "textBoxKeyCode"; this.textBoxKeyCode.ReadOnly = true; - this.textBoxKeyCode.Size = new System.Drawing.Size(360, 20); + this.textBoxKeyCode.Size = new System.Drawing.Size(368, 20); this.textBoxKeyCode.TabIndex = 1; this.textBoxKeyCode.TabStop = false; this.textBoxKeyCode.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; @@ -253,7 +253,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.textBoxButtonDesc.Location = new System.Drawing.Point(88, 48); this.textBoxButtonDesc.Name = "textBoxButtonDesc"; - this.textBoxButtonDesc.Size = new System.Drawing.Size(360, 20); + this.textBoxButtonDesc.Size = new System.Drawing.Size(368, 20); this.textBoxButtonDesc.TabIndex = 3; this.toolTips.SetToolTip(this.textBoxButtonDesc, "Provide a description of this button here"); this.textBoxButtonDesc.TextChanged += new System.EventHandler(this.textBoxButtonDesc_TextChanged); @@ -269,7 +269,7 @@ this.groupBoxSet.Controls.Add(this.buttonTest); this.groupBoxSet.Location = new System.Drawing.Point(8, 96); this.groupBoxSet.Name = "groupBoxSet"; - this.groupBoxSet.Size = new System.Drawing.Size(456, 296); + this.groupBoxSet.Size = new System.Drawing.Size(464, 296); this.groupBoxSet.TabIndex = 1; this.groupBoxSet.TabStop = false; this.groupBoxSet.Text = "Command"; @@ -282,7 +282,7 @@ this.textBoxCommand.Location = new System.Drawing.Point(64, 264); this.textBoxCommand.Name = "textBoxCommand"; this.textBoxCommand.ReadOnly = true; - this.textBoxCommand.Size = new System.Drawing.Size(328, 20); + this.textBoxCommand.Size = new System.Drawing.Size(336, 20); this.textBoxCommand.TabIndex = 2; // // buttonSet @@ -313,7 +313,7 @@ this.tabControl.Location = new System.Drawing.Point(8, 24); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(440, 232); + this.tabControl.Size = new System.Drawing.Size(448, 232); this.tabControl.TabIndex = 0; // // tabPageBlastIR @@ -1626,7 +1626,7 @@ this.tabPageMisc.Location = new System.Drawing.Point(4, 22); this.tabPageMisc.Name = "tabPageMisc"; this.tabPageMisc.Padding = new System.Windows.Forms.Padding(3); - this.tabPageMisc.Size = new System.Drawing.Size(432, 206); + this.tabPageMisc.Size = new System.Drawing.Size(440, 206); this.tabPageMisc.TabIndex = 7; this.tabPageMisc.Text = "Misc"; this.tabPageMisc.UseVisualStyleBackColor = true; @@ -1652,7 +1652,7 @@ // buttonTest // this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonTest.Location = new System.Drawing.Point(400, 264); + this.buttonTest.Location = new System.Drawing.Point(408, 264); this.buttonTest.Name = "buttonTest"; this.buttonTest.Size = new System.Drawing.Size(48, 20); this.buttonTest.TabIndex = 3; @@ -1665,7 +1665,7 @@ // this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(408, 400); + this.buttonCancel.Location = new System.Drawing.Point(416, 400); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(56, 24); this.buttonCancel.TabIndex = 3; @@ -1676,7 +1676,7 @@ // buttonOK // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.Location = new System.Drawing.Point(344, 400); + this.buttonOK.Location = new System.Drawing.Point(352, 400); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(56, 24); this.buttonOK.TabIndex = 2; @@ -1690,14 +1690,14 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(472, 433); + this.ClientSize = new System.Drawing.Size(480, 433); this.Controls.Add(this.groupBoxButton); this.Controls.Add(this.groupBoxSet); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOK); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(480, 428); + this.MinimumSize = new System.Drawing.Size(488, 428); this.Name = "ButtonMappingForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -91,9 +91,9 @@ private void ButtonMappingForm_Load(object sender, EventArgs e) { - textBoxKeyCode.Text = _keyCode; - textBoxButtonDesc.Text = _description; - textBoxCommand.Text = _command; + textBoxKeyCode.Text = _keyCode; + textBoxButtonDesc.Text = _description; + textBoxCommand.Text = _command; // Setup IR Blast tab SetupIRList(); @@ -127,6 +127,7 @@ // Setup Misc tab comboBoxMiscCommand.Items.Clear(); + comboBoxMiscCommand.Items.Add(Common.UITextTranslator); comboBoxMiscCommand.Items.Add(Common.UITextEject); comboBoxMiscCommand.Items.Add(Common.UITextStandby); comboBoxMiscCommand.Items.Add(Common.UITextHibernate); @@ -261,11 +262,26 @@ comboBoxMiscCommand.SelectedItem = Common.UITextHibernate; break; + case Common.CmdPrefixReboot: + comboBoxMiscCommand.SelectedItem = Common.UITextReboot; + break; + + case Common.CmdPrefixShutdown: + comboBoxMiscCommand.SelectedItem = Common.UITextShutdown; + break; + + case Common.CmdPrefixStandby: + comboBoxMiscCommand.SelectedItem = Common.UITextStandby; + break; + + case Common.CmdPrefixTranslator: + comboBoxMiscCommand.SelectedItem = Common.UITextTranslator; + break; + default: if (prefix.Equals(Common.CmdPrefixEject, StringComparison.InvariantCultureIgnoreCase)) - { comboBoxMiscCommand.SelectedItem = Common.UITextEject; - } + //else break; } break; @@ -435,10 +451,22 @@ textBoxCommand.Text = _command = Common.CmdPrefixHibernate; break; + case Common.UITextReboot: + textBoxCommand.Text = _command = Common.CmdPrefixReboot; + break; - } + case Common.CmdPrefixShutdown: + textBoxCommand.Text = _command = Common.CmdPrefixShutdown; + break; + case Common.CmdPrefixStandby: + textBoxCommand.Text = _command = Common.CmdPrefixStandby; + break; + case Common.CmdPrefixTranslator: + textBoxCommand.Text = _command = Common.CmdPrefixTranslator; + break; + } break; } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -140,7 +140,7 @@ processWindow = process.MainWindowHandle; if (processWindow != IntPtr.Zero) { - Win32.SetForegroundWindow(processWindow); + Win32.SetForegroundWindow(processWindow, true); break; } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -21,71 +21,6 @@ static class Program { - #region Enumerations - - /// <summary> - /// A list of MCE remote buttons. - /// </summary> - internal enum MceButton - { - Custom = -1, - None = 0, - TV_Power = 0x7b9a, - Blue = 0x7ba1, - Yellow = 0x7ba2, - Green = 0x7ba3, - Red = 0x7ba4, - Teletext = 0x7ba5, - Radio = 0x7baf, - Print = 0x7bb1, - Videos = 0x7bb5, - Pictures = 0x7bb6, - Recorded_TV = 0x7bb7, - Music = 0x7bb8, - TV = 0x7bb9, - Guide = 0x7bd9, - Live_TV = 0x7bda, - DVD_Menu = 0x7bdb, - Back = 0x7bdc, - OK = 0x7bdd, - Right = 0x7bde, - Left = 0x7bdf, - Down = 0x7be0, - Up = 0x7be1, - Star = 0x7be2, - Hash = 0x7be3, - Replay = 0x7be4, - Skip = 0x7be5, - Stop = 0x7be6, - Pause = 0x7be7, - Record = 0x7be8, - Play = 0x7be9, - Rewind = 0x7bea, - Forward = 0x7beb, - Channel_Down = 0x7bec, - Channel_Up = 0x7bed, - Volume_Down = 0x7bee, - Volume_Up = 0x7bef, - Info = 0x7bf0, - Mute = 0x7bf1, - Start = 0x7bf2, - PC_Power = 0x7bf3, - Enter = 0x7bf4, - Escape = 0x7bf5, - Number_9 = 0x7bf6, - Number_8 = 0x7bf7, - Number_7 = 0x7bf8, - Number_6 = 0x7bf9, - Number_5 = 0x7bfa, - Number_4 = 0x7bfb, - Number_3 = 0x7bfc, - Number_2 = 0x7bfd, - Number_1 = 0x7bfe, - Number_0 = 0x7bff, - } - - #endregion Enumerations - #region Constants internal static readonly string ConfigFile = Common.FolderAppData + "Translator\\Translator.xml"; @@ -113,7 +48,6 @@ static TransceiverInfo _transceiverInfo = new TransceiverInfo(); //static Thread _focusWatcher; - static IntPtr _ownWindowHandle = IntPtr.Zero; static IntPtr _currentForegroundWindow = IntPtr.Zero; #endregion Variables @@ -156,38 +90,7 @@ { if (args.Length > 0) { - for (int index = 0; index < args.Length; index++) - { - switch (args[index].ToLowerInvariant()) - { - case "-macro": - SendCopyDataMessage("Translator", Common.CmdPrefixMacro + args[++index]); - continue; - - case "-eject": - SendCopyDataMessage("Translator", Common.CmdPrefixEject + args[++index]); - continue; - - case "-shutdown": - SendCopyDataMessage("Translator", Common.CmdPrefixShutdown); - continue; - - case "-reboot": - SendCopyDataMessage("Translator", Common.CmdPrefixReboot); - continue; - - case "-standby": - SendCopyDataMessage("Translator", Common.CmdPrefixStandby); - continue; - - case "-hibernate": - SendCopyDataMessage("Translator", Common.CmdPrefixHibernate); - continue; - - //TODO: Add more command line options. - } - } - + ProcessCommandLine(args); return; } @@ -202,8 +105,6 @@ IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "Translator.log"); - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); - _config = Configuration.Load(ConfigFile); if (_config == null) _config = new Configuration(); @@ -229,7 +130,6 @@ // Setup main form ... _mainForm = new MainForm(); - _ownWindowHandle = _mainForm.Handle; // Start the window focus watcher thread /* @@ -264,7 +164,11 @@ IrssLog.Close(); } - static void FocusWatcherThread() + #endregion Main + + #region Implementation + + /*static void FocusWatcherThread() { try { @@ -277,7 +181,7 @@ catch { } - } + }*/ static void UpdateForegroundWindow() { @@ -287,20 +191,25 @@ if (hWnd == IntPtr.Zero) return; - + if (hWnd == _mainForm.Handle) - return; -/* - string windowTitle = Win32.GetWindowTitle(hWnd); - if (windowTitle.StartsWith("Translator", StringComparison.InvariantCultureIgnoreCase)) return; - int procID; - Win32.GetWindowThreadProcessId(hWnd, out procID); - Process proc = Process.GetProcessById(procID); - if (proc.MainModule.ModuleName.Equals("Translator.exe", StringComparison.InvariantCultureIgnoreCase)) + if (hWnd == _notifyIcon.ContextMenuStrip.Handle) return; - */ + + /* + string windowTitle = Win32.GetWindowTitle(hWnd); + if (windowTitle.StartsWith("Translator", StringComparison.InvariantCultureIgnoreCase)) + return; + + int procID; + Win32.GetWindowThreadProcessId(hWnd, out procID); + Process proc = Process.GetProcessById(procID); + if (proc.MainModule.ModuleName.Equals("Translator.exe", StringComparison.InvariantCultureIgnoreCase)) + return; + */ + _currentForegroundWindow = hWnd; } catch @@ -308,14 +217,49 @@ } } - #endregion Main + static void ProcessCommandLine(string[] args) + { + for (int index = 0; index < args.Length; index++) + { + switch (args[index].ToLowerInvariant()) + { + case "-macro": + SendCopyDataMessage("Translator", Common.CmdPrefixMacro + args[++index]); + continue; - #region Implementation + case "-eject": + SendCopyDataMessage("Translator", Common.CmdPrefixEject + args[++index]); + continue; + case "-shutdown": + SendCopyDataMessage("Translator", Common.CmdPrefixShutdown); + continue; + + case "-reboot": + SendCopyDataMessage("Translator", Common.CmdPrefixReboot); + continue; + + case "-standby": + SendCopyDataMessage("Translator", Common.CmdPrefixStandby); + continue; + + case "-hibernate": + SendCopyDataMessage("Translator", Common.CmdPrefixHibernate); + continue; + + //TODO: Add more command line options. + } + } + } + static void ShowTranslatorMenu() { UpdateForegroundWindow(); + _notifyIcon.ContextMenuStrip.Show(Screen.PrimaryScreen.Bounds.Width / 4, Screen.PrimaryScreen.Bounds.Height / 4); + + //Win32.SetForegroundWindow(_notifyIcon.ContextMenuStrip.Handle, true); + //_notifyIcon.ContextMenuStrip.Focus(); } @@ -424,15 +368,9 @@ actions.DropDownItems.Add("System Standby", null, new EventHandler(ClickAction)); actions.DropDownItems.Add("System Hibernate", null, new EventHandler(ClickAction)); actions.DropDownItems.Add("System Reboot", null, new EventHandler(ClickAction)); - actions.DropDownItems.Add("System Logoff", null, new EventHandler(ClickAction)); + //actions.DropDownItems.Add("System Logoff", null, new EventHandler(ClickAction)); actions.DropDownItems.Add("System Shutdown", null, new EventHandler(ClickAction)); - - actions.DropDownItems.Add(new ToolStripSeparator()); - actions.DropDownItems.Add("Volume Up", null, new EventHandler(ClickAction)); - actions.DropDownItems.Add("Volume Down", null, new EventHandler(ClickAction)); - actions.DropDownItems.Add("Volume Mute", null, new EventHandler(ClickAction)); - actions.DropDownItems.Add(new ToolStripSeparator()); ToolStripMenuItem ejectMenu = new ToolStripMenuItem("Eject"); @@ -442,6 +380,12 @@ ejectMenu.DropDownItems.Add(drive.Name, null, new EventHandler(ClickEjectAction)); actions.DropDownItems.Add(ejectMenu); + actions.DropDownItems.Add(new ToolStripSeparator()); + + actions.DropDownItems.Add("Volume Up", null, new EventHandler(ClickAction)); + actions.DropDownItems.Add("Volume Down", null, new EventHandler(ClickAction)); + actions.DropDownItems.Add("Volume Mute", null, new EventHandler(ClickAction)); + _notifyIcon.ContextMenuStrip.Items.Add(actions); /**/ @@ -595,23 +539,25 @@ break; case "System Standby": - Application.SetSuspendState(PowerState.Suspend, true, false); + Standby(); break; case "System Hibernate": - Application.SetSuspendState(PowerState.Hibernate, true, false); + Hibernate(); break; case "System Reboot": - Win32.ExitWindowsEx(Win32.ExitWindows.Reboot | Win32.ExitWindows.ForceIfHung, Win32.ShutdownReason.FlagUserDefined); + Reboot(); break; + /* case "System Logoff": - Win32.ExitWindowsEx(Win32.ExitWindows.LogOff | Win32.ExitWindows.ForceIfHung, Win32.ShutdownReason.FlagUserDefined); + LogOff(); break; + */ case "System Shutdown": - Win32.ExitWindowsEx(Win32.ExitWindows.ShutDown | Win32.ExitWindows.ForceIfHung, Win32.ShutdownReason.FlagUserDefined); + ShutDown(); break; @@ -1063,17 +1009,13 @@ { try { - IntPtr active = Win32.GetForegroundWindow(); - - if (active.Equals(IntPtr.Zero)) + int pid = Win32.GetForegroundWindowPID(); + if (pid == -1) { - IrssLog.Debug("No active program (no foreground window)"); + IrssLog.Debug("Error retreiving foreground window process ID"); return null; } - int pid = -1; - Win32.GetWindowThreadProcessId(active, out pid); - string fileName = Path.GetFileName(Process.GetProcessById(pid).MainModule.FileName); foreach (ProgramSettings progSettings in Config.Programs) @@ -1174,6 +1116,33 @@ } + static void Hibernate() + { + IrssLog.Info("Hibernate"); + Application.SetSuspendState(PowerState.Hibernate, true, false); + } + static void Standby() + { + IrssLog.Info("Standby"); + Application.SetSuspendState(PowerState.Suspend, true, false); + } + static void Reboot() + { + IrssLog.Info("Reboot"); + Win32.ExitWindowsEx(Win32.ExitWindows.Reboot | Win32.ExitWindows.ForceIfHung, Win32.ShutdownReasons.FlagUserDefined); + } + /*static void LogOff() + { + IrssLog.Info("LogOff"); + Win32.ExitWindowsEx(Win32.ExitWindows.LogOff | Win32.ExitWindows.ForceIfHung, Win32.ShutdownReason.FlagUserDefined); + }*/ + static void ShutDown() + { + IrssLog.Info("ShutDown"); + Win32.ExitWindowsEx(Win32.ExitWindows.ShutDown | Win32.ExitWindows.ForceIfHung, Win32.ShutdownReasons.FlagUserDefined); + } + + static void MapEvent(MappingEvent theEvent) { if (_inConfiguration) @@ -1285,15 +1254,27 @@ case Common.XmlTagStandby: { - Application.SetSuspendState(PowerState.Suspend, true, false); + Standby(); break; } case Common.XmlTagHibernate: { - Application.SetSuspendState(PowerState.Hibernate, true, false); + Hibernate(); break; } + + case Common.XmlTagShutdown: + { + ShutDown(); + break; + } + + case Common.XmlTagReboot: + { + Reboot(); + break; + } } } } @@ -1415,6 +1396,26 @@ string mouseCommand = command.Substring(Common.CmdPrefixMouse.Length); Common.ProcessMouseCommand(mouseCommand); } + else if (command.StartsWith(Common.CmdPrefixHibernate)) // Hibernate Command + { + Hibernate(); + } + else if (command.StartsWith(Common.CmdPrefixReboot)) // Reboot Command + { + Reboot(); + } + else if (command.StartsWith(Common.CmdPrefixShutdown)) // Shutdown Command + { + ShutDown(); + } + else if (command.StartsWith(Common.CmdPrefixStandby)) // Standby Command + { + Standby(); + } + else if (command.StartsWith(Common.CmdPrefixTranslator)) // Translator Command + { + ShowTranslatorMenu(); + } else { throw new ArgumentException(String.Format("Cannot process unrecognized command \"{0}\"", command), "command"); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-08-15 14:22:31 UTC (rev 840) @@ -106,12 +106,6 @@ <Compile Include="Forms\MainForm.Designer.cs"> <DependentUpon>MainForm.cs</DependentUpon> </Compile> - <Compile Include="Forms\PopupMenu.cs"> - <SubType>Form</SubType> - </Compile> - <Compile Include="Forms\PopupMenu.Designer.cs"> - <DependentUpon>PopupMenu.cs</DependentUpon> - </Compile> <Compile Include="MappedEvent.cs" /> <Compile Include="Program.cs" /> <Compile Include="ProgramSettings.cs" /> @@ -144,10 +138,6 @@ <SubType>Designer</SubType> <DependentUpon>MainForm.cs</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="Forms\PopupMenu.resx"> - <SubType>Designer</SubType> - <DependentUpon>PopupMenu.cs</DependentUpon> - </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -20,11 +20,10 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "Tray Launcher.log"); - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); - Tray tray = new Tray(); if (tray.Start()) Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -84,11 +84,10 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "Virtual Remote.log"); - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); - LoadSettings(); if (args.Length > 0) // Command Line Start ... 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 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -279,11 +279,10 @@ private void MainForm_Load(object sender, EventArgs e) { + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "Virtual Remote Skin Editor.log"); - IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); - UpdateWindowTitle(); comboBoxShortcut.Items.Clear(); Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -124,6 +124,8 @@ public const string CmdPrefixEject = "Eject: "; + public const string CmdPrefixTranslator = "Show Translator Menu"; + #endregion Command Prefixes #region XML Tags @@ -152,6 +154,8 @@ public const string XmlTagEject = "EJECT"; + public const string XmlTagTranslator = "TRANSLATOR"; + #endregion XML Tags #region User Interface Text @@ -174,11 +178,14 @@ public const string UITextHibernate = "Hibernate"; public const string UITextReboot = "Reboot"; public const string UITextShutdown = "Shutdown"; + //public const string UITextLogoff public const string UITextMouse = "Mouse Command"; public const string UITextEject = "Eject CD"; + public const string UITextTranslator = "Show Translator Menu"; + #endregion User Interface Text #region Mouse Commands @@ -323,7 +330,7 @@ processWindow = process.MainWindowHandle; if (processWindow != IntPtr.Zero) { - Win32.SetForegroundWindow(processWindow); + Win32.SetForegroundWindow(processWindow, true); break; } @@ -372,7 +379,9 @@ { IntPtr windowHandle = IntPtr.Zero; - switch (commands[0].ToLowerInvariant()) + string matchType = commands[0].ToLowerInvariant(); + + switch (matchType) { case "active": windowHandle = Win32.GetForegroundWindow(); @@ -383,7 +392,7 @@ { try { - if (proc.MainModule.FileName == commands[1]) + if (commands[1].Equals(proc.MainModule.FileName, StringComparison.InvariantCultureIgnoreCase)) { windowHandle = proc.MainWindowHandle; break; @@ -410,15 +419,12 @@ //Win32.SendMessage(windowHandle, msg, wordParam, longParam); - IntPtr result; + IntPtr result = IntPtr.Zero; Win32.SendMessageTimeout(windowHandle, msg, wordParam, longParam, Win32.SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out result); + int lastError = Marshal.GetLastWin32Error(); if (result == IntPtr.Zero) - { - int lastError = Marshal.GetLastWin32Error(); Marshal.ThrowExceptionForHR(lastError); - } - } /// <summary> Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/ExternalProgram.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/ExternalProgram.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/ExternalProgram.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -173,7 +173,7 @@ processWindow = process.MainWindowHandle; if (processWindow != IntPtr.Zero) { - Win32.SetForegroundWindow(processWindow); + Win32.SetForegroundWindow(processWindow, true); break; } Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Keyboard.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Keyboard.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Keyboard.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -17,7 +17,7 @@ byte bVk, byte bScan, uint dwFlags, - UIntPtr dwExtraInfo); + IntPtr dwExtraInfo); #endregion Interop @@ -26,7 +26,7 @@ /// <summary> /// Virtual Key Codes /// </summary> - public enum VKey : byte + public enum VKey { None = 0, VK_0 = 0x30, @@ -174,8 +174,7 @@ /// Key Event Types /// </summary> [Flags] - [CLSCompliant(false)] - public enum KeyEvents : uint + public enum KeyEvents { KeyDown = 0, ExtendedKey = 1, @@ -194,7 +193,7 @@ /// <param name="vKey">Virtual key to press.</param> public static void KeyDown(VKey vKey) { - keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyDown, UIntPtr.Zero); + keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyDown, IntPtr.Zero); } /// <summary> @@ -203,7 +202,7 @@ /// <param name="vKey">Virtual key to release.</param> public static void KeyUp(VKey vKey) { - keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyUp, UIntPtr.Zero); + keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyUp, IntPtr.Zero); } /// <summary> @@ -213,8 +212,7 @@ /// <param name="scan">Scan code.</param> /// <param name="flags">Event type.</param> /// <param name="extraInfo">Pointer to additional information.</param> - [CLSCompliant(false)] - public static void Event(VKey vKey, byte scan, KeyEvents flags, UIntPtr extraInfo) + public static void Event(VKey vKey, byte scan, KeyEvents flags, IntPtr extraInfo) { keybd_event((byte)vKey, scan, (uint)flags, extraInfo); } Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Mouse.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Mouse.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Mouse.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -23,7 +23,7 @@ /// Used to simulate mouse actions. /// </summary> [Flags] - public enum MouseEvents : int + public enum MouseEvents { None = 0x0000, Move = 0x0001, @@ -40,7 +40,7 @@ /// <summary> /// Used to simulate mouse wheel scrolling. /// </summary> - public enum ScrollDir : int + public enum ScrollDir { None = 0, Up = 120, Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -292,46 +292,46 @@ } [Flags] - public enum ShutdownReason + public enum ShutdownReasons { - MajorApplication = 0x00040000, - MajorHardware = 0x00010000, - MajorLegacyApi = 0x00070000, - MajorOperatingSystem = 0x00020000, - MajorOther = 0x00000000, - MajorPower = 0x00060000, - MajorSoftware = 0x00030000, - MajorSystem = 0x00050000, + MajorApplication = 0x00040000, + MajorHardware = 0x00010000, + MajorLegacyApi = 0x00070000, + MajorOperatingSystem = 0x00020000, + MajorOther = 0x00000000, + MajorPower = 0x00060000, + MajorSoftware = 0x00030000, + MajorSystem = 0x00050000, - MinorBlueScreen = 0x0000000F, - MinorCordUnplugged = 0x0000000b, - MinorDisk = 0x00000007, - MinorEnvironment = 0x0000000c, - MinorHardwareDriver = 0x0000000d, - MinorHotfix = 0x00000011, - MinorHung = 0x00000005, - MinorInstallation = 0x00000002, - MinorMaintenance = 0x00000001, - MinorMMC = 0x00000019, - MinorNetworkConnectivity = 0x00000014, - MinorNetworkCard = 0x00000009, - MinorOther = 0x00000000, - MinorOtherDriver = 0x0000000e, - MinorPowerSupply = 0x0000000a, - MinorProcessor = 0x00000008, - MinorReconfig = 0x00000004, - MinorSecurity = 0x00000013, - MinorSecurityFix = 0x00000012, + MinorBlueScreen = 0x0000000F, + MinorCordUnplugged = 0x0000000b, + MinorDisk = 0x00000007, + MinorEnvironment = 0x0000000c, + MinorHardwareDriver = 0x0000000d, + MinorHotfix = 0x00000011, + MinorHung = 0x00000005, + MinorInstallation = 0x00000002, + MinorMaintenance = 0x00000001, + MinorMMC = 0x00000019, + MinorNetworkConnectivity = 0x00000014, + MinorNetworkCard = 0x00000009, + MinorOther = 0x00000000, + MinorOtherDriver = 0x0000000e, + MinorPowerSupply = 0x0000000a, + MinorProcessor = 0x00000008, + MinorReconfig = 0x00000004, + MinorSecurity = 0x00000013, + MinorSecurityFix = 0x00000012, MinorSecurityFixUninstall = 0x00000018, - MinorServicePack = 0x00000010, + MinorServicePack = 0x00000010, MinorServicePackUninstall = 0x00000016, - MinorTermSrv = 0x00000020, - MinorUnstable = 0x00000006, - MinorUpgrade = 0x00000003, - MinorWMI = 0x00000015, + MinorTermSrv = 0x00000020, + MinorUnstable = 0x00000006, + MinorUpgrade = 0x00000003, + MinorWMI = 0x00000015, - FlagUserDefined = 0x40000000, - //FlagPlanned = 0x80000000, + FlagUserDefined = 0x40000000, + //FlagPlanned = 0x80000000, } [Flags] @@ -343,7 +343,7 @@ Reboot = 0x02, PowerOff = 0x08, RestartApps = 0x40, - // Optionally include ONE of the following two: + // Optionally include ONE of the following: Force = 0x04, ForceIfHung = 0x10, } @@ -376,16 +376,13 @@ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow(); - [DllImport("user32.dll")] + [DllImport("user32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetForegroundWindow(IntPtr hWnd); + public static extern bool ExitWindowsEx(ExitWindows uFlags, ShutdownReasons dwReason); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern int GetWindowTextLength(IntPtr hWnd); + [DllImport("user32.dll", SetLastError = true)] + public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern IntPtr SendMessageTimeout( IntPtr hWnd, @@ -402,16 +399,46 @@ //[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] //public static extern int RegisterWindowMessage(string lpString); - [DllImport("user32.dll", SetLastError = true)] + [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool ExitWindowsEx(ExitWindows uFlags, ShutdownReason dwReason); + private static extern bool SetFocus(IntPtr hWnd); - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool SetForegroundWindow(IntPtr hWnd); + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool BringWindowToTop(IntPtr hWnd); + + //[DllImport("user32.dll")] + //[return: MarshalAs(UnmanagedType.Bool)] + //private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool AttachThreadInput(int nThreadId, int nThreadIdTo, bool bAttach); + + //[DllImport("user32.dll")] + //[return: MarshalAs(UnmanagedType.Bool)] + //private static extern bool IsWindowVisible(IntPtr hWnd); + + //[DllImport("user32.dll")] + //[return: MarshalAs(UnmanagedType.Bool)] + //private static extern bool IsIconic(IntPtr hWnd); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + private static extern int GetWindowTextLength(IntPtr hWnd); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); + [DllImport("user32.dll", SetLastError = true)] - public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); + private static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); + [DllImport("kernel32.dll")] + private static extern int GetCurrentThreadId(); + #region Net API [DllImport("netapi32.dll", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute] @@ -444,6 +471,11 @@ #region Methods + /// <summary> + /// Get the window title for a specified window handle. + /// </summary> + /// <param name="hWnd">Handle to a window.</param> + /// <returns>Window title.</returns> public static string GetWindowTitle(IntPtr hWnd) { int length = GetWindowTextLength(hWnd); @@ -456,6 +488,65 @@ } /// <summary> + /// Takes a given window from whatever state it is in and makes it the foreground window. + /// </summary> + /// <param name="hWnd">Handle to window.</param> + /// <param name="force">Force from a minimized or hidden state.</param> + /// <returns>Success.</returns> + public static bool SetForegroundWindow(IntPtr hWnd, bool force) + { + IntPtr fgWindow = GetForegroundWindow(); + + if (hWnd == fgWindow || SetForegroundWindow(hWnd)) + return true; + + if (force == false) + return false; + + if (fgWindow == IntPtr.Zero) + return false; + + int fgWindowPID = -1; + GetWindowThreadProcessId(fgWindow, out fgWindowPID); + + if (fgWindowPID == -1) + return false; + + int curThreadID = GetCurrentThreadId(); + + // if we don't attach successfully to the windows thread then we're out of options + if (!AttachThreadInput(curThreadID, fgWindowPID, true)) + return false; + + SetForegroundWindow(hWnd); + BringWindowToTop(hWnd); + SetFocus(hWnd); + + AttachThreadInput(curThreadID, fgWindowPID, false); + + // we've done all that we can so base our return value on whether we have succeeded or not + return (GetForegroundWindow() == hWnd); + } + + /// <summary> + /// Get the Process ID of the current foreground window. + /// </summary> + /// <returns>Process ID.</returns> + public static int GetForegroundWindowPID() + { + int pid = -1; + + IntPtr active = GetForegroundWindow(); + + if (active.Equals(IntPtr.Zero)) + return pid; + + GetWindowThreadProcessId(active, out pid); + + return pid; + } + + /// <summary> /// Given a 32-bit integer this method returns the High Word (upper 16 bits). /// </summary> /// <param name="n">32-bit integer.</param> Modified: trunk/plugins/IR Server Suite/IPC/AppModule.NamedPipes/APipeConnection.cs =================================================================== --- trunk/plugins/IR Server Suite/IPC/AppModule.NamedPipes/APipeConnection.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IPC/AppModule.NamedPipes/APipeConnection.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -134,7 +134,7 @@ /// </summary> /// <param name="disposing">A boolean indicating how the method is called.</param> #endregion - protected void Dispose(bool disposing) { + protected virtual void Dispose(bool disposing) { if(!this.disposed) { NamedPipeWrapper.Close(this.Handle); } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/FusionRemote Receiver/FusionRemoteReceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/FusionRemote Receiver/FusionRemoteReceiver.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/FusionRemote Receiver/FusionRemoteReceiver.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -55,7 +55,7 @@ static extern SafeFileHandle CreateFile( [MarshalAs(UnmanagedType.LPTStr)] string fileName, uint fileAccess, - [MarshalAs(UnmanagedType.U4)] EFileShare fileShare, + [MarshalAs(UnmanagedType.U4)] EFileShares fileShare, //[In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SecurityAttributesMarshaler))] SecurityAttributes lpSecurityAttributes, IntPtr sa, [MarshalAs(UnmanagedType.U4)] ECreationDisposition creationDisposition, @@ -66,24 +66,22 @@ [return: MarshalAs(UnmanagedType.Bool)] static extern bool CancelIo(SafeFileHandle handle); - [CLSCompliant(false)] [Flags] - public enum EFileShare : uint + public enum EFileShares { None = 0x00000000, Read = 0x00000001, Write = 0x00000002, - Delete = 0x00000004 + Delete = 0x00000004, } - [CLSCompliant(false)] - public enum ECreationDisposition : uint + public enum ECreationDisposition { New = 1, CreateAlways = 2, OpenExisting = 3, OpenAlways = 4, - TruncateExisting = 5 + TruncateExisting = 5, } [Flags] @@ -294,7 +292,7 @@ if (devicePath == null) throw new Exception("No device detected"); - SafeFileHandle deviceHandle = CreateFile(devicePath, GENERIC_READ, EFileShare.Read | EFileShare.Write, IntPtr.Zero, ECreationDisposition.OpenExisting, EFileAttributes.Overlapped, IntPtr.Zero); + SafeFileHandle deviceHandle = CreateFile(devicePath, GENERIC_READ, EFileShares.Read | EFileShares.Write, IntPtr.Zero, ECreationDisposition.OpenExisting, EFileAttributes.Overlapped, IntPtr.Zero); int lastError = Marshal.GetLastWin32Error(); if (lastError != 0) Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IRServerPluginInterface.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IRServerPluginInterface.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IRServerPluginInterface.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -49,7 +49,7 @@ /// <summary> /// Infrared command learning timed out. /// </summary> - Timeout + Timeout, } #endregion Enumerations 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-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Keyboard.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -17,7 +17,7 @@ byte bVk, byte bScan, uint dwFlags, - UIntPtr dwExtraInfo); + IntPtr dwExtraInfo); #endregion Interop @@ -26,7 +26,7 @@ /// <summary> /// Virtual Key Codes. /// </summary> - public enum VKey : byte + public enum VKey { None = 0, VK_0 = 0x30, @@ -174,7 +174,7 @@ /// Key Event Types. /// </summary> [Flags] - public enum KeyEvents : uint + public enum KeyEvents { KeyDown = 0, ExtendedKey = 1, @@ -193,7 +193,7 @@ /// <param name="vKey">Virtual key to press.</param> public static void KeyDown(VKey vKey) { - keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyDown, UIntPtr.Zero); + keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyDown, IntPtr.Zero); } /// <summary> @@ -202,7 +202,7 @@ /// <param name="vKey">Virtual key to release.</param> public static void KeyUp(VKey vKey) { - keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyUp, UIntPtr.Zero); + keybd_event((byte)vKey, 0, (uint)KeyEvents.KeyUp, IntPtr.Zero); } /// <summary> @@ -212,7 +212,7 @@ /// <param name="scan">Scan code.</param> /// <param name="flags">Event type.</param> /// <param name="extraInfo">Pointer to additional information.</param> - public static void Event(VKey vKey, byte scan, KeyEvents flags, UIntPtr extraInfo) + public static void Event(VKey vKey, byte scan, KeyEvents flags, IntPtr extraInfo) { keybd_event((byte)vKey, scan, (uint)flags, extraInfo); } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceDetectionData.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceDetectionData.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceDetectionData.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -23,17 +23,17 @@ } [Flags] - public enum KeyModifiers : uint + public enum KeyModifiers { - None = 0, - LeftControl = 1, - LeftShift = 2, - LeftAlt = 4, - LeftWin = 8, - RightControl = 16, - RightShift = 32, - RightAlt = 64, - RightWin = 128, + None = 0, + LeftControl = 1, + LeftShift = 2, + LeftAlt = 4, + LeftWin = 8, + RightControl = 16, + RightShift = 32, + RightAlt = 64, + RightWin = 128, } #endregion Enumerations Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceIrCode.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceIrCode.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MceIrCode.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -12,7 +12,7 @@ #region Constants - public const int DefaultCarrierFrequency = 36000; + public const int DefaultCarrierFrequency = 38000; #endregion Constants @@ -48,11 +48,8 @@ #region Constructors public MceIrCode() : this(MceIrCode.DefaultCarrierFrequency, null) { } - public MceIrCode(int carrier) : this(carrier, null) { } - public MceIrCode(byte[] data) : this(MceIrCode.DefaultCarrierFrequency, data) { } - public MceIrCode(int carrier, byte[] data) { _carrier = carrier; Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Mouse.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Mouse.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Mouse.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -23,7 +23,7 @@ /// Used to simulate mouse actions. /// </summary> [Flags] - public enum MouseEvents : int + public enum MouseEvents { None = 0x0000, Move = 0x0001, @@ -34,17 +34,17 @@ MiddleDown = 0x0020, MiddleUp = 0x0040, Scroll = 0x0800, - Absolute = 0x8000 + Absolute = 0x8000, } /// <summary> /// Used to simulate mouse wheel scrolling. /// </summary> - public enum ScrollDir : int + public enum ScrollDir { None = 0, Up = 120, - Down = -120 + Down = -120, } #endregion Enumerations 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-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -14,7 +14,7 @@ #region Enumerations - enum CodeType : ushort + enum CodeType { RawOscillated = 0x0000, RawUnmodulated = 0x0100, @@ -33,7 +33,7 @@ YamahaNEC = 0x9001, } - enum CarrierFrequency : ushort + enum CarrierFrequency { Khz38 = 0x006D, Khz36 = 0x0073, Modified: trunk/plugins/IR Server Suite/IR Server Plugins/XBCDRC Receiver/XBCDRC Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/XBCDRC Receiver/XBCDRC Receiver.cs 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Plugins/XBCDRC Receiver/XBCDRC Receiver.cs 2007-08-15 14:22:31 UTC (rev 840) @@ -75,7 +75,7 @@ PosixSemantics = 0x01000000, OpenReparsePoint = 0x00200000, OpenNoRecall = 0x00100000, - FirstPipeInstance = 0x00080000 + FirstPipeInstance = 0x00080000, } [StructLayout(LayoutKind.Sequential)] Modified: trunk/plugins/IR Server Suite/IR Server Suite.sln =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite.sln 2007-08-15 14:08:45 UTC (rev 839) +++ trunk/plugins/IR Server Suite/IR Server Suite.sln 2007-08-15 14:22:31 UTC (rev 840) @@ -69,126 +69,248 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IR Blast (No Window)", "Applications\IR Blast (No Window)\IR Blast (No Window).csproj", "{54E0E8FA-09C3-4755-B9CE-E7E5DDA3E932}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IrssComms", "Common\IrssComms\IrssComms.csproj", "{BCAFDF45-70DD-46FD-8B98-880DDA585AD2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Debug|x86.ActiveCfg = Debug|x86 {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Debug|x86.Build.0 = Debug|x86 + {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Release|Any CPU.Build.0 = Release|Any CPU {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Release|x86.ActiveCfg = Release|x86 {D2A1F8D6-A9D3-4BFA-913B-8806642BD0DA}.Release|x86.Build.0 = Release|x86 + {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Debug|x86.ActiveCfg = Debug|x86 {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Debug|x86.Build.0 = Debug|x86 + {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Release|Any CPU.Build.0 = Release|Any CPU {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Release|x86.ActiveCfg = Release|x86 {0C894165-4BE8-4CF7-8F92-2B6DF68EB43A}.Release|x86.Build.0 = Release|x86 + {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Debug|Any CPU.Build.0 = Debug|Any CPU {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Debug|x86.ActiveCfg = Debug|x86 {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Debug|x86.Build.0 = Debug|x86 + {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Release|Any CPU.Build.0 = Release|Any CPU {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Release|x86.ActiveCfg = Release|x86 {4CD051F4-F2B5-47B3-8647-F47C2E4DC131}.Release|x86.Build.0 = Release|x86 + {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Debug|x86.ActiveCfg = Debug|x86 {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Debug|x86.Build.0 = Debug|x86 + {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Release|Any CPU.Build.0 = Release|Any CPU {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Release|x86.ActiveCfg = Release|x86 {A8B8B9C6-9E88-486B-AE9C-F2D945ED05A6}.Release|x86.Build.0 = Release|x86 + {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Debug|Any CPU.Build.0 = Debug|Any CPU {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Debug|x86.ActiveCfg = Debug|x86 {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Debug|x86.Build.0 = Debug|x86 + {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Release|Any CPU.Build.0 = Release|Any CPU {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Release|x86.ActiveCfg = Release|x86 {46C08F6B-F3C8-461B-9B6F-3BFD4AAAFD63}.Release|x86.Build.0 = Release|x86 + {D871AB9A-71B3-4D63-8320-084BAD75064E}.Debug|Any CPU.ActiveCfg = Debug|An... [truncated message content] |