From: <an...@us...> - 2008-03-06 14:49:28
|
Revision: 1431 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1431&view=rev Author: and-81 Date: 2008-03-06 06:49:18 -0800 (Thu, 06 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.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/PopupMessage.cs trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLirc Transceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLircServer.cs trunk/plugins/IR Server Suite/IR Server Plugins/Windows Message Receiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi trunk/plugins/IR Server Suite/IR Server Suite - Release.nsi trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.Designer.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/InputMapper/InputHandler.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/PluginSetup.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/TV3BlasterPlugin.cs trunk/plugins/MCEReplacement/Forms/SetupForm.Designer.cs trunk/plugins/MCEReplacement/Forms/SetupForm.cs trunk/plugins/MCEReplacement/InputMapper/InputHandler.cs trunk/plugins/MCEReplacement/InputMapper/InputMappingForm.cs trunk/plugins/MCEReplacement/MCEReplacement.cs trunk/plugins/ShortcutFileSupport/LnkPlayer.cs Added Paths: ----------- trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/IR507/ trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/IR507/RC102.xml Modified: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -45,6 +45,7 @@ static string _userName; static string _password; static StbBoxType _boxType; + static int _timeout; static string _url; static DataTable _tvBouquets; @@ -101,6 +102,7 @@ setup.UserName = _userName; setup.Password = _password; setup.BoxType = _boxType; + setup.Timeout = _timeout; if (setup.ShowDialog() == DialogResult.OK) { @@ -108,6 +110,7 @@ _userName = setup.UserName; _password = setup.Password; _boxType = setup.BoxType; + _timeout = setup.Timeout; SaveSettings(); Info("Setup saved"); @@ -204,6 +207,7 @@ _userName = doc.DocumentElement.Attributes["UserName"].Value; _password = doc.DocumentElement.Attributes["Password"].Value; _boxType = (StbBoxType)Enum.Parse(typeof(StbBoxType), doc.DocumentElement.Attributes["BoxType"].Value); + _timeout = int.Parse(doc.DocumentElement.Attributes["Timeout"].Value); } catch (FileNotFoundException) { @@ -234,6 +238,7 @@ writer.WriteAttributeString("UserName", _userName); writer.WriteAttributeString("Password", _password); writer.WriteAttributeString("BoxType", Enum.GetName(typeof(StbBoxType), _boxType)); + writer.WriteAttributeString("Timeout", _timeout.ToString()); writer.WriteEndElement(); // </settings> writer.WriteEndDocument(); @@ -246,22 +251,23 @@ } static void CreateDefaultSettings() { - _address = "192.168.0.100"; + _address = "192.168.0.100"; _userName = "root"; _password = "dbox2"; - _boxType = StbBoxType.Unknown; + _boxType = StbBoxType.Unknown; + _timeout = 2000; SaveSettings(); } - internal static string PostData(string url, string userName, string password, StbBoxType boxType, string command) + internal static string PostData(string url, string userName, string password, StbBoxType boxType, int timeout, string command) { try { Uri uri = new Uri(url + command); WebRequest request = WebRequest.Create(uri); request.Credentials = new NetworkCredential(userName, password); - request.Timeout = 2000; + request.Timeout = timeout; // back to iso encoding sorry , should work anywhere in EU // which it doesn't, because dreambox use utf-8 encoding, making all UTF-8 extended characters a multibyte garble if we encode those to iso @@ -283,7 +289,7 @@ } } - internal static DataSet GetData(string url, string userName, string password, StbBoxType boxType) + internal static DataSet GetData(string url, string userName, string password, StbBoxType boxType, int timeout) { DataSet ds = new DataSet(); @@ -298,10 +304,10 @@ { case StbBoxType.EnigmaV1: // get userbouquets (ref=4097:7:0:6:0:0:0:0:0:0:) - sreturn = PostData(url, userName, password, boxType, "/cgi-bin/getServices?ref=4097:7:0:6:0:0:0:0:0:0:"); + sreturn = PostData(url, userName, password, boxType, timeout, "/cgi-bin/getServices?ref=4097:7:0:6:0:0:0:0:0:0:"); // get internal hdd recording - if (!PostData(url, userName, password, boxType, "/cgi-bin/getServices?ref=2:47:0:0:0:0:0:0:0:0:/var/media/movie/").Contains("E: ")) + if (!PostData(url, userName, password, boxType, timeout, "/cgi-bin/getServices?ref=2:47:0:0:0:0:0:0:0:0:/var/media/movie/").Contains("E: ")) sreturn += "2:47:0:0:0:0:0:0:0:0:/var/media/movie/;Recordings\n"; // replace neutrino split character with ; @@ -316,7 +322,7 @@ string serviceID = String.Empty; string serviceName = String.Empty; - string returnedXml = PostData(url, userName, password, boxType, "/web/fetchchannels?ServiceListBrowse=1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet"); + string returnedXml = PostData(url, userName, password, boxType, timeout, "/web/fetchchannels?ServiceListBrowse=1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet"); // xmlbased, return all userbouquets XmlDocument doc = new XmlDocument(); @@ -346,7 +352,7 @@ break; default: - sreturn = PostData(url, userName, password, boxType, "/control/getbouquets"); + sreturn = PostData(url, userName, password, boxType, timeout, "/control/getbouquets"); // set the bouquet command for this boxtype command = "/control/getbouquet?bouquet="; break; @@ -390,7 +396,7 @@ //request list of channels contained in bouquetID "temp" - sreturn = PostData(url, userName, password, boxType, curCommand); + sreturn = PostData(url, userName, password, boxType, timeout, curCommand); sreturn = sreturn.Replace(";selected", ""); if (boxType == StbBoxType.EnigmaV2) @@ -503,17 +509,17 @@ return ds; } - internal static StbBoxType DetectBoxType(string url, string userName, string password) + internal static StbBoxType DetectBoxType(string url, string userName, string password, int timeout) { - string str1 = PostData(url, userName, password, StbBoxType.Unknown, "/control/getmode").ToUpperInvariant(); + string str1 = PostData(url, userName, password, StbBoxType.Unknown, timeout, "/control/getmode").ToUpperInvariant(); if (str1.Contains("TV") || str1.Contains("RADIO") || str1.Contains("UNKNOWN")) return StbBoxType.Neutrino; - string str2 = PostData(url, userName, password, StbBoxType.Unknown, "/cgi-bin/status").ToUpperInvariant(); + string str2 = PostData(url, userName, password, StbBoxType.Unknown, timeout, "/cgi-bin/status").ToUpperInvariant(); if (str2.Contains("ENIGMA")) return StbBoxType.EnigmaV1; - string str3 = PostData(url, userName, password, StbBoxType.Unknown, "/web/stream.m3u").ToUpperInvariant(); + string str3 = PostData(url, userName, password, StbBoxType.Unknown, timeout, "/web/stream.m3u").ToUpperInvariant(); if (str3.Contains("#EXTM3U")) return StbBoxType.EnigmaV2; @@ -524,9 +530,9 @@ { switch (_boxType) { - case StbBoxType.EnigmaV1: return PostData(_url, _userName, _password, _boxType, "/cgi-bin/zapTo?path=" + ID); - case StbBoxType.EnigmaV2: return PostData(_url, _userName, _password, _boxType, "/web/zap?ZapTo=" + ID); - default: return PostData(_url, _userName, _password, _boxType, "/control/zapto?" + ID); + case StbBoxType.EnigmaV1: return PostData(_url, _userName, _password, _boxType, _timeout, "/cgi-bin/zapTo?path=" + ID); + case StbBoxType.EnigmaV2: return PostData(_url, _userName, _password, _boxType, _timeout, "/web/zap?ZapTo=" + ID); + default: return PostData(_url, _userName, _password, _boxType, _timeout, "/control/zapto?" + ID); } } static void WakeUp() @@ -534,15 +540,15 @@ switch (_boxType) { case StbBoxType.EnigmaV1: - PostData(_url, _userName, _password, _boxType, "/cgi-bin/admin?command=wakeup"); + PostData(_url, _userName, _password, _boxType, _timeout, "/cgi-bin/admin?command=wakeup"); break; case StbBoxType.EnigmaV2: // donno if wakeup is correct command - PostData(_url, _userName, _password, _boxType, "/web/powerstate?newstate=wakeup"); + PostData(_url, _userName, _password, _boxType, _timeout, "/web/powerstate?newstate=wakeup"); break; case StbBoxType.Neutrino: // off = wakeup - PostData(_url, _userName, _password, _boxType, "/control/standby?off"); + PostData(_url, _userName, _password, _boxType, _timeout, "/control/standby?off"); break; } } @@ -551,7 +557,7 @@ //set playback to spts only required for neutrino, (i think) if (_boxType == StbBoxType.Neutrino) //send neutrino command - return PostData(_url, _userName, _password, _boxType, "/control/system?setAViAExtPlayBack=spts"); + return PostData(_url, _userName, _password, _boxType, _timeout, "/control/system?setAViAExtPlayBack=spts"); else // return ok for enigma return "ok"; } @@ -562,19 +568,19 @@ switch (_boxType) { case StbBoxType.EnigmaV1: - status = PostData(_url, _userName, _password, _boxType, "/cgi-bin/audio?mute=0"); + status = PostData(_url, _userName, _password, _boxType, _timeout, "/cgi-bin/audio?mute=0"); break; case StbBoxType.EnigmaV2: - status = PostData(_url, _userName, _password, _boxType, "/web/vol?set=mute"); + status = PostData(_url, _userName, _password, _boxType, _timeout, "/web/vol?set=mute"); break; default: - status = PostData(_url, _userName, _password, _boxType, "/control/volume?status"); + status = PostData(_url, _userName, _password, _boxType, _timeout, "/control/volume?status"); if (status.Equals("0", StringComparison.Ordinal)) - status = PostData(_url, _userName, _password, _boxType, "/control/volume?mute"); + status = PostData(_url, _userName, _password, _boxType, _timeout, "/control/volume?mute"); if (status.Equals("1", StringComparison.Ordinal)) - status = PostData(_url, _userName, _password, _boxType, "/control/volume?unmute"); + status = PostData(_url, _userName, _password, _boxType, _timeout, "/control/volume?unmute"); break; } @@ -585,15 +591,15 @@ switch (_boxType) { case StbBoxType.EnigmaV1: - PostData(_url, _userName, _password, _boxType, "/cgi-bin/xmessage?timeout=10&caption=Message&body=" + message); + PostData(_url, _userName, _password, _boxType, _timeout, "/cgi-bin/xmessage?timeout=10&caption=Message&body=" + message); break; case StbBoxType.EnigmaV2: - PostData(_url, _userName, _password, _boxType, "/web/message?type=1&timeout=10&text=" + message); + PostData(_url, _userName, _password, _boxType, _timeout, "/web/message?type=1&timeout=10&text=" + message); break; default: - PostData(_url, _userName, _password, _boxType, "/control/message?popup=" + message); + PostData(_url, _userName, _password, _boxType, _timeout, "/control/message?popup=" + message); break; } } @@ -604,18 +610,18 @@ switch (_boxType) { case StbBoxType.EnigmaV1: - info = PostData(_url, _userName, _password, _boxType, "/xml/boxinfo"); + info = PostData(_url, _userName, _password, _boxType, _timeout, "/xml/boxinfo"); info = info.Replace("\n", " "); info = info.Replace(" ", ""); break; case StbBoxType.EnigmaV2: - info = PostData(_url, _userName, _password, _boxType, "/web/about"); + info = PostData(_url, _userName, _password, _boxType, _timeout, "/web/about"); info = info.Replace("\n", " "); break; default: - info = PostData(_url, _userName, _password, _boxType, "/control/info?version"); + info = PostData(_url, _userName, _password, _boxType, _timeout, "/control/info?version"); info = info.Replace("\n", " "); break; } @@ -632,15 +638,15 @@ switch (_boxType) { case StbBoxType.EnigmaV1: - epgXml = PostData(_url, _userName, _password, _boxType, "/xml/serviceepg?ref=" + ID); + epgXml = PostData(_url, _userName, _password, _boxType, _timeout, "/xml/serviceepg?ref=" + ID); break; case StbBoxType.EnigmaV2: - epgXml = PostData(_url, _userName, _password, _boxType, "/web/epgservice?ref=" + ID); + epgXml = PostData(_url, _userName, _password, _boxType, _timeout, "/web/epgservice?ref=" + ID); break; default: - epgXml = PostData(_url, _userName, _password, _boxType, "/control/epg?xml=true&channelid=" + ID + "&details=true"); // &max=20 + epgXml = PostData(_url, _userName, _password, _boxType, _timeout, "/control/epg?xml=true&channelid=" + ID + "&details=true"); // &max=20 break; } @@ -659,21 +665,21 @@ switch (_boxType) { case StbBoxType.EnigmaV1: - xml = PostData(_url, _userName, _password, _boxType, "/xml/streaminfo"); + xml = PostData(_url, _userName, _password, _boxType, _timeout, "/xml/streaminfo"); doc.LoadXml(xml); elem = doc.SelectSingleNode("/streaminfo/service/reference"); id = elem.InnerText; break; case StbBoxType.EnigmaV2: - xml = PostData(_url, _userName, _password, _boxType, "/web/subservices"); + xml = PostData(_url, _userName, _password, _boxType, _timeout, "/web/subservices"); doc.LoadXml(xml); elem = doc.SelectSingleNode("/e2servicelist/e2service/e2servicereference"); id = elem.InnerText; break; default: - id = PostData(_url, _userName, _password, _boxType, "/control/zapto"); + id = PostData(_url, _userName, _password, _boxType, _timeout, "/control/zapto"); id = id.Replace("\n", ""); break; } Modified: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.Designer.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.Designer.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -40,6 +40,9 @@ private System.Windows.Forms.StatusStrip statusStrip; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel; private System.Windows.Forms.Button buttonDetectBoxType; + private System.Windows.Forms.Label labelTimeout; + private System.Windows.Forms.NumericUpDown numericUpDownTimeout; + private System.Windows.Forms.Label labelMilliseconds; } } Modified: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -43,6 +43,11 @@ get { return textBoxPassword.Text; } set { textBoxPassword.Text = value; } } + public int Timeout + { + get { return decimal.ToInt32(numericUpDownTimeout.Value); } + set { numericUpDownTimeout.Value = new decimal(value); } + } #endregion Properties @@ -69,13 +74,17 @@ this.statusStrip = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.buttonDetectBoxType = new System.Windows.Forms.Button(); + this.labelTimeout = new System.Windows.Forms.Label(); + this.numericUpDownTimeout = new System.Windows.Forms.NumericUpDown(); + this.labelMilliseconds = new System.Windows.Forms.Label(); this.statusStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).BeginInit(); this.SuspendLayout(); // // buttonGetData // this.buttonGetData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonGetData.Location = new System.Drawing.Point(8, 88); + this.buttonGetData.Location = new System.Drawing.Point(8, 112); this.buttonGetData.Name = "buttonGetData"; this.buttonGetData.Size = new System.Drawing.Size(104, 24); this.buttonGetData.TabIndex = 6; @@ -140,7 +149,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(128, 120); + this.buttonOK.Location = new System.Drawing.Point(128, 144); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(64, 24); this.buttonOK.TabIndex = 7; @@ -152,7 +161,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(200, 120); + this.buttonCancel.Location = new System.Drawing.Point(200, 144); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(64, 24); this.buttonCancel.TabIndex = 8; @@ -164,7 +173,7 @@ // this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel}); - this.statusStrip.Location = new System.Drawing.Point(0, 153); + this.statusStrip.Location = new System.Drawing.Point(0, 177); this.statusStrip.Name = "statusStrip"; this.statusStrip.Size = new System.Drawing.Size(272, 22); this.statusStrip.TabIndex = 9; @@ -177,7 +186,7 @@ // buttonDetectBoxType // this.buttonDetectBoxType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonDetectBoxType.Location = new System.Drawing.Point(8, 120); + this.buttonDetectBoxType.Location = new System.Drawing.Point(8, 144); this.buttonDetectBoxType.Name = "buttonDetectBoxType"; this.buttonDetectBoxType.Size = new System.Drawing.Size(104, 24); this.buttonDetectBoxType.TabIndex = 10; @@ -185,11 +194,61 @@ this.buttonDetectBoxType.UseVisualStyleBackColor = true; this.buttonDetectBoxType.Click += new System.EventHandler(this.buttonDetectBoxType_Click); // + // labelTimeout + // + this.labelTimeout.Location = new System.Drawing.Point(8, 80); + this.labelTimeout.Name = "labelTimeout"; + this.labelTimeout.Size = new System.Drawing.Size(80, 20); + this.labelTimeout.TabIndex = 11; + this.labelTimeout.Text = "Timeout:"; + this.labelTimeout.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownTimeout + // + this.numericUpDownTimeout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDownTimeout.Increment = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.numericUpDownTimeout.Location = new System.Drawing.Point(88, 80); + this.numericUpDownTimeout.Maximum = new decimal(new int[] { + 60000, + 0, + 0, + 0}); + this.numericUpDownTimeout.Minimum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownTimeout.Name = "numericUpDownTimeout"; + this.numericUpDownTimeout.Size = new System.Drawing.Size(144, 20); + this.numericUpDownTimeout.TabIndex = 12; + this.numericUpDownTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownTimeout.Value = new decimal(new int[] { + 2000, + 0, + 0, + 0}); + // + // labelMilliseconds + // + this.labelMilliseconds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelMilliseconds.Location = new System.Drawing.Point(232, 80); + this.labelMilliseconds.Name = "labelMilliseconds"; + this.labelMilliseconds.Size = new System.Drawing.Size(32, 20); + this.labelMilliseconds.TabIndex = 13; + this.labelMilliseconds.Text = "ms"; + this.labelMilliseconds.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // SetupForm // - this.AcceptButton = this.buttonOK; - this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(272, 175); + this.ClientSize = new System.Drawing.Size(272, 199); + this.Controls.Add(this.labelMilliseconds); + this.Controls.Add(this.numericUpDownTimeout); + this.Controls.Add(this.labelTimeout); this.Controls.Add(this.buttonDetectBoxType); this.Controls.Add(this.statusStrip); this.Controls.Add(this.buttonGetData); @@ -210,6 +269,7 @@ this.Text = "Dbox Tuner Setup"; this.statusStrip.ResumeLayout(false); this.statusStrip.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -225,7 +285,7 @@ // Detect box type ... if (BoxType == StbBoxType.Unknown) - BoxType = Program.DetectBoxType(url, UserName, Password); + BoxType = Program.DetectBoxType(url, UserName, Password, Timeout); if (BoxType == StbBoxType.Unknown) { @@ -235,7 +295,7 @@ { StatusMessage("Detected box type: {0}", _boxType); - DataSet dataSet = Program.GetData(url, UserName, Password, BoxType); + DataSet dataSet = Program.GetData(url, UserName, Password, BoxType, Timeout); DataTable dataTable = dataSet.Tables[0]; if (dataTable.Rows.Count != 0) @@ -283,7 +343,7 @@ private void buttonDetectBoxType_Click(object sender, EventArgs e) { - BoxType = Program.DetectBoxType(Program.UrlPrefix + Address, UserName, Password); + BoxType = Program.DetectBoxType(Program.UrlPrefix + Address, UserName, Password, Timeout); } } Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -39,9 +39,10 @@ this.listBoxStatus = new System.Windows.Forms.ListBox(); this.groupBoxStatus = new System.Windows.Forms.GroupBox(); this.groupBoxRemoteButton = new System.Windows.Forms.GroupBox(); - this.labelCustomButton = new System.Windows.Forms.Label(); - this.numericUpDownButton = new System.Windows.Forms.NumericUpDown(); - this.comboBoxRemoteButtons = new System.Windows.Forms.ComboBox(); + this.textBoxRemoteCode = new System.Windows.Forms.TextBox(); + this.textBoxRemoteDevice = new System.Windows.Forms.TextBox(); + this.labelRemoteCode = new System.Windows.Forms.Label(); + this.labelRemoteDevice = new System.Windows.Forms.Label(); this.buttonSendRemoteButton = new System.Windows.Forms.Button(); this.groupBoxSetup = new System.Windows.Forms.GroupBox(); this.comboBoxComputer = new System.Windows.Forms.ComboBox(); @@ -51,7 +52,6 @@ this.buttonHelp = new System.Windows.Forms.Button(); this.groupBoxStatus.SuspendLayout(); this.groupBoxRemoteButton.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButton)).BeginInit(); this.groupBoxSetup.SuspendLayout(); this.groupBoxCommands.SuspendLayout(); this.SuspendLayout(); @@ -156,9 +156,10 @@ // this.groupBoxRemoteButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxRemoteButton.Controls.Add(this.labelCustomButton); - this.groupBoxRemoteButton.Controls.Add(this.numericUpDownButton); - this.groupBoxRemoteButton.Controls.Add(this.comboBoxRemoteButtons); + this.groupBoxRemoteButton.Controls.Add(this.textBoxRemoteCode); + this.groupBoxRemoteButton.Controls.Add(this.textBoxRemoteDevice); + this.groupBoxRemoteButton.Controls.Add(this.labelRemoteCode); + this.groupBoxRemoteButton.Controls.Add(this.labelRemoteDevice); this.groupBoxRemoteButton.Controls.Add(this.buttonSendRemoteButton); this.groupBoxRemoteButton.Location = new System.Drawing.Point(8, 136); this.groupBoxRemoteButton.Name = "groupBoxRemoteButton"; @@ -167,45 +168,38 @@ this.groupBoxRemoteButton.TabStop = false; this.groupBoxRemoteButton.Text = "Remote button"; // - // labelCustomButton + // textBoxRemoteCode // - this.labelCustomButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.labelCustomButton.Location = new System.Drawing.Point(136, 16); - this.labelCustomButton.Name = "labelCustomButton"; - this.labelCustomButton.Size = new System.Drawing.Size(144, 20); - this.labelCustomButton.TabIndex = 1; - this.labelCustomButton.Text = "Custom button key code:"; - this.labelCustomButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.textBoxRemoteCode.Location = new System.Drawing.Point(232, 16); + this.textBoxRemoteCode.Name = "textBoxRemoteCode"; + this.textBoxRemoteCode.Size = new System.Drawing.Size(100, 20); + this.textBoxRemoteCode.TabIndex = 7; // - // numericUpDownButton + // textBoxRemoteDevice // - this.numericUpDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.numericUpDownButton.Location = new System.Drawing.Point(288, 16); - this.numericUpDownButton.Maximum = new decimal(new int[] { - 32768, - 0, - 0, - 0}); - this.numericUpDownButton.Name = "numericUpDownButton"; - this.numericUpDownButton.Size = new System.Drawing.Size(72, 20); - this.numericUpDownButton.TabIndex = 2; - this.numericUpDownButton.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.numericUpDownButton.ThousandsSeparator = true; - this.toolTips.SetToolTip(this.numericUpDownButton, "Specify a custom button code to forward to the server"); + this.textBoxRemoteDevice.Location = new System.Drawing.Point(64, 16); + this.textBoxRemoteDevice.Name = "textBoxRemoteDevice"; + this.textBoxRemoteDevice.Size = new System.Drawing.Size(100, 20); + this.textBoxRemoteDevice.TabIndex = 6; // - // comboBoxRemoteButtons + // labelRemoteCode // - this.comboBoxRemoteButtons.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.comboBoxRemoteButtons.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxRemoteButtons.FormattingEnabled = true; - this.comboBoxRemoteButtons.Location = new System.Drawing.Point(8, 16); - this.comboBoxRemoteButtons.Name = "comboBoxRemoteButtons"; - this.comboBoxRemoteButtons.Size = new System.Drawing.Size(120, 21); - this.comboBoxRemoteButtons.TabIndex = 0; - this.toolTips.SetToolTip(this.comboBoxRemoteButtons, "Choose a remote control button to forward to the server"); - this.comboBoxRemoteButtons.SelectedIndexChanged += new System.EventHandler(this.comboBoxRemoteButtons_SelectedIndexChanged); + this.labelRemoteCode.Location = new System.Drawing.Point(176, 16); + this.labelRemoteCode.Name = "labelRemoteCode"; + this.labelRemoteCode.Size = new System.Drawing.Size(56, 20); + this.labelRemoteCode.TabIndex = 5; + this.labelRemoteCode.Text = "Code:"; + this.labelRemoteCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // labelRemoteDevice + // + this.labelRemoteDevice.Location = new System.Drawing.Point(8, 16); + this.labelRemoteDevice.Name = "labelRemoteDevice"; + this.labelRemoteDevice.Size = new System.Drawing.Size(56, 20); + this.labelRemoteDevice.TabIndex = 4; + this.labelRemoteDevice.Text = "Device:"; + this.labelRemoteDevice.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // buttonSendRemoteButton // this.buttonSendRemoteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -299,7 +293,7 @@ this.Load += new System.EventHandler(this.MainForm_Load); this.groupBoxStatus.ResumeLayout(false); this.groupBoxRemoteButton.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButton)).EndInit(); + this.groupBoxRemoteButton.PerformLayout(); this.groupBoxSetup.ResumeLayout(false); this.groupBoxCommands.ResumeLayout(false); this.ResumeLayout(false); @@ -317,16 +311,17 @@ private System.Windows.Forms.ListBox listBoxStatus; private System.Windows.Forms.GroupBox groupBoxStatus; private System.Windows.Forms.GroupBox groupBoxRemoteButton; - private System.Windows.Forms.NumericUpDown numericUpDownButton; - private System.Windows.Forms.ComboBox comboBoxRemoteButtons; private System.Windows.Forms.Button buttonSendRemoteButton; - private System.Windows.Forms.Label labelCustomButton; private System.Windows.Forms.GroupBox groupBoxSetup; private System.Windows.Forms.GroupBox groupBoxCommands; private System.Windows.Forms.ToolTip toolTips; private System.Windows.Forms.ComboBox comboBoxPort; private System.Windows.Forms.ComboBox comboBoxComputer; private System.Windows.Forms.Button buttonHelp; + private System.Windows.Forms.Label labelRemoteCode; + private System.Windows.Forms.Label labelRemoteDevice; + private System.Windows.Forms.TextBox textBoxRemoteCode; + private System.Windows.Forms.TextBox textBoxRemoteDevice; } } Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -135,9 +135,6 @@ _addStatusLine = new DelegateAddStatusLine(AddStatusLine); - comboBoxRemoteButtons.Items.AddRange(Enum.GetNames(typeof(MceButton))); - comboBoxRemoteButtons.SelectedIndex = 0; - comboBoxPort.Items.Clear(); comboBoxPort.Items.Add("None"); comboBoxPort.SelectedIndex = 0; @@ -482,14 +479,6 @@ } } - private void comboBoxRemoteButtons_SelectedIndexChanged(object sender, EventArgs e) - { - if (comboBoxRemoteButtons.SelectedItem.ToString().Equals("Custom", StringComparison.OrdinalIgnoreCase)) - numericUpDownButton.Enabled = true; - else - numericUpDownButton.Enabled = false; - } - private void buttonSendRemoteButton_Click(object sender, EventArgs e) { AddStatusLine("Send Remote Button"); @@ -508,11 +497,17 @@ return; } - int keyCode = (int)Enum.Parse(typeof(MceButton), comboBoxRemoteButtons.SelectedItem.ToString(), true); - if (keyCode == -1) - keyCode = Decimal.ToInt32(numericUpDownButton.Value); + byte[] deviceNameBytes = Encoding.ASCII.GetBytes(textBoxRemoteDevice.Text); + byte[] keyCodeBytes = Encoding.ASCII.GetBytes(textBoxRemoteCode.Text); - IrssMessage message = new IrssMessage(MessageType.ForwardRemoteEvent, MessageFlags.Notify, keyCode.ToString()); + byte[] bytes = new byte[8 + deviceNameBytes.Length + keyCodeBytes.Length]; + + BitConverter.GetBytes(deviceNameBytes.Length).CopyTo(bytes, 0); + deviceNameBytes.CopyTo(bytes, 4); + BitConverter.GetBytes(keyCodeBytes.Length).CopyTo(bytes, 4 + deviceNameBytes.Length); + keyCodeBytes.CopyTo(bytes, 8 + deviceNameBytes.Length); + + IrssMessage message = new IrssMessage(MessageType.ForwardRemoteEvent, MessageFlags.Notify, bytes); _client.Send(message); } catch (Exception ex) Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -1307,7 +1307,7 @@ string fileName = Path.Combine(Program.FolderMacros, file + Common.FileExtensionMacro); if (File.Exists(fileName)) { - if (MessageBox.Show(this, "Are you sure you want to delete \"" + file + "\"?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (MessageBox.Show(this, String.Format("Are you sure you want to delete \"{0}\"?", file), "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { File.Delete(fileName); listViewMacro.Items.Remove(listViewMacro.SelectedItems[0]); @@ -1340,7 +1340,7 @@ string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string macroName = listViewMacro.SelectedItems[0].Text; - string shortcutPath = Path.Combine(desktopPath, "Macro - " + macroName + ".lnk"); + string shortcutPath = Path.Combine(desktopPath, String.Format("Macro - {0}.lnk", macroName)); MSjogren.Samples.ShellLink.ShellShortcut shortcut = new MSjogren.Samples.ShellLink.ShellShortcut(shortcutPath); @@ -1382,7 +1382,7 @@ string fileName = Path.Combine(Common.FolderIRCommands, file + Common.FileExtensionIR); if (File.Exists(fileName)) { - if (MessageBox.Show(this, "Are you sure you want to delete \"" + file + "\"?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (MessageBox.Show(this, String.Format("Are you sure you want to delete \"{0}\"?", file), "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { File.Delete(fileName); listViewIR.Items.Remove(listViewIR.SelectedItems[0]); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MenuForm.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -197,7 +197,7 @@ if (String.IsNullOrEmpty(subMenuName)) labelHeader.Text = WindowTitle; else - labelHeader.Text = WindowTitle + " - " + subMenuName; + labelHeader.Text = String.Format("{0} - {1}", WindowTitle, subMenuName); } 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 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -26,7 +26,7 @@ #region Constants - static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "Virtual Remote Skin Editor\\Virtual Remote Skin Editor.xml"); + static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "Virtual Remote\\Virtual Remote Skin Editor.xml"); #endregion Constants Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -491,6 +491,7 @@ process.StartInfo.WindowStyle = (ProcessWindowStyle)Enum.Parse(typeof(ProcessWindowStyle), commands[3], true); process.StartInfo.CreateNoWindow = bool.Parse(commands[4]); process.StartInfo.UseShellExecute = bool.Parse(commands[5]); + //process.PriorityClass = ProcessPriorityClass. bool waitForExit = bool.Parse(commands[6]); bool forceFocus = bool.Parse(commands[7]); Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/PopupMessage.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/PopupMessage.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/PopupMessage.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -24,10 +24,10 @@ { get { - return - textBoxHeading.Text + "|" + - textBoxText.Text + "|" + - numericUpDownTimeout.Value.ToString(); + return String.Format("{0}|{1}|{2}", + textBoxHeading.Text, + textBoxText.Text, + numericUpDownTimeout.Value.ToString()); } } Modified: trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -23,12 +23,12 @@ /// <summary> /// Folder for Custom Input Device data files. /// </summary> - public static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice) + Path.DirectorySeparatorChar; + public static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice); /// <summary> /// Folder for Input Device data default files. /// </summary> - public static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault) + Path.DirectorySeparatorChar; + public static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault); /// <summary> /// Path to the MediaPortal configuration 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-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -934,7 +934,7 @@ bool i18n_translate(string orig, IntPtr szstore, int size) { #if TRACE - Trace.WriteLine("i18n_translate(" + orig + ")"); + Trace.WriteLine(String.Format("i18n_translate({0})", orig)); #endif return WriteString(szstore, size, orig); @@ -997,7 +997,7 @@ int get_int_var(string name) { #if TRACE - Trace.WriteLine("get_int_var(" + name + ")"); + Trace.WriteLine(String.Format("get_int_var({0})", name)); #endif return 0; @@ -1006,7 +1006,7 @@ double get_double_var(string name) { #if TRACE - Trace.WriteLine("get_double_var(" + name + ")"); + Trace.WriteLine(String.Format("get_double_var({0})", name)); #endif return 0.0; @@ -1048,7 +1048,7 @@ bool delete_var(string name) { #if TRACE - Trace.WriteLine("delete_var(" + name + ")"); + Trace.WriteLine(String.Format("delete_var({0})", name)); #endif return true; Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -5,9 +5,8 @@ #endif using System.IO; using System.Runtime.InteropServices; +using System.Windows.Forms; -using Microsoft.Win32.SafeHandles; - namespace InputService.Plugin { @@ -18,48 +17,38 @@ public class IR507Receiver : PluginBase, IRemoteReceiver { - #region Interop + #region Debug - [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Auto)] - static extern SafeFileHandle CreateFile( - String fileName, - [MarshalAs(UnmanagedType.U4)] FileAccess fileAccess, - [MarshalAs(UnmanagedType.U4)] FileShare fileShare, - IntPtr securityAttributes, - [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, - [MarshalAs(UnmanagedType.U4)] EFileAttributes flags, - IntPtr template); + [STAThread] + static void Main() + { + try + { + IR507Receiver c = new IR507Receiver(); - [Flags] - enum EFileAttributes : uint + c.RemoteCallback += new RemoteHandler(Remote); + c.Start(); + + Application.Run(); + + c.Stop(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + } + + static void Remote(string deviceName, string code) { - Readonly = 0x00000001, - Hidden = 0x00000002, - System = 0x00000004, - Directory = 0x00000010, - Archive = 0x00000020, - Device = 0x00000040, - Normal = 0x00000080, - Temporary = 0x00000100, - SparseFile = 0x00000200, - ReparsePoint = 0x00000400, - Compressed = 0x00000800, - Offline = 0x00001000, - NotContentIndexed = 0x00002000, - Encrypted = 0x00004000, - Write_Through = 0x80000000, - Overlapped = 0x40000000, - NoBuffering = 0x20000000, - RandomAccess = 0x10000000, - SequentialScan = 0x08000000, - DeleteOnClose = 0x04000000, - BackupSemantics = 0x02000000, - PosixSemantics = 0x01000000, - OpenReparsePoint = 0x00200000, - OpenNoRecall = 0x00100000, - FirstPipeInstance = 0x00080000, + Console.WriteLine("Remote: {0}", code); } + #endregion Debug + + + #region Interop + [StructLayout(LayoutKind.Sequential)] struct DeviceInfoData { @@ -141,9 +130,7 @@ #region Constants - const int DeviceBufferSize = 255; - - //const string DeviceID = "vid_0e6a&pid_6002"; + //const string DeviceID = "vid_0e6a&pid_6002"; // Unknown const string DeviceID = "vid_147a&pid_e02a"; #endregion Constants @@ -152,10 +139,10 @@ RemoteHandler _remoteButtonHandler; - FileStream _deviceStream; - byte[] _deviceBuffer; + ReceiverWindow _receiverWindow; + RawInput.RAWINPUTDEVICE _device; - int _lastCode = -1; + string _lastCode = String.Empty; DateTime _lastCodeTime = DateTime.Now; #endregion Variables @@ -211,28 +198,16 @@ /// </summary> public override void Start() { - Guid guid = new Guid(); - HidD_GetHidGuid(ref guid); + _receiverWindow = new ReceiverWindow("IR507 Receiver"); + _receiverWindow.ProcMsg += new ProcessMessage(ProcMessage); - string devicePath = FindDevice(guid); - if (String.IsNullOrEmpty(devicePath)) - throw new ApplicationException("Device not found"); + _device.usUsage = 1; + _device.usUsagePage = 12; + _device.dwFlags = RawInput.RawInputDeviceFlags.InputSink; + _device.hwndTarget = _receiverWindow.Handle; - //Console.WriteLine("Opening device: {0}", devicePath); - - SafeFileHandle deviceHandle = CreateFile(devicePath, FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, EFileAttributes.Overlapped, IntPtr.Zero); - int lastError = Marshal.GetLastWin32Error(); - - //Console.WriteLine("Last Error: {0}", lastError); - - if (deviceHandle.IsInvalid) - throw new Win32Exception(lastError, "Failed to open device"); - - //_deviceWatcher.RegisterDeviceRemoval(deviceHandle); - - _deviceBuffer = new byte[DeviceBufferSize]; - _deviceStream = new FileStream(deviceHandle, FileAccess.Read, _deviceBuffer.Length, true); - _deviceStream.BeginRead(_deviceBuffer, 0, _deviceBuffer.Length, new AsyncCallback(OnReadComplete), null); + if (!RegisterForRawInput(_device)) + throw new ApplicationException("Failed to register for HID Raw input"); } /// <summary> /// Suspend the IR Server plugin when computer enters standby. @@ -253,21 +228,12 @@ /// </summary> public override void Stop() { - if (_deviceStream == null) - return; + _device.dwFlags |= RawInput.RawInputDeviceFlags.Remove; + RegisterForRawInput(_device); - try - { - _deviceStream.Dispose(); - } - catch (IOException) - { - // we are closing the stream so ignore this - } - finally - { - _deviceStream = null; - } + _receiverWindow.ProcMsg -= new ProcessMessage(ProcMessage); + _receiverWindow.DestroyHandle(); + _receiverWindow = null; } /// <summary> @@ -280,6 +246,70 @@ set { _remoteButtonHandler = value; } } + bool RegisterForRawInput(RawInput.RAWINPUTDEVICE device) + { + RawInput.RAWINPUTDEVICE[] devices = new RawInput.RAWINPUTDEVICE[1]; + devices[0] = device; + + return RegisterForRawInput(devices); + } + bool RegisterForRawInput(RawInput.RAWINPUTDEVICE[] devices) + { + return RawInput.RegisterRawInputDevices(devices, (uint)devices.Length, (uint)Marshal.SizeOf(devices[0])); + } + + void ProcMessage(ref Message m) + { + if (m.Msg != RawInput.WM_INPUT) + return; + + uint dwSize = 0; + + RawInput.GetRawInputData(m.LParam, RawInput.RawInputCommand.Input, IntPtr.Zero, ref dwSize, (uint)Marshal.SizeOf(typeof(RawInput.RAWINPUTHEADER))); + + IntPtr buffer = Marshal.AllocHGlobal((int)dwSize); + try + { + if (buffer == IntPtr.Zero) + return; + + if (RawInput.GetRawInputData(m.LParam, RawInput.RawInputCommand.Input, buffer, ref dwSize, (uint)Marshal.SizeOf(typeof(RawInput.RAWINPUTHEADER))) != dwSize) + return; + + RawInput.RAWINPUT raw = (RawInput.RAWINPUT)Marshal.PtrToStructure(buffer, typeof(RawInput.RAWINPUT)); + + if (raw.header.dwType == RawInput.RawInputType.HID) + { + int offset = Marshal.SizeOf(typeof(RawInput.RAWINPUTHEADER)) + Marshal.SizeOf(typeof(RawInput.RAWHID)); + + byte[] bRawData = new byte[offset + raw.hid.dwSizeHid]; + Marshal.Copy(buffer, bRawData, 0, bRawData.Length); + + byte[] newArray = new byte[raw.hid.dwSizeHid]; + Array.Copy(bRawData, offset, newArray, 0, newArray.Length); + + string code = BitConverter.ToString(newArray); + + TimeSpan timeSpan = DateTime.Now - _lastCodeTime; + + if (!code.Equals(_lastCode, StringComparison.Ordinal) || timeSpan.Milliseconds > 250) + { + if (_remoteButtonHandler != null) + _remoteButtonHandler(this.Name, code); + + _lastCodeTime = DateTime.Now; + } + + _lastCode = code; + } + } + finally + { + Marshal.FreeHGlobal(buffer); + } + + } + static string FindDevice(Guid classGuid) { int lastError; @@ -349,64 +379,8 @@ return devicePath; } - void OnReadComplete(IAsyncResult asyncResult) - { - try - { - //int read = _deviceStream.EndRead(asyncResult); - //Console.WriteLine(BitConverter.ToString(_deviceBuffer, 0, read)); - - if (_deviceStream.EndRead(asyncResult) == 4 && _deviceBuffer[1] == 0) - { - TimeSpan timeSpan = DateTime.Now - _lastCodeTime; - - int keyCode = (int)_deviceBuffer[2]; - - if (keyCode != _lastCode || timeSpan.Milliseconds > 250) - { - if (_remoteButtonHandler != null) - _remoteButtonHandler(this.Name, keyCode.ToString()); - - _lastCodeTime = DateTime.Now; - } - - _lastCode = keyCode; - } - - _deviceStream.BeginRead(_deviceBuffer, 0, _deviceBuffer.Length, new AsyncCallback(OnReadComplete), null); - } - catch (Exception) - { - } - } - #endregion Implementation - #region Debug - - [STAThread] - static void Main() - { - try - { - IR507Receiver c = new IR507Receiver(); - c.Start(); - - while (Console.ReadKey().Key != ConsoleKey.Escape) - { - Console.WriteLine("Press escape to quit"); - } - - c.Stop(); - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - } - } - - #endregion Debug - } } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Configure.Designer.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -111,8 +111,7 @@ this.numericUpDownButtonRepeatDelay.TabIndex = 2; this.numericUpDownButtonRepeatDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.numericUpDownButtonRepeatDelay.ThousandsSeparator = true; - this.toolTips.SetToolTip(this.numericUpDownButtonRepeatDelay, "When the button is held this is the time between the first press and the first re" + - "peat"); + this.toolTips.SetToolTip(this.numericUpDownButtonRepeatDelay, "When the button is held this is the time between the first press and the first repeat"); this.numericUpDownButtonRepeatDelay.Value = new decimal(new int[] { 10000, 0, @@ -326,8 +325,7 @@ this.checkBoxDisableMCEServices.Size = new System.Drawing.Size(216, 17); this.checkBoxDisableMCEServices.TabIndex = 2; this.checkBoxDisableMCEServices.Text = "Disable Windows Media Center services"; - this.toolTips.SetToolTip(this.checkBoxDisableMCEServices, "Disable Microsoft Windows Media Center services to prevent interference with IR S" + - "erver"); + this.toolTips.SetToolTip(this.checkBoxDisableMCEServices, "Disable Microsoft Windows Media Center services to prevent interference with the Input Service"); this.checkBoxDisableMCEServices.UseVisualStyleBackColor = true; // // checkBoxEnableRemote Modified: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLirc Transceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLirc Transceiver.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLirc Transceiver.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -270,7 +270,7 @@ if (_remoteButtonHandler == null) return; - string buttonCode = cmd.Remote + ": " + cmd.Button; + string buttonCode = String.Format("{0}: {1}", cmd.Remote, cmd.Button); _remoteButtonHandler(this.Name, buttonCode); } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLircServer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLircServer.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLircServer.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -175,12 +175,12 @@ if (_lastCommand.IsSameCommand(command)) if ((command.Time - _lastCommand.Time) < _buttonReleaseTime) { - Trace.WriteLine("WLirc: Command '" + command.Button + "' ignored because of repeat filter"); + Trace.WriteLine(String.Format("WLirc: Command '{0}' ignored because of repeat filter", command.Button)); return; } #endregion - Trace.WriteLine("WLirc: Command '" + command.Button + "' accepted"); + Trace.WriteLine(String.Format("WLirc: Command '{0}' accepted", command.Button)); _lastCommand = command; if (CommandEvent != null) Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Windows Message Receiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Windows Message Receiver/Configure.Designer.cs 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Windows Message Receiver/Configure.Designer.cs 2008-03-06 14:49:18 UTC (rev 1431) @@ -72,8 +72,7 @@ this.numericUpDownMessageType.TabIndex = 1; this.numericUpDownMessageType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.numericUpDownMessageType.ThousandsSeparator = true; - this.toolTips.SetToolTip(this.numericUpDownMessageType, "When the button is held this is the time between the first press and the first re" + - "peat"); + this.toolTips.SetToolTip(this.numericUpDownMessageType, "When the button is held this is the time between the first press and the first repeat"); this.numericUpDownMessageType.Value = new decimal(new int[] { 32768, 0, Modified: trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi 2008-03-06 00:34:39 UTC (rev 1430) +++ trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi 2008-03-06 14:49:18 UTC (rev 1431) @@ -510,9 +510,9 @@ ;====================================== -Section "Virtual Remote and Web Remote" SectionVirtualRemote +Section "Virtual Remote" SectionVirtualRemote - DetailPrint "Installing Virtual Remote and Web Remote..." + DetailPrint "Installing Virtual Remote, Skin Editor, Smart Device versions, and Web Remote..." ; Use the all users context SetShellVarContext all @@ -522,7 +522,8 @@ SetOutPath "$DIR_INSTALL\Virtual Remote" SetOverwrite ifnewer File "Applications\Virtual Remote\bin\Debug\*.*" - File "Applications\Web Remote\bin\Debug\WebRemote.exe" + File "Applications\Web Remote\bin\Debug\WebRemote.*" + File "Applications\Virtual Remote Skin Editor\bin\Debug\VirtualRemoteSkinEditor.*" ; Installing skins CreateDirectory "$DIR_INSTALL\Virtual Remote\Skins" @@ -543,38 +544,16 @@ ; Create start menu shortcut CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Virtual Remote.lnk" "$DIR_INSTALL\Virtual Remote\VirtualRemote.exe" "" "$DIR_INSTALL\Virtual Remote\VirtualRemote.exe" 0 + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Virtual Remote Skin Editor.lnk" "$DIR_INSTALL\Virtual Remote\VirtualRemoteSkinEditor.exe" "" "$DIR_INSTALL\Virtual Remote\VirtualRemoteSkinEditor.exe" 0 + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Virtual Remote for Smart Devices.lnk" "$DIR_INSTALL\Virtual Remote\Smart Devices" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Web Remote.lnk" "$DIR_INSTALL\Virtual Remote\WebRemote.exe" "" "$DIR_INSTALL\Virtual Remote\WebRemote.exe" 0 - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Virtual Remote for Smart Devices.lnk" "$DIR_INSTALL\Virtual Remote\Smart Devices" SectionEnd ;====================================== -Section "Virtual Remote Skin Editor" SectionVirtualRemoteSkinEditor +Section "IR Blast" SectionIRBlast - DetailPrint "Installing Virtual Remote Skin Editor ..." - - ; Use the all users context - SetShellVarContext all - - ; Installing Virtual Remote - CreateDirectory "$DIR_INSTALL\Virtual Remote Skin Editor" - SetOutPath "$DIR_INSTALL\Virtual Remote Skin Editor" - SetOverwrite ifnewer - File "Applications\Virtual Remote Skin Editor\bin\Debug\*.*" - - ; Create folders - CreateDirectory "$APPDATA\${PRODUCT_NAME}\Virtual Remote Skin Editor" - - ; Create start menu shortcut - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}... [truncated message content] |