From: <an...@us...> - 2008-03-08 14:19:20
|
Revision: 1439 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1439&view=rev Author: and-81 Date: 2008-03-08 06:19:16 -0800 (Sat, 08 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs trunk/plugins/IR Server Suite/Applications/IR Server/Config.Designer.cs trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs trunk/plugins/IR Server Suite/Applications/IR Server/Config.resx trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.Designer.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.Designer.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Configuration.csproj Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Advanced.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -60,7 +60,7 @@ { get { - return comboBoxPriority.SelectedText; + return comboBoxPriority.SelectedItem as string; } set { @@ -133,7 +133,6 @@ } #endregion Controls - } Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Config.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Config.Designer.cs 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Config.Designer.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -47,7 +47,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(352, 304); + this.buttonOK.Location = new System.Drawing.Point(360, 272); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(64, 24); this.buttonOK.TabIndex = 2; @@ -59,7 +59,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(424, 304); + this.buttonCancel.Location = new System.Drawing.Point(432, 272); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(64, 24); this.buttonCancel.TabIndex = 3; @@ -71,7 +71,7 @@ // this.checkBoxRunAtBoot.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.checkBoxRunAtBoot.AutoSize = true; - this.checkBoxRunAtBoot.Location = new System.Drawing.Point(16, 304); + this.checkBoxRunAtBoot.Location = new System.Drawing.Point(16, 272); this.checkBoxRunAtBoot.Name = "checkBoxRunAtBoot"; this.checkBoxRunAtBoot.Size = new System.Drawing.Size(165, 17); this.checkBoxRunAtBoot.TabIndex = 1; @@ -87,7 +87,7 @@ this.groupBoxTransceiver.Controls.Add(this.gridPlugins); this.groupBoxTransceiver.Location = new System.Drawing.Point(8, 32); this.groupBoxTransceiver.Name = "groupBoxTransceiver"; - this.groupBoxTransceiver.Size = new System.Drawing.Size(480, 264); + this.groupBoxTransceiver.Size = new System.Drawing.Size(488, 232); this.groupBoxTransceiver.TabIndex = 0; this.groupBoxTransceiver.TabStop = false; this.groupBoxTransceiver.Text = "Device plugins"; @@ -103,7 +103,7 @@ this.gridPlugins.Name = "gridPlugins"; this.gridPlugins.OptimizeMode = SourceGrid.CellOptimizeMode.ForRows; this.gridPlugins.SelectionMode = SourceGrid.GridSelectionMode.Row; - this.gridPlugins.Size = new System.Drawing.Size(464, 240); + this.gridPlugins.Size = new System.Drawing.Size(472, 208); this.gridPlugins.TabIndex = 0; this.gridPlugins.TabStop = true; this.gridPlugins.ToolTipText = ""; @@ -116,7 +116,7 @@ this.toolStripButtonHelp}); this.toolStrip.Location = new System.Drawing.Point(0, 0); this.toolStrip.Name = "toolStrip"; - this.toolStrip.Size = new System.Drawing.Size(496, 25); + this.toolStrip.Size = new System.Drawing.Size(504, 25); this.toolStrip.TabIndex = 4; // // toolStripButtonDetect @@ -151,16 +151,18 @@ // // Config // + this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(496, 343); + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(504, 304); this.Controls.Add(this.toolStrip); this.Controls.Add(this.checkBoxRunAtBoot); this.Controls.Add(this.groupBoxTransceiver); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOK); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(504, 370); + this.MinimumSize = new System.Drawing.Size(480, 298); this.Name = "Config"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "IR Server - Configuration"; Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -32,9 +32,10 @@ PluginBase[] _transceivers; - bool _abstractRemoteMode; - IRServerMode _mode = IRServerMode.ServerMode; - string _hostComputer = String.Empty; + bool _abstractRemoteMode = false; + IRServerMode _mode = IRServerMode.ServerMode; + string _hostComputer = String.Empty; + string _processPriority = String.Empty; #endregion Variables @@ -55,6 +56,11 @@ get { return _hostComputer; } set { _hostComputer = value; } } + public string ProcessPriority + { + get { return _processPriority; } + set { _processPriority = value; } + } public string[] PluginReceive { @@ -253,7 +259,7 @@ SourceGrid.Cells.ColumnHeader header = new SourceGrid.Cells.ColumnHeader(" "); header.AutomaticSortEnabled = false; gridPlugins[row, ColIcon] = header; - + gridPlugins[row, ColName] = new SourceGrid.Cells.ColumnHeader("Name"); gridPlugins[row, ColReceive] = new SourceGrid.Cells.ColumnHeader("Receive"); gridPlugins[row, ColTransmit] = new SourceGrid.Cells.ColumnHeader("Transmit"); @@ -367,14 +373,16 @@ Advanced advanced = new Advanced(); advanced.AbstractRemoteMode = _abstractRemoteMode; - advanced.Mode = _mode; - advanced.HostComputer = _hostComputer; + advanced.Mode = _mode; + advanced.HostComputer = _hostComputer; + advanced.ProcessPriority = _processPriority; if (advanced.ShowDialog(this) == DialogResult.OK) { _abstractRemoteMode = advanced.AbstractRemoteMode; - _mode = advanced.Mode; - _hostComputer = advanced.HostComputer; + _mode = advanced.Mode; + _hostComputer = advanced.HostComputer; + _processPriority = advanced.ProcessPriority; } } void ShowHelp() Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Config.resx =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Config.resx 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Config.resx 2008-03-08 14:19:16 UTC (rev 1439) @@ -121,7 +121,7 @@ <value>17, 17</value> </metadata> <metadata name="toolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>200, 17</value> + <value>107, 17</value> </metadata> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Diagnostics; using System.IO; using System.Net; using System.Net.Sockets; @@ -68,6 +69,7 @@ bool _abstractRemoteMode; IRServerMode _mode; string _hostComputer; + string _processPriority; string[] _pluginNameReceive; List<PluginBase> _pluginReceive; @@ -161,6 +163,25 @@ LoadSettings(); + #region Process Priority Adjustment + + if (!_processPriority.Equals("No Change", StringComparison.OrdinalIgnoreCase)) + { + try + { + ProcessPriorityClass priority = (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), _processPriority); + Process.GetCurrentProcess().PriorityClass = priority; + + IrssLog.Info("Process priority set to: {0}", _processPriority); + } + catch (Exception ex) + { + IrssLog.Error(ex); + } + } + + #endregion Process Priority Adjustment + #region Load plugin(s) _pluginReceive = null; @@ -344,7 +365,6 @@ _abstractRemoteButtons = new DataSet("AbstractRemoteButtons"); _abstractRemoteButtons.CaseSensitive = true; - List<string> receivers = new List<string>(_pluginReceive.Count); foreach (PluginBase plugin in _pluginReceive) if (plugin is IRemoteReceiver) LoadAbstractDeviceFiles(plugin.Name); @@ -471,24 +491,30 @@ try { - Config config = new Config(); - config.Mode = _mode; - config.HostComputer = _hostComputer; - config.PluginReceive = _pluginNameReceive; - config.PluginTransmit = _pluginNameTransmit; + Config config = new Config(); + config.AbstractRemoteMode = _abstractRemoteMode; + config.Mode = _mode; + config.HostComputer = _hostComputer; + config.ProcessPriority = _processPriority; + config.PluginReceive = _pluginNameReceive; + config.PluginTransmit = _pluginNameTransmit; if (config.ShowDialog() == DialogResult.OK) { - if ((_mode != config.Mode) || - (_hostComputer != config.HostComputer) || - (_pluginNameReceive != config.PluginReceive) || + if ((_abstractRemoteMode != config.AbstractRemoteMode) || + (_mode != config.Mode) || + (_hostComputer != config.HostComputer) || + (_processPriority != config.ProcessPriority) || + (_pluginNameReceive != config.PluginReceive) || (_pluginNameTransmit != config.PluginTransmit) ) { Stop(); // Shut down communications // Change settings ... + _abstractRemoteMode = config.AbstractRemoteMode; _mode = config.Mode; _hostComputer = config.HostComputer; + _processPriority = config.ProcessPriority; _pluginNameReceive = config.PluginReceive; _pluginNameTransmit = config.PluginTransmit; @@ -653,7 +679,7 @@ StopClient(); - MessageBox.Show("Please report this error.", "IR Server - Communications failure", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Please report this error", "IR Server - Communications failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } void Connected(object obj) { @@ -1190,29 +1216,33 @@ // If the remote maps are not already loaded for this device then attempt to load them if (!foundDevice) - LoadAbstractDeviceFiles(deviceName); + foundDevice = LoadAbstractDeviceFiles(deviceName); - // Find abstract button mapping - string abstractButton = LookupAbstractButton(deviceName, keyCode); - if (String.IsNullOrEmpty(abstractButton)) + // If the device map is loaded then try to convert the button to abstract + if (foundDevice) { - IrssLog.Info("Abstract Remote Button mapped from forwarded remote event: {0}", abstractButton); + // Find abstract button mapping + string abstractButton = LookupAbstractButton(deviceName, keyCode); + if (String.IsNullOrEmpty(abstractButton)) + { + IrssLog.Info("Abstract Remote Button mapped from forwarded remote event: {0}", abstractButton); - // Encode new message ... - byte[] deviceNameBytes = Encoding.ASCII.GetBytes("Abstract"); - byte[] keyCodeBytes = Encoding.ASCII.GetBytes(abstractButton); + // Encode new message ... + byte[] deviceNameBytes = Encoding.ASCII.GetBytes("Abstract"); + byte[] keyCodeBytes = Encoding.ASCII.GetBytes(abstractButton); - data = new byte[8 + deviceNameBytes.Length + keyCodeBytes.Length]; + data = new byte[8 + deviceNameBytes.Length + keyCodeBytes.Length]; - BitConverter.GetBytes(deviceNameBytes.Length).CopyTo(data, 0); - deviceNameBytes.CopyTo(data, 4); - BitConverter.GetBytes(keyCodeBytes.Length).CopyTo(data, 4 + deviceNameBytes.Length); - keyCodeBytes.CopyTo(data, 8 + deviceNameBytes.Length); + BitConverter.GetBytes(deviceNameBytes.Length).CopyTo(data, 0); + deviceNameBytes.CopyTo(data, 4); + BitConverter.GetBytes(keyCodeBytes.Length).CopyTo(data, 4 + deviceNameBytes.Length); + keyCodeBytes.CopyTo(data, 8 + deviceNameBytes.Length); + } + else + { + IrssLog.Info("Abstract Remote Button not found for forwarded remote event: {0} ({1})", deviceName, keyCode); + } } - else - { - IrssLog.Info("Abstract Remote Button not found for forwarded remote event: {0} ({1})", deviceName, keyCode); - } } IrssMessage forward = new IrssMessage(MessageType.RemoteEvent, MessageFlags.Notify, data); @@ -1624,6 +1654,7 @@ _abstractRemoteMode = false; _mode = IRServerMode.ServerMode; _hostComputer = String.Empty; + _processPriority = "No Change"; _pluginNameReceive = null; _pluginNameTransmit = String.Empty; @@ -1664,6 +1695,9 @@ try { _hostComputer = doc.DocumentElement.Attributes["HostComputer"].Value; } catch (Exception ex) { IrssLog.Warn(ex.ToString()); } + try { _processPriority = doc.DocumentElement.Attributes["ProcessPriority"].Value; } + catch (Exception ex) { IrssLog.Warn(ex.ToString()); } + try { _pluginNameTransmit = doc.DocumentElement.Attributes["PluginTransmit"].Value; } catch (Exception ex) { IrssLog.Warn(ex.ToString()); } @@ -1693,6 +1727,7 @@ writer.WriteAttributeString("AbstractRemoteMode", _abstractRemoteMode.ToString()); writer.WriteAttributeString("Mode", Enum.GetName(typeof(IRServerMode), _mode)); writer.WriteAttributeString("HostComputer", _hostComputer); + writer.WriteAttributeString("ProcessPriority", _processPriority); writer.WriteAttributeString("PluginTransmit", _pluginNameTransmit); if (_pluginNameReceive != null) @@ -1763,10 +1798,10 @@ DataRow[] rows = table.Select(expression); if (rows.Length == 1) { - string button = rows[0]["AbstractButton"].ToString() as string; + string button = rows[0]["AbstractButton"] as string; if (!String.IsNullOrEmpty(button)) { - IrssLog.Debug(button + ", remote: " + table.ExtendedProperties["Remote"] as string + ", device: " + deviceName); + IrssLog.Debug("{0}, remote: {1}, device: {2}", button, table.ExtendedProperties["Remote"] as string, deviceName); return button; } } @@ -1779,34 +1814,49 @@ } return null; - //return String.Format("{0} ({1})", deviceName, keyCode); } - void LoadAbstractDeviceFiles(string device) + bool LoadAbstractDeviceFiles(string device) { + if (String.IsNullOrEmpty(device)) + return false; + string path = Path.Combine(AbstractRemoteMapFolder, device); - string[] files = Directory.GetFiles(path, "*.xml", SearchOption.TopDirectoryOnly); - foreach (string file in files) + if (Directory.Exists(path)) + return false; + + try { - string remote = Path.GetFileNameWithoutExtension(file); - string tableName = String.Format("{0}:{1}", device, remote); - if (_abstractRemoteButtons.Tables.Contains(tableName)) + string[] files = Directory.GetFiles(path, "*.xml", SearchOption.TopDirectoryOnly); + foreach (string file in files) { - IrssLog.Warn("Abstract Remote Table already loaded ({0})", tableName); - continue; - } + string remote = Path.GetFileNameWithoutExtension(file); + string tableName = String.Format("{0}:{1}", device, remote); + if (_abstractRemoteButtons.Tables.Contains(tableName)) + { + IrssLog.Warn("Abstract Remote Table already loaded ({0})", tableName); + continue; + } - DataTable table = _abstractRemoteButtons.Tables.Add("RemoteTable"); - table.ReadXmlSchema(AbstractRemoteSchemaFile); - table.ReadXml(file); + DataTable table = _abstractRemoteButtons.Tables.Add("RemoteTable"); + table.ReadXmlSchema(AbstractRemoteSchemaFile); + table.ReadXml(file); - table.ExtendedProperties.Add("Device", device); - table.ExtendedProperties.Add("Remote", remote); + table.ExtendedProperties.Add("Device", device); + table.ExtendedProperties.Add("Remote", remote); - table.TableName = tableName; + table.TableName = tableName; - IrssLog.Info("Abstract Remote Table ({0}) loaded", tableName); + IrssLog.Info("Abstract Remote Table ({0}) loaded", tableName); + } } + catch (Exception ex) + { + IrssLog.Error(ex); + return false; + } + + return true; } #endregion Implementation Modified: trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.Designer.cs 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.Designer.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -227,8 +227,10 @@ // // Advanced // + this.AcceptButton = this.buttonOK; 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(400, 304); this.Controls.Add(this.groupBoxPriority); this.Controls.Add(this.groupBoxAbstractRemoteModel); 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-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Advanced.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -1,8 +1,8 @@ using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; -using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; @@ -60,7 +60,7 @@ { get { - return comboBoxPriority.SelectedText; + return comboBoxPriority.SelectedItem as string; } set { @@ -103,6 +103,7 @@ private void buttonExclusions_Click(object sender, EventArgs e) { + /* Exclusions exclusions = new Exclusions(new string[] { "plugin1", "plugin2", "plugin3" }); exclusions.ExclusionList = new string[] { "plugin1" }; @@ -110,6 +111,7 @@ { } + */ } private void radioButtonServer_CheckedChanged(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.Designer.cs 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.Designer.cs 2008-03-08 14:19:16 UTC (rev 1439) @@ -138,15 +138,17 @@ // // Config // + this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(504, 305); + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(504, 304); this.Controls.Add(this.toolStrip); this.Controls.Add(this.groupBoxTransceiver); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOK); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(512, 332); + this.MinimumSize = new System.Drawing.Size(480, 298); this.Name = "Config"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Input Service Configuration"; Modified: trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Configuration.csproj =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Configuration.csproj 2008-03-08 13:49:45 UTC (rev 1438) +++ trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Configuration.csproj 2008-03-08 14:19:16 UTC (rev 1439) @@ -70,12 +70,6 @@ <Compile Include="Config.Designer.cs"> <DependentUpon>Config.cs</DependentUpon> </Compile> - <Compile Include="Exclusions.cs"> - <SubType>Form</SubType> - </Compile> - <Compile Include="Exclusions.Designer.cs"> - <DependentUpon>Exclusions.cs</DependentUpon> - </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\Resources.Designer.cs"> @@ -91,10 +85,6 @@ <DependentUpon>Config.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> - <EmbeddedResource Include="Exclusions.resx"> - <SubType>Designer</SubType> - <DependentUpon>Exclusions.cs</DependentUpon> - </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <SubType>Designer</SubType> <Generator>ResXFileCodeGenerator</Generator> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |