From: <an...@us...> - 2008-03-03 22:47:31
|
Revision: 1418 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1418&view=rev Author: and-81 Date: 2008-03-03 14:47:28 -0800 (Mon, 03 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.cs trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs Modified: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs 2008-03-03 17:13:43 UTC (rev 1417) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs 2008-03-03 22:47:28 UTC (rev 1418) @@ -12,6 +12,8 @@ namespace DboxTuner { + #region Enumerations + internal enum StbBoxType { Unknown, @@ -20,6 +22,8 @@ Neutrino, } + #endregion Enumerations + /// <summary> /// Based on MyDbox MediaPortal plugin by Mark Koenig (kroko). /// </summary> @@ -250,8 +254,10 @@ using (StreamReader reader = new StreamReader(receiveStream, encode)) return reader.ReadToEnd(); } - catch + catch (Exception ex) { + IrssLog.Error(ex); + return String.Empty; } } @@ -466,9 +472,9 @@ ds.Tables.Add(table); } - catch + catch (Exception ex) { - + IrssLog.Error(ex); } #endregion Convert data to dataset Modified: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs 2008-03-03 17:13:43 UTC (rev 1417) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs 2008-03-03 22:47:28 UTC (rev 1418) @@ -1,36 +1,13 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - using System; using System.Collections; using System.ComponentModel; -using System.IO; -using System.Windows.Forms; using System.Data; using System.Diagnostics; +using System.IO; +using System.Windows.Forms; +using IrssUtils; + namespace DboxTuner { @@ -271,16 +248,25 @@ bouquets.WriteXml(Program.DataFile, XmlWriteMode.WriteSchema); } } - catch + catch (Exception ex) { StatusMessage("ERROR - Cannot read bouquet!"); + IrssLog.Error(ex); + + MessageBox.Show(this, ex.ToString(), "Dbox Tuner - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } void StatusMessage(string format, params object[] args) { - toolStripStatusLabel.Text = String.Format(format, args); + string message = String.Format(format, args); + toolStripStatusLabel.Text = message; statusStrip.Update(); + + if (message.StartsWith("ERROR", StringComparison.OrdinalIgnoreCase)) + IrssLog.Error(message); + else + IrssLog.Info(message); } private void buttonOK_Click(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-03-03 17:13:43 UTC (rev 1417) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-03-03 22:47:28 UTC (rev 1418) @@ -999,9 +999,19 @@ { IrssLog.Info("Blast IR"); - if (_pluginTransmit == null || !(_pluginTransmit is ITransmitIR)) + if (_pluginTransmit == null) + { + IrssLog.Warn("No transmit plugin loaded, can't blast"); return false; + } + ITransmitIR _blaster = _pluginTransmit as ITransmitIR; + if (_blaster == null) + { + IrssLog.Error("Active transmit plugin doesn't support blasting!"); + return false; + } + string port = "Default"; int portLen = BitConverter.ToInt32(data, 0); @@ -1011,7 +1021,7 @@ byte[] codeData = new byte[data.Length - (4 + portLen)]; Array.Copy(data, 4 + portLen, codeData, 0, codeData.Length); - return (_pluginTransmit as ITransmitIR).Transmit(port, codeData); + return _blaster.Transmit(port, codeData); } catch (Exception ex) { @@ -1030,7 +1040,9 @@ IrssLog.Warn("No transmit plugin loaded, can't learn"); return LearnStatus.Failure; } - else if (!(_pluginTransmit is ILearnIR)) + + ILearnIR _learner = _pluginTransmit as ILearnIR; + if (_learner == null) { IrssLog.Warn("Active transmit plugin doesn't support learn"); return LearnStatus.Failure; @@ -1042,7 +1054,7 @@ try { - status = (_pluginTransmit as ILearnIR).Learn(out data); + status = _learner.Learn(out data); switch (status) { case LearnStatus.Success: Modified: trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs 2008-03-03 17:13:43 UTC (rev 1417) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs 2008-03-03 22:47:28 UTC (rev 1418) @@ -988,9 +988,19 @@ { IrssLog.Info("Blast IR"); - if (_pluginTransmit == null || !(_pluginTransmit is ITransmitIR)) + if (_pluginTransmit == null) + { + IrssLog.Warn("No transmit plugin loaded, can't blast"); return false; + } + ITransmitIR _blaster = _pluginTransmit as ITransmitIR; + if (_blaster == null) + { + IrssLog.Error("Active transmit plugin doesn't support blasting!"); + return false; + } + string port = "Default"; int portLen = BitConverter.ToInt32(data, 0); @@ -1000,7 +1010,7 @@ byte[] codeData = new byte[data.Length - (4 + portLen)]; Array.Copy(data, 4 + portLen, codeData, 0, codeData.Length); - return (_pluginTransmit as ITransmitIR).Transmit(port, codeData); + return _blaster.Transmit(port, codeData); } catch (Exception ex) { @@ -1019,7 +1029,9 @@ IrssLog.Warn("No transmit plugin loaded, can't learn"); return LearnStatus.Failure; } - else if (!(_pluginTransmit is ILearnIR)) + + ILearnIR _learner = _pluginTransmit as ILearnIR; + if (_learner == null) { IrssLog.Warn("Active transmit plugin doesn't support learn"); return LearnStatus.Failure; @@ -1031,7 +1043,7 @@ try { - status = (_pluginTransmit as ILearnIR).Learn(out data); + status = _learner.Learn(out data); switch (status) { case LearnStatus.Success: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |