From: <an...@us...> - 2008-07-05 12:55:44
|
Revision: 1885 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1885&view=rev Author: and-81 Date: 2008-07-05 05:55:37 -0700 (Sat, 05 Jul 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Debug Client/Program.cs 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 File Tool/FormMain.cs trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.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/Tray Launcher/Program.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.Designer.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs trunk/plugins/IR Server Suite/Common/IrssUtils/FocusForcer.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs trunk/plugins/IR Server Suite/Documentation/Translator/index.html trunk/plugins/IR Server Suite/Documentation/irblast.html trunk/plugins/IR Server Suite/Documentation/new.html trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/Program.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/Program.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -7,6 +7,9 @@ static class Program { + /// <summary> + /// Main method. + /// </summary> [STAThread] static void Main() { Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -28,7 +28,7 @@ static string _blastPort = "Default"; - static int _delay = 50; + static int _delay = 250; static bool _treatAsChannelNumber; static int _padChannelNumber; @@ -59,25 +59,29 @@ for (int index = 0; index < args.Length; index++) { - switch (args[index].ToUpperInvariant()) + string parameter = args[index].ToUpperInvariant(); + if (parameter.StartsWith("-", StringComparison.Ordinal) || parameter.StartsWith("/", StringComparison.Ordinal)) + parameter = parameter.Substring(1); + + switch (parameter) { - case "-HOST": + case "HOST": _serverHost = args[++index]; continue; - case "-PORT": + case "PORT": _blastPort = args[++index]; continue; - case "-DELAY": + case "DELAY": _delay = int.Parse(args[++index]); continue; - case "-CHANNEL": + case "CHANNEL": _treatAsChannelNumber = true; continue; - case "-PAD": + case "PAD": _padChannelNumber = int.Parse(args[++index]); continue; @@ -201,15 +205,17 @@ { IrssLog.Debug("Show Help"); - Console.WriteLine("IRBlast [-host x] [-port x] [-speed x] [-pad x] [-channel] <commands>"); + Console.WriteLine("IRBlast [-host x] [-port x] [-delay x] [-pad x] [-channel] <commands>"); Console.WriteLine(""); - Console.WriteLine("Use -host to specify the computer that is hosting the IR Server."); + Console.WriteLine("Use -host to specify the computer that is hosting the IR Server (Optional,"); + Console.WriteLine(" defaults to localhost)."); Console.WriteLine("Use -port to blast to a particular blaster port (Optional)."); - Console.WriteLine("Use -speed to set the blaster speed (Optional)."); Console.WriteLine("Use -channel to tell IR Blast to break apart the following IR Command and"); - Console.WriteLine(" use each digit for a separate IR blast (Optional)."); + Console.WriteLine(" use each digit for a separate IR blast (Optional)."); + Console.WriteLine("Use -delay to specify a time to delay between each command or digit in a"); + Console.WriteLine(" channel number (Optional)."); Console.WriteLine("Use -pad to tell IR Blast to pad channel numbers to a certain length"); - Console.WriteLine(" (Optional, Requires -channel)."); + Console.WriteLine(" (Optional, Requires -channel)."); Console.WriteLine("Use a tilde ~ between commands to insert half second pauses."); Console.WriteLine(""); Console.WriteLine(""); 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 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -29,7 +29,7 @@ static string _blastPort = "Default"; - static int _delay = 50; + static int _delay = 250; static bool _treatAsChannelNumber; static int _padChannelNumber; @@ -58,25 +58,29 @@ for (int index = 0; index < args.Length; index++) { - switch (args[index].ToUpperInvariant()) + string parameter = args[index].ToUpperInvariant(); + if (parameter.StartsWith("-", StringComparison.Ordinal) || parameter.StartsWith("/", StringComparison.Ordinal)) + parameter = parameter.Substring(1); + + switch (parameter) { - case "-HOST": + case "HOST": _serverHost = args[++index]; continue; - case "-PORT": + case "PORT": _blastPort = args[++index]; continue; - case "-DELAY": + case "DELAY": _delay = int.Parse(args[++index]); continue; - case "-CHANNEL": + case "CHANNEL": _treatAsChannelNumber = true; continue; - case "-PAD": + case "PAD": _padChannelNumber = int.Parse(args[++index]); continue; Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -60,7 +60,6 @@ #endregion Constructor - void RefreshForm() { if (String.IsNullOrEmpty(_fileName)) @@ -653,7 +652,7 @@ string port = comboBoxPort.Text; byte[] codeBytes = _code.ToByteArray(); - + byte[] outData = new byte[4 + port.Length + codeBytes.Length]; BitConverter.GetBytes(port.Length).CopyTo(outData, 0); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -65,7 +65,7 @@ } /// <summary> - /// System wide button mappings. + /// Gets system wide button mappings. /// </summary> /// <value>The system wide mappings.</value> [XmlArray] @@ -75,7 +75,7 @@ } /// <summary> - /// Program settings. + /// Gets program settings. /// </summary> /// <value>The programs.</value> [XmlArray] @@ -85,7 +85,7 @@ } /// <summary> - /// Mapped events. + /// Gets mapped events. /// </summary> /// <value>The events.</value> [XmlArray] Modified: trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Translator/CopyDataWM.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -85,7 +85,7 @@ /// <summary> /// Starts this instance. /// </summary> - /// <returns></returns> + /// <returns><c>true</c> if successful; otherwise, <c>false</c>.</returns> public bool Start() { if (Handle != IntPtr.Zero) Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/EditProgramForm.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -110,9 +110,7 @@ find.Description = "Please specify the starting folder for the application"; find.ShowNewFolderButton = true; if (find.ShowDialog(this) == DialogResult.OK) - { textBoxAppStartFolder.Text = find.SelectedPath; - } } private void buttonTest_Click(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -165,19 +165,19 @@ // Adjust process priority ... AdjustPriority(_config.ProcessPriority); - /* - foreach (ProgramSettings progSettings in _config.Programs) - { - AppProfile profile = new AppProfile(); + + //foreach (ProgramSettings progSettings in _config.Programs) + //{ + // AppProfile profile = new AppProfile(); - profile.Name = progSettings.Name; - profile.MatchType = AppProfile.DetectionMethod.Executable; - profile.MatchParameters = progSettings.FileName; - profile.ButtonMappings.AddRange(progSettings.ButtonMappings); + // profile.Name = progSettings.Name; + // profile.MatchType = AppProfile.DetectionMethod.Executable; + // profile.MatchParameters = progSettings.FileName; + // profile.ButtonMappings.AddRange(progSettings.ButtonMappings); - AppProfile.Save(profile, "C:\\" + profile.Name + ".xml"); - } - */ + // AppProfile.Save(profile, "C:\\" + profile.Name + ".xml"); + //} + // Setup notify icon ... _container = new Container(); @@ -282,88 +282,95 @@ for (int index = 0; index < args.Length; index++) { string command = args[index].ToUpperInvariant(); + if (command.StartsWith("-") || command.StartsWith("/")) + command = command.Substring(1); switch (command) { - case "-BLAST": + case "BLAST": if (args.Length > index + 2) CopyDataWM.SendCopyDataMessage(Common.CmdPrefixBlast + args[++index] + '|' + args[++index]); else throw new CommandStructureException("Blast command requires two parameters (IR file, Port)"); - continue; + break; - case "-MACRO": + case "MACRO": if (args.Length > index + 1) CopyDataWM.SendCopyDataMessage(Common.CmdPrefixMacro + args[++index]); else throw new CommandStructureException("Macro command requires a parameter (Macro file)"); - continue; + break; - case "-EJECT": + case "EJECT": if (args.Length > index + 1) CopyDataWM.SendCopyDataMessage(Common.CmdPrefixEject + args[++index]); else throw new CommandStructureException("Eject command requires a parameter (Drive)"); - continue; + break; - case "-SHUTDOWN": + case "SHUTDOWN": CopyDataWM.SendCopyDataMessage(Common.CmdPrefixShutdown); - continue; + break; - case "-REBOOT": + case "REBOOT": CopyDataWM.SendCopyDataMessage(Common.CmdPrefixReboot); - continue; + break; - case "-STANDBY": + case "STANDBY": CopyDataWM.SendCopyDataMessage(Common.CmdPrefixStandby); - continue; + break; - case "-HIBERNATE": + case "HIBERNATE": CopyDataWM.SendCopyDataMessage(Common.CmdPrefixHibernate); - continue; + break; - case "-LOGOFF": + case "LOGOFF": CopyDataWM.SendCopyDataMessage(Common.CmdPrefixLogOff); - continue; + break; - case "-OSD": + case "OSD": CopyDataWM.SendCopyDataMessage(Common.CmdPrefixTranslator); - continue; + break; - case "-CHANNEL": + case "CHANNEL": + if (args.Length > index + 4) { - if (args.Length > index + 3) - { - string channel = args[++index]; - int padding = int.Parse(args[++index]); - string port = args[++index]; + string channel = args[++index]; + int padding = int.Parse(args[++index]); + string port = args[++index]; + int delay = int.Parse(args[++index]); - while (channel.Length < padding) - channel = '0' + channel; + while (channel.Length < padding) + channel = '0' + channel; - foreach (char digit in channel) - CopyDataWM.SendCopyDataMessage(Common.CmdPrefixBlast + digit + '|' + port); - } - else + foreach (char digit in channel) { - throw new CommandStructureException("Channel command requires three parameters (Channel, Padding, Port)"); + CopyDataWM.SendCopyDataMessage(Common.CmdPrefixBlast + digit + '|' + port); + if (delay > 0) + Thread.Sleep(delay); } - - continue; } + else + { + throw new CommandStructureException("Channel command requires three parameters (Channel, Padding, Port, Delay)"); + } + break; - case "-CONFIG": + case "CONFIG": if (args.Length > index + 1) _configFile = args[++index]; else throw new CommandStructureException("Config command requires a parameter (Config file path)"); dontRun = false; - continue; + break; - //TODO: Add more command line options. + // TODO: Add more command line options. + + default: + throw new CommandStructureException(String.Format("Unrecognised command line parameter \"{0}\"", args[index])); } } @@ -447,18 +454,16 @@ _notifyIcon.ContextMenuStrip.Items.Add(launch); } - /* - string[] irList = Common.GetIRList(false); - if (irList.Length > 0) - { - ToolStripMenuItem irCommands = new ToolStripMenuItem("&IR Commands"); + //string[] irList = Common.GetIRList(false); + //if (irList.Length > 0) + //{ + // ToolStripMenuItem irCommands = new ToolStripMenuItem("&IR Commands"); - foreach (string irCommand in irList) - irCommands.DropDownItems.Add(irCommand, null, new EventHandler(ClickIrCommand)); + // foreach (string irCommand in irList) + // irCommands.DropDownItems.Add(irCommand, null, new EventHandler(ClickIrCommand)); - _notifyIcon.ContextMenuStrip.Items.Add(irCommands); - } - */ + // _notifyIcon.ContextMenuStrip.Items.Add(irCommands); + //} string[] macroList = IrssMacro.GetMacroList(Program.FolderMacros, false); if (macroList.Length > 0) @@ -853,7 +858,7 @@ int pid = Win32.GetForegroundWindowPID(); if (pid == -1) { - IrssLog.Debug("Failed to retreive foreground window process ID"); + IrssLog.Debug("Failed to retrieve foreground window process ID"); return null; } Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -8,6 +8,9 @@ namespace TrayLauncher { + /// <summary> + /// Tray Launcher Program class. + /// </summary> static class Program { Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.Designer.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.Designer.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -39,6 +39,8 @@ this.buttonCancel = new System.Windows.Forms.Button(); this.checkBoxLaunchOnLoad = new System.Windows.Forms.CheckBox(); this.groupBoxOptions = new System.Windows.Forms.GroupBox(); + this.checkBoxRepeatsFocus = new System.Windows.Forms.CheckBox(); + this.checkBoxOneInstance = new System.Windows.Forms.CheckBox(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.buttonRemoteButton = new System.Windows.Forms.Button(); this.groupBoxServerHost = new System.Windows.Forms.GroupBox(); @@ -96,7 +98,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(152, 192); + this.buttonOK.Location = new System.Drawing.Point(152, 224); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(56, 24); this.buttonOK.TabIndex = 4; @@ -108,7 +110,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(216, 192); + this.buttonCancel.Location = new System.Drawing.Point(216, 224); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(56, 24); this.buttonCancel.TabIndex = 5; @@ -130,19 +132,46 @@ // this.groupBoxOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxOptions.Controls.Add(this.checkBoxRepeatsFocus); + this.groupBoxOptions.Controls.Add(this.checkBoxOneInstance); this.groupBoxOptions.Controls.Add(this.checkBoxAuto); this.groupBoxOptions.Controls.Add(this.checkBoxLaunchOnLoad); this.groupBoxOptions.Location = new System.Drawing.Point(8, 136); this.groupBoxOptions.Name = "groupBoxOptions"; - this.groupBoxOptions.Size = new System.Drawing.Size(264, 48); + this.groupBoxOptions.Size = new System.Drawing.Size(264, 80); this.groupBoxOptions.TabIndex = 2; this.groupBoxOptions.TabStop = false; this.groupBoxOptions.Text = "Options"; // + // checkBoxRepeatsFocus + // + this.checkBoxRepeatsFocus.Enabled = false; + this.checkBoxRepeatsFocus.Location = new System.Drawing.Point(136, 48); + this.checkBoxRepeatsFocus.Name = "checkBoxRepeatsFocus"; + this.checkBoxRepeatsFocus.Size = new System.Drawing.Size(120, 24); + this.checkBoxRepeatsFocus.TabIndex = 3; + this.checkBoxRepeatsFocus.Text = "Repeats focus"; + this.toolTip.SetToolTip(this.checkBoxRepeatsFocus, "With the target application running if the trigger button is pressed then give it" + + " focus"); + this.checkBoxRepeatsFocus.UseVisualStyleBackColor = true; + // + // checkBoxOneInstance + // + this.checkBoxOneInstance.Checked = true; + this.checkBoxOneInstance.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxOneInstance.Location = new System.Drawing.Point(8, 48); + this.checkBoxOneInstance.Name = "checkBoxOneInstance"; + this.checkBoxOneInstance.Size = new System.Drawing.Size(120, 24); + this.checkBoxOneInstance.TabIndex = 2; + this.checkBoxOneInstance.Text = "One instance only"; + this.toolTip.SetToolTip(this.checkBoxOneInstance, "Don\'t start more than one instance of the target application"); + this.checkBoxOneInstance.UseVisualStyleBackColor = true; + this.checkBoxOneInstance.CheckedChanged += new System.EventHandler(this.checkBoxOneInstance_CheckedChanged); + // // buttonRemoteButton // this.buttonRemoteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonRemoteButton.Location = new System.Drawing.Point(8, 192); + this.buttonRemoteButton.Location = new System.Drawing.Point(8, 224); this.buttonRemoteButton.Name = "buttonRemoteButton"; this.buttonRemoteButton.Size = new System.Drawing.Size(96, 24); this.buttonRemoteButton.TabIndex = 3; @@ -181,7 +210,7 @@ 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(280, 224); + this.ClientSize = new System.Drawing.Size(280, 256); this.Controls.Add(this.buttonRemoteButton); this.Controls.Add(this.groupBoxServerHost); this.Controls.Add(this.groupBoxOptions); @@ -217,5 +246,7 @@ private System.Windows.Forms.GroupBox groupBoxServerHost; private System.Windows.Forms.Button buttonRemoteButton; private System.Windows.Forms.ComboBox comboBoxComputer; + private System.Windows.Forms.CheckBox checkBoxOneInstance; + private System.Windows.Forms.CheckBox checkBoxRepeatsFocus; } } \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Setup.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -45,6 +45,16 @@ get { return checkBoxLaunchOnLoad.Checked; } set { checkBoxLaunchOnLoad.Checked = value; } } + public bool OneInstanceOnly + { + get { return checkBoxOneInstance.Checked; } + set { checkBoxOneInstance.Checked = value; } + } + public bool RepeatsFocus + { + get { return checkBoxRepeatsFocus.Checked; } + set { checkBoxRepeatsFocus.Checked = value; } + } public string LaunchKeyCode { get { return _launchKeyCode; } @@ -114,6 +124,11 @@ _launchKeyCode = keyCode; } + private void checkBoxOneInstance_CheckedChanged(object sender, EventArgs e) + { + checkBoxRepeatsFocus.Enabled = checkBoxOneInstance.Checked; + } + } } Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj 2008-07-05 12:55:37 UTC (rev 1885) @@ -16,7 +16,7 @@ <AssemblyOriginatorKeyFile>..\..\IR Server Suite.snk</AssemblyOriginatorKeyFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>false</DebugSymbols> + <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -26,6 +26,8 @@ static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "Tray Launcher\\Tray Launcher.xml"); + const string ProcessCommandThreadName = "ProcessCommand"; + #endregion Constants #region Variables @@ -40,6 +42,8 @@ string _programFile; bool _autoRun; bool _launchOnLoad; + bool _oneInstanceOnly; + bool _repeatsFocus; string _launchKeyCode; Container _container; @@ -139,7 +143,7 @@ _notifyIcon.Visible = true; if (!didSetup && _launchOnLoad) - ClickLaunch(null, null); + Launch(); return true; } @@ -188,28 +192,33 @@ _autoRun = false; } + XmlDocument doc = new XmlDocument(); + try { - XmlDocument doc = new XmlDocument(); doc.Load(ConfigurationFile); - - _serverHost = doc.DocumentElement.Attributes["ServerHost"].Value; - _programFile = doc.DocumentElement.Attributes["ProgramFile"].Value; - _launchOnLoad = bool.Parse(doc.DocumentElement.Attributes["LaunchOnLoad"].Value); - _launchKeyCode = doc.DocumentElement.Attributes["LaunchKeyCode"].Value; } catch (FileNotFoundException) { IrssLog.Warn("Configuration file not found, using defaults"); CreateDefaultSettings(); + return; } catch (Exception ex) { IrssLog.Error(ex); CreateDefaultSettings(); + return; } + + try { _serverHost = doc.DocumentElement.Attributes["ServerHost"].Value; } catch { _serverHost = "localhost"; } + try { _programFile = doc.DocumentElement.Attributes["ProgramFile"].Value; } catch { _programFile = String.Empty; } + try { _launchOnLoad = bool.Parse(doc.DocumentElement.Attributes["LaunchOnLoad"].Value); } catch { _launchOnLoad = false; } + try { _oneInstanceOnly = bool.Parse(doc.DocumentElement.Attributes["OneInstanceOnly"].Value); } catch { _oneInstanceOnly = true; } + try { _repeatsFocus = bool.Parse(doc.DocumentElement.Attributes["RepeatsFocus"].Value); } catch { _repeatsFocus = true; } + try { _launchKeyCode = doc.DocumentElement.Attributes["LaunchKeyCode"].Value; } catch { _launchKeyCode = "Start"; } } void SaveSettings() { @@ -235,10 +244,12 @@ writer.WriteStartDocument(true); writer.WriteStartElement("settings"); // <settings> - writer.WriteAttributeString("ServerHost", _serverHost); - writer.WriteAttributeString("ProgramFile", _programFile); - writer.WriteAttributeString("LaunchOnLoad", _launchOnLoad.ToString()); - writer.WriteAttributeString("LaunchKeyCode", _launchKeyCode); + writer.WriteAttributeString("ServerHost", _serverHost); + writer.WriteAttributeString("ProgramFile", _programFile); + writer.WriteAttributeString("LaunchOnLoad", _launchOnLoad.ToString()); + writer.WriteAttributeString("OneInstanceOnly", _oneInstanceOnly.ToString()); + writer.WriteAttributeString("RepeatsFocus", _repeatsFocus.ToString()); + writer.WriteAttributeString("LaunchKeyCode", _launchKeyCode); writer.WriteEndElement(); // </settings> writer.WriteEndDocument(); @@ -251,10 +262,12 @@ } void CreateDefaultSettings() { - _serverHost = "localhost"; - _programFile = String.Empty; - _launchOnLoad = false; - _launchKeyCode = "Start"; + _serverHost = "localhost"; + _programFile = String.Empty; + _launchOnLoad = false; + _oneInstanceOnly = true; + _repeatsFocus = true; + _launchKeyCode = "Start"; SaveSettings(); } @@ -380,7 +393,7 @@ IrssLog.Info("Remote Event: {0}", keyCode); if (keyCode.Equals(_launchKeyCode, StringComparison.Ordinal)) - ClickLaunch(null, null); + Launch(); } bool Configure() @@ -428,37 +441,69 @@ { IrssLog.Info("Launch"); + Launch(); + } + void ClickQuit(object sender, EventArgs e) + { + IrssLog.Info("Quit"); + if (_inConfiguration) { IrssLog.Info("In Configuration"); return; } + Stop(); + + Application.Exit(); + } + + void Launch() + { + if (_inConfiguration) + { + IrssLog.Info("Can't launch target application, in Configuration"); + return; + } + try { // Check for multiple instances - foreach (Process process in Process.GetProcesses()) + if (_oneInstanceOnly) { - try + foreach (Process process in Process.GetProcesses()) { - if (Path.GetFileName(process.MainModule.ModuleName).Equals(Path.GetFileName(_programFile), StringComparison.OrdinalIgnoreCase)) + try { - IrssLog.Info("Program already running."); - return; + if (Path.GetFileName(process.MainModule.ModuleName).Equals(Path.GetFileName(_programFile), StringComparison.OrdinalIgnoreCase)) + { + IrssLog.Info("Can't launch target application, program already running"); + if (_repeatsFocus) + { + IrssLog.Info("Attempting to give focus to target application ..."); + + FocusForcer forcer = new FocusForcer(process.Id); + forcer.ForceOnce(); + } + return; + } } - } - catch (Win32Exception ex) - { - if (ex.ErrorCode != -2147467259) // Ignore "Unable to enumerate the process modules" errors. + catch (Win32Exception ex) + { + if (ex.ErrorCode != -2147467259) // Ignore "Unable to enumerate the process modules" errors. + IrssLog.Error(ex); + } + catch (Exception ex) + { IrssLog.Error(ex); + } } - catch (Exception ex) - { - IrssLog.Error(ex); - } } - string[] launchCommand = new string[] { + IrssLog.Info("Launching \"{0}\" ...", _programFile); + + string[] launchCommand = new string[] + { _programFile, Path.GetDirectoryName(_programFile), String.Empty, @@ -466,7 +511,7 @@ false.ToString(), true.ToString(), false.ToString(), - true.ToString() + true.ToString() }; Common.ProcessRunCommand(launchCommand); @@ -477,21 +522,7 @@ MessageBox.Show(ex.Message, "Tray Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - void ClickQuit(object sender, EventArgs e) - { - IrssLog.Info("Quit"); - if (_inConfiguration) - { - IrssLog.Info("In Configuration"); - return; - } - - Stop(); - - Application.Exit(); - } - #endregion Implementation } Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -107,7 +107,7 @@ if (args.Length > 0) // Command Line Start ... { - List<String> virtualButtons = new List<string>(); + List<string> virtualButtons = new List<string>(); try { @@ -148,7 +148,7 @@ if (_registered) { - foreach (String button in virtualButtons) + foreach (string button in virtualButtons) { if (button.StartsWith("~", StringComparison.OrdinalIgnoreCase)) { Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/FocusForcer.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/FocusForcer.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/FocusForcer.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -36,6 +36,38 @@ #region Public Methods + public bool ForceOnce() + { + Process process = Process.GetProcessById(_processId); + if (process == null || process.HasExited) + throw new InvalidOperationException("Cannot force focus, process is not running"); + + _waitHandle = new AutoResetEvent(false); + + try + { + Win32.EnumWindowsProc ewc = new Win32.EnumWindowsProc(CheckWindow); + + int focusedId = Win32.GetForegroundWindowPID(); + if (focusedId != _processId) + { + _windowHandle = IntPtr.Zero; + Win32.EnumerateWindows(ewc, IntPtr.Zero); + + bool waitResult = _waitHandle.WaitOne(5000, false); + if (waitResult && _windowHandle != IntPtr.Zero) + return Win32.SetForegroundWindow(_windowHandle, true); + } + } + finally + { + _waitHandle.Close(); + _waitHandle = null; + } + + return false; + } + /// <summary> /// Forces the process into focus (once). /// </summary> @@ -64,8 +96,7 @@ Win32.EnumerateWindows(ewc, IntPtr.Zero); bool waitResult = _waitHandle.WaitOne(5000, false); - - if (_windowHandle != IntPtr.Zero) + if (waitResult && _windowHandle != IntPtr.Zero) return Win32.SetForegroundWindow(_windowHandle, true); } Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-07-05 12:55:37 UTC (rev 1885) @@ -2250,7 +2250,6 @@ Trace.WriteLine("SetForegroundWindow: Done"); #endif - // We've done all that we can so base our return value on whether we have succeeded or not return (GetForegroundWindow() == hWnd); } Modified: trunk/plugins/IR Server Suite/Documentation/Translator/index.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/Translator/index.html 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Documentation/Translator/index.html 2008-07-05 12:55:37 UTC (rev 1885) @@ -19,7 +19,7 @@ Execute the given macro.</LI> <BR> <LI>-eject [Drive]<BR> -Eject the supplied optical drive.</LI> +Eject the optical drive specified.</LI> <BR> <LI>-shutdown<BR> Request a system shutdown.</LI> @@ -39,12 +39,16 @@ <LI>-osd<BR> Display the Translator On-Screen Display.</LI> <BR> -<LI>-channel [Number] [Padding] [Port]<BR> +<LI>-channel [Number] [Padding] [Port] [Delay]<BR> Blast a series of IR Commands contained within the given channel number.<BR> Use the padding value to specify the minimum size of the channel number.<BR> +You can specify a delay (in milliseconds) between each channel digit.<BR> All blasting will be performed on the specified port.</LI> +<BR> +<LI>-config [Config File]<BR> +Use a specific configuration file.</LI> </UL> -Translator must already be running for command line parameters to be acted on.</P> +Translator must already be running for command line parameters to be acted on (except -config).</P> <IMG SRC="programs.png"> Modified: trunk/plugins/IR Server Suite/Documentation/irblast.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/irblast.html 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Documentation/irblast.html 2008-07-05 12:55:37 UTC (rev 1885) @@ -14,6 +14,7 @@ Use -host to specify the computer that is hosting the IR Server.<BR> Use -port to blast to a particular blaster port (optional).<BR> Use -channel to tell IR Blast to break apart the following IR Command and use each digit for a separate IR blast (optional).<BR> +Use -delay to specify a time to delay between each command or digit in a channel number (Optional).<BR> Use -pad to tell IR Blast to pad channel numbers to a certain length (Optional, Requires -channel).<BR> Use a tilde ~ between commands to insert half second pauses.</P> Modified: trunk/plugins/IR Server Suite/Documentation/new.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/new.html 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Documentation/new.html 2008-07-05 12:55:37 UTC (rev 1885) @@ -28,7 +28,6 @@ <LI>TV3 Blaster Plugin: Fixed a fatal error.</LI> <LI>General: Anywhere that previously took user input for a command and could include escape codes can now also include Environment Variables (including clipboard contents, date, time, and others). See documentation for more info.</LI> <LI>IR Blast: Now defaults to "localhost" if no host is specified on the command line (this will make it simpler to use on most setups).</LI> -<LI>IR Blast: Now has a default delay between blasts of 50 milliseconds, this can be customized by the command line parameter "-delay x", where x is a delay in milliseconds (0 for no delay).</LI> <LI>MP Control plugin: Multi-Mapping command can now jump to a specific mapping set (or "Toggle").</LI> <LI>MediaPortal plugins: New macro commands (Send MP Action and Send MP Message).</LI> <LI>Translator: Can create a shortcut on the users desktop to launch a macro.</LI> @@ -78,6 +77,11 @@ <LI>Input Service: Now enables "Interact with desktop" setting for service, this should get MCE Replacement Driver users the ability to use the Remote Keyboard properly.</LI> <LI>New Input Plugin: Pinnacle Serial Receiver is now supported.</LI> <LI>MP Control Plugin: Fixed remote mapping bug (in plugin configuration).</LI> +<LI>iMon Plugin: Better support for iMon PAD remote when using Abstract Remote Model (thanks to chemelli).</LI> +<LI>Lirc/WinLirc Plugin: Improved support for Lirc/WinLirc (thanks to zaphman). All WinLirc users please test.</LI> +<LI>IR Blast: Corrected documentation and command line help.</LI> +<LI>Translator: Changed "-channel" command line parameter to have four parameters (Channel, Padding, Port, Delay).</LI> +<LI>IR Blast: Now has a default delay between blasts of 250 milliseconds, this can be customized by the command line parameter "-delay x", where x is a delay in milliseconds (0 for no delay).</LI> </UL></P> <BR> Modified: trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml 2008-07-05 12:46:52 UTC (rev 1884) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml 2008-07-05 12:55:37 UTC (rev 1885) @@ -1,5 +1,19 @@ <?xml version="1.0" standalone="yes"?> <DocumentElement> + <RemoteTable RawCode="1002" AbstractButton="Power" /> + <RemoteTable RawCode="1016" AbstractButton="Power2" /> + <RemoteTable RawCode="1064" AbstractButton="Record" /> + <RemoteTable RawCode="1128" AbstractButton="Play" /> + <RemoteTable RawCode="1114" AbstractButton="Eject" /> + <RemoteTable RawCode="1130" AbstractButton="Rewind" /> + <RemoteTable RawCode="1144" AbstractButton="Pause" /> + <RemoteTable RawCode="1192" AbstractButton="FastForward" /> + <RemoteTable RawCode="1208" AbstractButton="NextChapter" /> + <RemoteTable RawCode="1220" AbstractButton="Stop" /> + <RemoteTable RawCode="1066" AbstractButton="PreviousChapter" /> + + <RemoteTable RawCode="1032" AbstractButton="Clear" /> + <RemoteTable RawCode="1148" AbstractButton="OK" /> <RemoteTable RawCode="1038" AbstractButton="VolumeUp" /> <RemoteTable RawCode="1042" AbstractButton="VolumeDown" /> @@ -18,17 +32,6 @@ <RemoteTable RawCode="1214" AbstractButton="Number7" /> <RemoteTable RawCode="1136" AbstractButton="Number8" /> <RemoteTable RawCode="1160" AbstractButton="Number9" /> - <RemoteTable RawCode="1128" AbstractButton="Play" /> - <RemoteTable RawCode="1144" AbstractButton="Pause" /> - <RemoteTable RawCode="1220" AbstractButton="Stop" /> - <RemoteTable RawCode="1192" AbstractButton="FastForward" /> - <RemoteTable RawCode="1130" AbstractButton="Rewind" /> - <RemoteTable RawCode="1064" AbstractButton="Record" /> - <RemoteTable RawCode="1066" AbstractButton="NextChapter" /> - <RemoteTable RawCode="1208" AbstractButton="PreviousChapter" /> - <RemoteTable RawCode="1002" AbstractButton="Power" /> - <RemoteTable RawCode="1016" AbstractButton="Power2" /> - <RemoteTable RawCode="1252" AbstractButton="Clear" /> <RemoteTable RawCode="1034" AbstractButton="Enter" /> <RemoteTable RawCode="1096" AbstractButton="Hash" /> <RemoteTable RawCode="1056" AbstractButton="Star" /> @@ -47,6 +50,5 @@ <RemoteTable RawCode="1230" AbstractButton="Menu" /> <RemoteTable RawCode="1124" AbstractButton="Teletext" /> <RemoteTable RawCode="1198" AbstractButton="Guide" /> - <RemoteTable RawCode="1114" AbstractButton="Eject" /> <RemoteTable RawCode="1150" AbstractButton="Home" /> </DocumentElement> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |