From: <an...@us...> - 2008-03-21 15:43:31
|
Revision: 1493 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1493&view=rev Author: and-81 Date: 2008-03-21 08:43:28 -0700 (Fri, 21 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/Configure.cs trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDriveReceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.cs Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -70,7 +70,7 @@ this.serverToolStripMenuItem}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(504, 24); + this.menuStrip.Size = new System.Drawing.Size(512, 24); this.menuStrip.TabIndex = 0; this.menuStrip.Text = "menuStrip"; // @@ -168,7 +168,7 @@ this.textBoxPronto.Multiline = true; this.textBoxPronto.Name = "textBoxPronto"; this.textBoxPronto.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBoxPronto.Size = new System.Drawing.Size(312, 240); + this.textBoxPronto.Size = new System.Drawing.Size(320, 240); this.textBoxPronto.TabIndex = 1; // // buttonSetCarrier @@ -186,7 +186,7 @@ // checkBoxStoreBinary // this.checkBoxStoreBinary.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.checkBoxStoreBinary.Location = new System.Drawing.Point(336, 248); + this.checkBoxStoreBinary.Location = new System.Drawing.Point(344, 248); this.checkBoxStoreBinary.Name = "checkBoxStoreBinary"; this.checkBoxStoreBinary.Size = new System.Drawing.Size(160, 24); this.checkBoxStoreBinary.TabIndex = 6; @@ -197,7 +197,7 @@ // buttonAttemptDecode // this.buttonAttemptDecode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonAttemptDecode.Location = new System.Drawing.Point(360, 208); + this.buttonAttemptDecode.Location = new System.Drawing.Point(368, 208); this.buttonAttemptDecode.Name = "buttonAttemptDecode"; this.buttonAttemptDecode.Size = new System.Drawing.Size(112, 24); this.buttonAttemptDecode.TabIndex = 5; @@ -222,7 +222,7 @@ // this.buttonLearn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonLearn.Enabled = false; - this.buttonLearn.Location = new System.Drawing.Point(360, 168); + this.buttonLearn.Location = new System.Drawing.Point(368, 168); this.buttonLearn.Name = "buttonLearn"; this.buttonLearn.Size = new System.Drawing.Size(112, 24); this.buttonLearn.TabIndex = 4; @@ -257,7 +257,7 @@ this.groupBoxCarrier.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.groupBoxCarrier.Controls.Add(this.textBoxCarrier); this.groupBoxCarrier.Controls.Add(this.buttonSetCarrier); - this.groupBoxCarrier.Location = new System.Drawing.Point(328, 32); + this.groupBoxCarrier.Location = new System.Drawing.Point(336, 32); this.groupBoxCarrier.Name = "groupBoxCarrier"; this.groupBoxCarrier.Size = new System.Drawing.Size(168, 56); this.groupBoxCarrier.TabIndex = 2; @@ -270,7 +270,7 @@ this.groupBoxTestBlast.Controls.Add(this.buttonBlast); this.groupBoxTestBlast.Controls.Add(this.comboBoxPort); this.groupBoxTestBlast.Enabled = false; - this.groupBoxTestBlast.Location = new System.Drawing.Point(328, 96); + this.groupBoxTestBlast.Location = new System.Drawing.Point(336, 96); this.groupBoxTestBlast.Name = "groupBoxTestBlast"; this.groupBoxTestBlast.Size = new System.Drawing.Size(168, 56); this.groupBoxTestBlast.TabIndex = 3; @@ -292,9 +292,9 @@ // this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabelConnected}); - this.statusStrip.Location = new System.Drawing.Point(0, 283); + this.statusStrip.Location = new System.Drawing.Point(0, 284); this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(504, 22); + this.statusStrip.Size = new System.Drawing.Size(512, 22); this.statusStrip.TabIndex = 7; this.statusStrip.Text = "statusStrip"; // @@ -302,7 +302,7 @@ // this.toolStripStatusLabelConnected.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripStatusLabelConnected.Name = "toolStripStatusLabelConnected"; - this.toolStripStatusLabelConnected.Size = new System.Drawing.Size(489, 17); + this.toolStripStatusLabelConnected.Size = new System.Drawing.Size(497, 17); this.toolStripStatusLabelConnected.Spring = true; this.toolStripStatusLabelConnected.Text = "Not connected"; this.toolStripStatusLabelConnected.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -311,7 +311,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(504, 305); + this.ClientSize = new System.Drawing.Size(512, 306); this.Controls.Add(this.statusStrip); this.Controls.Add(this.buttonLearn); this.Controls.Add(this.groupBoxTestBlast); @@ -322,7 +322,7 @@ this.Controls.Add(this.menuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip; - this.MinimumSize = new System.Drawing.Size(512, 332); + this.MinimumSize = new System.Drawing.Size(520, 332); this.Name = "FormMain"; this.Text = "IR File Tool"; this.menuStrip.ResumeLayout(false); Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -195,9 +195,18 @@ SourceGrid.CellContext context = (SourceGrid.CellContext)sender; SourceGrid.Cells.Button cell = (SourceGrid.Cells.Button)context.Cell; - IConfigure plugin = cell.Row.Tag as IConfigure; - if (plugin != null) - plugin.Configure(this); + try + { + IConfigure plugin = cell.Row.Tag as IConfigure; + if (plugin != null) + plugin.Configure(this); + } + catch (Exception ex) + { + IrssLog.Error(ex); + + MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void TransmitChanged(object sender, EventArgs e) { Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -1908,6 +1908,7 @@ int nMaxCount); [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] static extern bool IsChild( IntPtr hWndParent, IntPtr hWndChild); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -129,7 +129,12 @@ { listViewPlugins.Clear(); - string[] files = Directory.GetFiles(textBoxPluginFolder.Text, "*.dll", SearchOption.TopDirectoryOnly); + string folder = textBoxPluginFolder.Text; + + if (String.IsNullOrEmpty(folder)) + return; + + string[] files = Directory.GetFiles(folder, "*.dll", SearchOption.TopDirectoryOnly); if (files.Length > 0) foreach (string file in files) listViewPlugins.Items.Add(Path.GetFileName(file)); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -261,8 +261,13 @@ #region Interop - [DllImport("kernel32", CharSet = CharSet.Auto)] - extern static IntPtr LoadLibrary( + [DllImport("kernel32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool SetDllDirectory( + string lpPathName); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + static extern IntPtr LoadLibrary( string dllFileName); [DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)] @@ -270,9 +275,9 @@ IntPtr module, string functionName); - [DllImport("kernel32")] + [DllImport("kernel32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - extern static bool FreeLibrary( + static extern bool FreeLibrary( IntPtr handle); #endregion Interop @@ -1111,6 +1116,10 @@ bool LoadGirderPlugin(string girderPluginFile) { + string folder = Path.GetDirectoryName(girderPluginFile); + string parent = Directory.GetParent(folder).FullName; + SetDllDirectory(parent); + _pluginDll = LoadLibrary(girderPluginFile); if (_pluginDll == IntPtr.Zero) throw new InvalidOperationException(String.Format("Failed to call LoadLibrary on girder plugin dll ({0})", girderPluginFile)); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/Configure.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/Configure.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -39,34 +39,52 @@ #region Properties + /// <summary> + /// Gets or sets the index of the device. + /// </summary> + /// <value>The index of the device.</value> public int DeviceIndex { - get { return comboBoxDevice.SelectedIndex; } - set { comboBoxDevice.SelectedIndex = value; } + get + { + return comboBoxDevice.SelectedIndex; + } + set + { + if (comboBoxDevice.Items.Count > value) + comboBoxDevice.SelectedIndex = value; + } } #endregion Properties #region Constructor + /// <summary> + /// Initializes a new instance of the <see cref="Configure"/> class. + /// </summary> public Configure() { InitializeComponent(); -/* + + // TODO: Finish the LiveDrive support! + MidiInCaps midiInCaps = new MidiInCaps(); ASCIIEncoding encoder = new ASCIIEncoding(); - for (int i = 0; i < m_lirPlugin.MIDIDeviceCount; i++) + for (int i = 0; i < LiveDriveReceiver.midiInGetNumDevs(); i++) { if (midiInGetDevCaps(i, ref midiInCaps, Marshal.SizeOf(typeof(MidiInCaps))) == 0) { string strName = encoder.GetString(midiInCaps.szPname); int intNullIndex = strName.IndexOf((char)0); strName = strName.Remove(intNullIndex, MidiInCaps.MAXPNAMELEN - intNullIndex); - cbxDevices.Items.Add(new MIDIDevice(strName, i)); + + comboBoxDevice.Items.Add(strName); + + //cbxDevices.Items.Add(new MIDIDevice(strName, i)); } } - */ } #endregion Constructor Modified: trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDriveReceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDriveReceiver.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/IR Server Plugins/LiveDrive Receiver/LiveDriveReceiver.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -24,7 +24,7 @@ #region Interop [DllImport("winmm.dll")] - static extern int midiInGetNumDevs(); + internal static extern int midiInGetNumDevs(); [DllImport("winmm.dll")] static extern uint midiInOpen(ref int lphMidiIn, int uDeviceID, MidiInProc dwCallback, int dwInstance, Int64 dwFlags); @@ -249,7 +249,7 @@ Marshal.FreeHGlobal(_midiHeader.data); while ((error = midiInClose(_midiInHandle)) == MIDIERR_STILLPLAYING) - Thread.Sleep(5); + Thread.Sleep(50); } /// <summary> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Driver.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -390,8 +390,11 @@ { try { +#if TEST_APPLICATION + string path = fileName; +#else string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), String.Format("IR Server Suite\\Logs\\{0}", fileName)); - +#endif _debugFile = new StreamWriter(path, false); _debugFile.AutoFlush = true; } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -1,5 +1,3 @@ -//#define TEST_APPLICATION - using System; using System.Collections; using System.Collections.Generic; @@ -55,6 +53,7 @@ public class MicrosoftMceTransceiver : PluginBase, IConfigure, ITransmitIR, ILearnIR, IRemoteReceiver, IKeyboardReceiver, IMouseReceiver { + // #define TEST_APPLICATION in the project properties when creating the console test app ... #if TEST_APPLICATION static MicrosoftMceTransceiver device; Modified: trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.cs 2008-03-21 07:24:54 UTC (rev 1492) +++ trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.cs 2008-03-21 15:43:28 UTC (rev 1493) @@ -182,9 +182,18 @@ SourceGrid.CellContext context = (SourceGrid.CellContext)sender; SourceGrid.Cells.Button cell = (SourceGrid.Cells.Button)context.Cell; - IConfigure plugin = cell.Row.Tag as IConfigure; - if (plugin != null) - plugin.Configure(this); + try + { + IConfigure plugin = cell.Row.Tag as IConfigure; + if (plugin != null) + plugin.Configure(this); + } + catch (Exception ex) + { + IrssLog.Error(ex); + + MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void TransmitChanged(object sender, EventArgs e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |