From: <an...@us...> - 2008-03-13 15:48:44
|
Revision: 1459 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1459&view=rev Author: and-81 Date: 2008-03-13 08:48:42 -0700 (Thu, 13 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs trunk/plugins/IR Server Suite/Documentation/new.html trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.cs Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -12,6 +12,9 @@ namespace IRServer { + /// <summary> + /// Advanced Configuration Form. + /// </summary> partial class Advanced : Form { @@ -66,7 +69,6 @@ { comboBoxPriority.SelectedItem = value; } - } #endregion Properties Modified: trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Applications/Translator/Configuration.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -20,6 +20,7 @@ #region Variables string _serverHost; + string _processPriority; List<ButtonMapping> _systemWideMappings; List<ProgramSettings> _programSettings; @@ -32,6 +33,7 @@ /// <summary> /// IR Server host. /// </summary> + /// <value>The server host.</value> [XmlElement] public string ServerHost { @@ -40,8 +42,20 @@ } /// <summary> + /// Gets or sets the process priority. + /// </summary> + /// <value>The process priority.</value> + [XmlElement] + public string ProcessPriority + { + get { return _processPriority; } + set { _processPriority = value; } + } + + /// <summary> /// System wide button mappings. /// </summary> + /// <value>The system wide mappings.</value> [XmlArray] public List<ButtonMapping> SystemWideMappings { @@ -51,6 +65,7 @@ /// <summary> /// Program settings. /// </summary> + /// <value>The programs.</value> [XmlArray] public List<ProgramSettings> Programs { @@ -60,6 +75,7 @@ /// <summary> /// Mapped events. /// </summary> + /// <value>The events.</value> [XmlArray] public List<MappedEvent> Events { @@ -75,11 +91,12 @@ /// </summary> public Configuration() { - _serverHost = "localhost"; + _serverHost = "localhost"; + _processPriority = "No Change"; _systemWideMappings = new List<ButtonMapping>(); - _programSettings = new List<ProgramSettings>(); - _mappedEvents = new List<MappedEvent>(); + _programSettings = new List<ProgramSettings>(); + _mappedEvents = new List<MappedEvent>(); } #endregion Constructors Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.Designer.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.Designer.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -105,6 +105,7 @@ this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); + this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStripButtonMapping.SuspendLayout(); this.tabControl.SuspendLayout(); this.tabPagePrograms.SuspendLayout(); @@ -771,6 +772,7 @@ this.exportToolStripMenuItem, this.toolStripSeparator1, this.serverToolStripMenuItem, + this.advancedToolStripMenuItem, this.toolStripSeparator2, this.quitToolStripMenuItem}); this.configurationToolStripMenuItem.Name = "configurationToolStripMenuItem"; @@ -780,52 +782,52 @@ // newToolStripMenuItem // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newToolStripMenuItem.Text = "&New"; this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); // // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.openToolStripMenuItem.Text = "&Open ..."; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // // importToolStripMenuItem // this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.importToolStripMenuItem.Text = "&Import ..."; this.importToolStripMenuItem.Click += new System.EventHandler(this.importToolStripMenuItem_Click); // // exportToolStripMenuItem // this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exportToolStripMenuItem.Text = "&Export ..."; this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(129, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // serverToolStripMenuItem // this.serverToolStripMenuItem.Name = "serverToolStripMenuItem"; - this.serverToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.serverToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.serverToolStripMenuItem.Text = "&Server ..."; this.serverToolStripMenuItem.Click += new System.EventHandler(this.serverToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(129, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); // // quitToolStripMenuItem // this.quitToolStripMenuItem.Name = "quitToolStripMenuItem"; - this.quitToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.quitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.quitToolStripMenuItem.Text = "&Quit"; this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitToolStripMenuItem_Click); // @@ -841,14 +843,14 @@ // translatorHelpToolStripMenuItem // this.translatorHelpToolStripMenuItem.Name = "translatorHelpToolStripMenuItem"; - this.translatorHelpToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.translatorHelpToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.translatorHelpToolStripMenuItem.Text = "&Contents"; this.translatorHelpToolStripMenuItem.Click += new System.EventHandler(this.translatorHelpToolStripMenuItem_Click); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.aboutToolStripMenuItem.Text = "&About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // @@ -861,6 +863,13 @@ this.saveFileDialog.Filter = "XML Files|*.xml"; this.saveFileDialog.Title = "Export settings ..."; // + // advancedToolStripMenuItem + // + this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem"; + this.advancedToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.advancedToolStripMenuItem.Text = "&Advanced ..."; + this.advancedToolStripMenuItem.Click += new System.EventHandler(this.advancedToolStripMenuItem_Click); + // // MainForm // this.AcceptButton = this.buttonOK; @@ -980,6 +989,7 @@ private System.Windows.Forms.Label labelProgramsEdit; private System.Windows.Forms.Label labelProgramsAdd; private System.Windows.Forms.ToolStripMenuItem remapButtonToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem advancedToolStripMenuItem; } } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -1167,6 +1167,21 @@ Program.StartClient(endPoint); } } + private void advancedToolStripMenuItem_Click(object sender, EventArgs e) + { + Advanced advanced = new Advanced(); + advanced.ProcessPriority = Program.Config.ProcessPriority; + + if (advanced.ShowDialog(this) == DialogResult.OK) + { + if (!advanced.ProcessPriority.Equals(Program.Config.ProcessPriority, StringComparison.OrdinalIgnoreCase)) + { + Program.Config.ProcessPriority = advanced.ProcessPriority; + + Program.AdjustPriority(Program.Config.ProcessPriority); + } + } + } private void quitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -127,13 +127,17 @@ // Initialize Variable List. _variables = new VariableList(); + // Load configuration ... _config = Configuration.Load(ConfigFile); if (_config == null) { IrssLog.Warn(String.Format("Failed to load configuration file ({0}), creating new configuration", ConfigFile)); _config = new Configuration(); } - + + // Adjust process priority ... + AdjustPriority(_config.ProcessPriority); + /* foreach (ProgramSettings progSettings in _config.Programs) { @@ -1243,6 +1247,28 @@ } } + /// <summary> + /// Adjusts the process priority. + /// </summary> + /// <param name="newPriority">The new priority.</param> + internal static void AdjustPriority(string newPriority) + { + if (!newPriority.Equals("No Change", StringComparison.OrdinalIgnoreCase)) + { + try + { + ProcessPriorityClass priority = (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), newPriority); + Process.GetCurrentProcess().PriorityClass = priority; + + IrssLog.Info("Process priority set to: {0}", newPriority); + } + catch (Exception ex) + { + IrssLog.Error(ex); + } + } + } + #endregion Implementation } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2008-03-13 15:48:42 UTC (rev 1459) @@ -69,6 +69,12 @@ <Compile Include="ButtonMapping.cs" /> <Compile Include="Configuration.cs" /> <Compile Include="AppProfile.cs" /> + <Compile Include="Forms\Advanced.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Forms\Advanced.Designer.cs"> + <DependentUpon>Advanced.cs</DependentUpon> + </Compile> <Compile Include="Forms\ButtonMappingForm.cs"> <SubType>Form</SubType> </Compile> @@ -110,6 +116,10 @@ <Compile Include="Program.cs" /> <Compile Include="ProgramSettings.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <EmbeddedResource Include="Forms\Advanced.resx"> + <DependentUpon>Advanced.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="Forms\ButtonMappingForm.resx"> <SubType>Designer</SubType> <DependentUpon>ButtonMappingForm.cs</DependentUpon> Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj 2008-03-13 15:48:42 UTC (rev 1459) @@ -91,6 +91,12 @@ <Compile Include="Forms\CloseProgramCommand.Designer.cs"> <DependentUpon>CloseProgramCommand.cs</DependentUpon> </Compile> + <Compile Include="Forms\WindowCommand.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Forms\WindowCommand.Designer.cs"> + <DependentUpon>WindowCommand.cs</DependentUpon> + </Compile> <Compile Include="Forms\DisplayPowerCommand.cs"> <SubType>Form</SubType> </Compile> @@ -253,6 +259,10 @@ <DependentUpon>CloseProgramCommand.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="Forms\WindowCommand.resx"> + <DependentUpon>WindowCommand.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="Forms\DisplayPowerCommand.resx"> <DependentUpon>DisplayPowerCommand.cs</DependentUpon> <SubType>Designer</SubType> Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -1720,13 +1720,13 @@ public string szTypeName; }; - private struct POINTAPI + struct POINTAPI { public int x; public int y; } - private struct RECT + struct RECT { public int left; public int top; @@ -1734,7 +1734,7 @@ public int bottom; } - private struct WINDOWPLACEMENT + struct WINDOWPLACEMENT { public int length; public int flags; @@ -2158,7 +2158,7 @@ int curThreadID = GetCurrentThreadId(); - // if we don't attach successfully to the windows thread then we're out of options + // If we don't attach successfully to the windows thread then we're out of options if (!AttachThreadInput(curThreadID, fgWindowPID, true)) return false; @@ -2166,9 +2166,10 @@ BringWindowToTop(hWnd); SetFocus(hWnd); + // Detach AttachThreadInput(curThreadID, fgWindowPID, false); - // we've done all that we can so base our return value on whether we have succeeded or not + // 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/new.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/new.html 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Documentation/new.html 2008-03-13 15:48:42 UTC (rev 1459) @@ -55,6 +55,7 @@ <LI>Installer: Fixed a registry setting so that Input Service should autoconfigure correctly from now on.</LI> <LI>Direct Input Plugin: Fixed a detection and configuration bug.</LI> <LI>Translator: Fixed a critical bug.</LI> +<LI>Translator: Added process priority adjustment (under the new Advanced configuration menu item).</LI> </UL></P> <BR> Modified: trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.cs =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.cs 2008-03-13 11:34:33 UTC (rev 1458) +++ trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.cs 2008-03-13 15:48:42 UTC (rev 1459) @@ -12,6 +12,9 @@ namespace InputService.Configuration { + /// <summary> + /// Advanced Configuration Form. + /// </summary> partial class Advanced : Form { @@ -66,7 +69,6 @@ { comboBoxPriority.SelectedItem = value; } - } #endregion Properties This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |