From: <che...@us...> - 2010-09-08 13:15:21
|
Revision: 3784 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3784&view=rev Author: chef_koch Date: 2010-09-08 13:15:11 +0000 (Wed, 08 Sep 2010) Log Message: ----------- moved extraction of value for a MessageType.RemoteEvent to IRSSComms, values can be easily read from a dictionary now Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Abstractor/MainForm.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Debug Client/MainForm.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Media Center Blaster/Tray.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Forms/GetKeyCodeForm.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/GetKeyCodeForm.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/Tray.cs trunk/plugins/IR Server Suite/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssComms.csproj trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssMessage.cs trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server/IR Server.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Abstractor/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Abstractor/MainForm.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Abstractor/MainForm.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -288,11 +288,8 @@ break; case MessageType.RemoteEvent: - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; RemoteHandlerCallback(deviceName, keyCode); return; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Debug Client/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Debug Client/MainForm.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Debug Client/MainForm.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -203,11 +203,8 @@ break; case MessageType.RemoteEvent: - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; Invoke(_addStatusLine, new Object[] {String.Format("{0} ({1})", deviceName, keyCode)}); return; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Media Center Blaster/Tray.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Media Center Blaster/Tray.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Media Center Blaster/Tray.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -917,11 +917,8 @@ break; case MessageType.RemoteEvent: - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; RemoteHandlerCallback(deviceName, keyCode); break; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Forms/GetKeyCodeForm.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Forms/GetKeyCodeForm.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Forms/GetKeyCodeForm.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -47,11 +47,8 @@ { if (received.Type == MessageType.RemoteEvent) { - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; _deviceName = deviceName; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Program.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Translator/Program.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -794,11 +794,8 @@ switch (received.Type) { case MessageType.RemoteEvent: - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; RemoteHandlerCallback(deviceName, keyCode); break; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/GetKeyCodeForm.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/GetKeyCodeForm.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/GetKeyCodeForm.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -47,11 +47,8 @@ { if (received.Type == MessageType.RemoteEvent) { - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; _deviceName = deviceName; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/Tray.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/Tray.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Tray Launcher/Tray.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -441,11 +441,8 @@ break; case MessageType.RemoteEvent: - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; RemoteHandlerCallback(deviceName, keyCode); break; Modified: trunk/plugins/IR Server Suite/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -695,11 +695,7 @@ case MessageType.RemoteEvent: if (listViewButtons.SelectedItems.Count == 1) { - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; listViewButtons.SelectedItems[0].SubItems[1].Text = keyCode; } Modified: trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssComms.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssComms.csproj 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssComms.csproj 2010-09-08 13:15:11 UTC (rev 3784) @@ -2,7 +2,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.21022</ProductVersion> + <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BCAFDF45-70DD-46FD-8B98-880DDA585AD2}</ProjectGuid> <OutputType>Library</OutputType> Modified: trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssMessage.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssMessage.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/Common/IrssComms/IrssMessage.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -21,12 +21,12 @@ #endregion using System; +using System.Collections.Generic; using System.Diagnostics; using System.Text; namespace IrssComms { - #region Enumerations /// <summary> @@ -194,36 +194,22 @@ [DebuggerDisplay("Type={Type}, Flags={Flags}, Data={GetDataAsString()}")] public class IrssMessage { - #region Members + #region Const - private byte[] _data; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private MessageFlags _flags; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private MessageType _type; + public const string DATA = "DATA"; + public const string DEVICE_NAME = "DEVICE_NAME"; + public const string KEY_CODE = "KEY_CODE"; - #endregion Members + #endregion - #region Properties + #region Protected fields - /// <summary> - /// Type of message. - /// </summary> - public MessageType Type - { - get { return _type; } - set { _type = value; } - } + protected MessageType _messageType; + protected IDictionary<string, object> _messageData = new Dictionary<string, object>(); + protected MessageFlags _messageFlags; - /// <summary> - /// Message flags. - /// </summary> - public MessageFlags Flags - { - get { return _flags; } - set { _flags = value; } - } + #endregion - #endregion Properties - #region Constructors /// <summary> @@ -231,8 +217,8 @@ /// </summary> protected IrssMessage() { - _type = MessageType.Unknown; - _flags = MessageFlags.None; + _messageType = MessageType.Unknown; + _messageFlags = MessageFlags.None; } /// <summary> @@ -242,8 +228,8 @@ /// <param name="flags">The message flags.</param> public IrssMessage(MessageType type, MessageFlags flags) { - _type = type; - _flags = flags; + _messageType = type; + _messageFlags = flags; } /// <summary> @@ -272,6 +258,37 @@ #endregion Constructors + #region Properties + + /// <summary> + /// Gets the type of this message. + /// </summary> + public MessageType Type + { + get { return _messageType; } + } + + /// <summary> + /// Message flags. + /// </summary> + public MessageFlags Flags + { + get { return _messageFlags; } + set { _messageFlags = value; } + } + + /// <summary> + /// Gets or sets the message data. The message data is a generic dictionary special + /// data entries defined by the message queue. + /// </summary> + public IDictionary<string, object> MessageData + { + get { return _messageData; } + set { _messageData = value; } + } + + #endregion Properties + #region Implementation /// <summary> @@ -279,18 +296,22 @@ /// </summary> public byte[] GetDataAsBytes() { - return _data; + if (!_messageData.ContainsKey(DATA)) return null; + + return _messageData[DATA] as byte[]; } /// <summary> /// Set message data as bytes. /// </summary> - public void SetDataAsBytes(byte[] data) + private void SetDataAsBytes(byte[] data) { if (data == null) - _data = null; + _messageData[DATA] = null; else - _data = (byte[]) data.Clone(); + _messageData[DATA] = (byte[])data.Clone(); + + SetMessageData(); } /// <summary> @@ -298,40 +319,62 @@ /// </summary> public string GetDataAsString() { - if (_data == null) - return String.Empty; + if (GetDataAsBytes() == null) return string.Empty; - return Encoding.ASCII.GetString(_data); + return Encoding.ASCII.GetString(GetDataAsBytes()); } /// <summary> /// Set message data as string. /// </summary> - public void SetDataAsString(string data) + private void SetDataAsString(string data) { if (String.IsNullOrEmpty(data)) - _data = null; + _messageData[DATA] = null; else - _data = Encoding.ASCII.GetBytes(data); + _messageData[DATA] = Encoding.ASCII.GetBytes(data); + + SetMessageData(); } /// <summary> + /// Converts data for some messages from bytes to data dictionary for easier reading the values. + /// </summary> + private void SetMessageData() + { + switch (_messageType) + { + case MessageType.RemoteEvent: + byte[] data = GetDataAsBytes(); + + int deviceNameSize = BitConverter.ToInt32(data, 0); + _messageData[DEVICE_NAME] = System.Text.Encoding.ASCII.GetString(data, 4, deviceNameSize); + + int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); + _messageData[KEY_CODE] = System.Text.Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + + break; + } + } + + + /// <summary> /// Turn this Message instance into a byte array. /// </summary> /// <returns>Byte array representation of this Message instance.</returns> public byte[] ToBytes() { int dataLength = 0; - if (_data != null) - dataLength = _data.Length; + if (GetDataAsBytes() != null) + dataLength = GetDataAsBytes().Length; byte[] byteArray = new byte[8 + dataLength]; - BitConverter.GetBytes((int) _type).CopyTo(byteArray, 0); - BitConverter.GetBytes((int) _flags).CopyTo(byteArray, 4); + BitConverter.GetBytes((int)_messageType).CopyTo(byteArray, 0); + BitConverter.GetBytes((int)_messageFlags).CopyTo(byteArray, 4); - if (_data != null) - _data.CopyTo(byteArray, 8); + if (GetDataAsBytes() != null) + GetDataAsBytes().CopyTo(byteArray, 8); return byteArray; } @@ -349,14 +392,15 @@ if (from.Length < 8) throw new ArgumentException("Insufficient bytes to create message", "from"); - MessageType type = (MessageType) BitConverter.ToInt32(from, 0); - MessageFlags flags = (MessageFlags) BitConverter.ToInt32(from, 4); + MessageType type = (MessageType)BitConverter.ToInt32(from, 0); + MessageFlags flags = (MessageFlags)BitConverter.ToInt32(from, 4); if (from.Length == 8) return new IrssMessage(type, flags); byte[] data = new byte[from.Length - 8]; Array.Copy(from, 8, data, 0, data.Length); + return new IrssMessage(type, flags, data); } Modified: trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server/IR Server.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server/IR Server.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server/IR Server.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -231,15 +231,15 @@ { switch (Settings.Mode) { - case IRServerMode.ServerMode: + case IRServerMode.ServerMode: StopServer(); break; - case IRServerMode.RelayMode: + case IRServerMode.RelayMode: StopRelay(); break; - case IRServerMode.RepeaterMode: + case IRServerMode.RepeaterMode: StopRepeater(); break; } @@ -265,11 +265,11 @@ /// <returns>true if the event is handled, otherwise false.</returns> protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus) { - IrssLog.Info("PowerEvent: {0}", Enum.GetName(typeof (PowerBroadcastStatus), powerStatus)); + IrssLog.Info("PowerEvent: {0}", Enum.GetName(typeof(PowerBroadcastStatus), powerStatus)); switch (powerStatus) { - #region Suspend + #region Suspend case PowerBroadcastStatus.Suspend: // TODO: if anyone has any trouble with on-suspend commands then try changing this to QuerySuspend. @@ -315,9 +315,9 @@ } break; - #endregion Suspend + #endregion Suspend - #region Resume + #region Resume case PowerBroadcastStatus.ResumeAutomatic: //case PowerBroadcastStatus.ResumeCritical: @@ -364,7 +364,7 @@ } break; - #endregion Resume + #endregion Resume } return true; @@ -771,7 +771,7 @@ switch (Settings.Mode) { - case IRServerMode.ServerMode: + case IRServerMode.ServerMode: if (Settings.AbstractRemoteMode) { string abstractButton = LookupAbstractButton(deviceName, keyCode); @@ -789,11 +789,11 @@ } break; - case IRServerMode.RelayMode: + case IRServerMode.RelayMode: // Don't do anything in relay mode, just pass it on. break; - case IRServerMode.RepeaterMode: + case IRServerMode.RepeaterMode: IrssLog.Debug("Remote event ignored, IR Server is in Repeater Mode."); return; } @@ -810,14 +810,14 @@ switch (Settings.Mode) { - case IRServerMode.ServerMode: + case IRServerMode.ServerMode: { IrssMessage message = new IrssMessage(MessageType.RemoteEvent, MessageFlags.Notify, bytes); SendToAll(message); break; } - case IRServerMode.RelayMode: + case IRServerMode.RelayMode: { IrssMessage message = new IrssMessage(MessageType.ForwardRemoteEvent, MessageFlags.Request, bytes); _client.Send(message); @@ -836,21 +836,21 @@ switch (Settings.Mode) { - case IRServerMode.ServerMode: + case IRServerMode.ServerMode: { IrssMessage message = new IrssMessage(MessageType.KeyboardEvent, MessageFlags.Notify, bytes); SendToAll(message); break; } - case IRServerMode.RelayMode: + case IRServerMode.RelayMode: { IrssMessage message = new IrssMessage(MessageType.ForwardKeyboardEvent, MessageFlags.Request, bytes); _client.Send(message); break; } - case IRServerMode.RepeaterMode: + case IRServerMode.RepeaterMode: { IrssLog.Debug("Keyboard event ignored, IR Server is in Repeater Mode."); break; @@ -870,21 +870,21 @@ switch (Settings.Mode) { - case IRServerMode.ServerMode: + case IRServerMode.ServerMode: { IrssMessage message = new IrssMessage(MessageType.MouseEvent, MessageFlags.Notify, bytes); SendToAll(message); break; } - case IRServerMode.RelayMode: + case IRServerMode.RelayMode: { IrssMessage message = new IrssMessage(MessageType.ForwardMouseEvent, MessageFlags.Request, bytes); _client.Send(message); break; } - case IRServerMode.RepeaterMode: + case IRServerMode.RepeaterMode: { IrssLog.Debug("Mouse event ignored, IR Server is in Repeater Mode."); break; @@ -1141,10 +1141,10 @@ { switch (combo.Message.Type) { - #region ForwardRemoteEvent + #region ForwardRemoteEvent case MessageType.ForwardRemoteEvent: - if (Settings.Mode == IRServerMode.RelayMode) + if (Settings.Mode == IRServerMode.RelayMode) { IrssMessage forward = new IrssMessage(MessageType.ForwardRemoteEvent, MessageFlags.Request, combo.Message.GetDataAsBytes()); @@ -1213,9 +1213,9 @@ } break; - #endregion ForwardRemoteEvent + #endregion ForwardRemoteEvent - #region ForwardKeyboardEvent + #region ForwardKeyboardEvent case MessageType.ForwardKeyboardEvent: if (Settings.Mode == IRServerMode.RelayMode) @@ -1232,9 +1232,9 @@ } break; - #endregion ForwardKeyboardEvent + #endregion ForwardKeyboardEvent - #region ForwardMouseEvent + #region ForwardMouseEvent case MessageType.ForwardMouseEvent: if (Settings.Mode == IRServerMode.RelayMode) @@ -1251,9 +1251,9 @@ } break; - #endregion ForwardMouseEvent + #endregion ForwardMouseEvent - #region BlastIR + #region BlastIR case MessageType.BlastIR: { @@ -1280,9 +1280,9 @@ break; } - #endregion BlastIR + #endregion BlastIR - #region LearnIR + #region LearnIR case MessageType.LearnIR: { @@ -1318,9 +1318,9 @@ break; } - #endregion LearnIR + #endregion LearnIR - #region ServerShutdown + #region ServerShutdown case MessageType.ServerShutdown: if ((combo.Message.Flags & MessageFlags.Request) == MessageFlags.Request) @@ -1330,9 +1330,9 @@ } break; - #endregion ServerShutdown + #endregion ServerShutdown - #region RegisterClient + #region RegisterClient case MessageType.RegisterClient: { @@ -1364,17 +1364,17 @@ break; } - #endregion RegisterClient + #endregion RegisterClient - #region UnregisterClient + #region UnregisterClient case MessageType.UnregisterClient: UnregisterClient(combo.Manager); break; - #endregion UnregisterClient + #endregion UnregisterClient - #region RegisterRepeater + #region RegisterRepeater case MessageType.RegisterRepeater: { @@ -1389,17 +1389,17 @@ break; } - #endregion RegisterRepeater + #endregion RegisterRepeater - #region UnregisterRepeater + #region UnregisterRepeater case MessageType.UnregisterRepeater: UnregisterRepeater(combo.Manager); break; - #endregion UnregisterRepeater + #endregion UnregisterRepeater - #region ActiveBlasters + #region ActiveBlasters case MessageType.ActiveBlasters: { @@ -1410,9 +1410,9 @@ break; } - #endregion ActiveBlasters + #endregion ActiveBlasters - #region ActiveReceivers + #region ActiveReceivers case MessageType.ActiveReceivers: { @@ -1440,9 +1440,9 @@ break; } - #endregion ActiveReceivers + #endregion ActiveReceivers - #region AvailableBlasters + #region AvailableBlasters case MessageType.AvailableBlasters: { @@ -1476,9 +1476,9 @@ break; } - #endregion AvailableBlasters + #endregion AvailableBlasters - #region AvailableReceivers + #region AvailableReceivers case MessageType.AvailableReceivers: { @@ -1512,9 +1512,9 @@ break; } - #endregion AvailableReceivers + #endregion AvailableReceivers - #region DetectedBlasters + #region DetectedBlasters case MessageType.DetectedBlasters: { @@ -1543,9 +1543,9 @@ break; } - #endregion DetectedBlasters + #endregion DetectedBlasters - #region DetectedReceivers + #region DetectedReceivers case MessageType.DetectedReceivers: { @@ -1574,7 +1574,7 @@ break; } - #endregion DetectedReceivers + #endregion DetectedReceivers } } catch (Exception ex) @@ -1717,20 +1717,20 @@ public bool DoStart() { - this.OnStart(new string[] { }); - return true; + this.OnStart(new string[] { }); + return true; } public bool DoStop() { - this.OnStop(); - return true; + this.OnStop(); + return true; } public bool DoPowerEvent(PowerBroadcastStatus powerStatus) { - this.OnPowerEvent(powerStatus); - return true; + this.OnPowerEvent(powerStatus); + return true; } #endregion Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -160,11 +160,8 @@ { if (received.Type == MessageType.RemoteEvent) { - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + //string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; // TODO: Activate this code for 1.4.3 //if (deviceName.Equals("Abstract", StringComparison.OrdinalIgnoreCase)) Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs 2010-09-07 16:05:46 UTC (rev 3783) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs 2010-09-08 13:15:11 UTC (rev 3784) @@ -791,11 +791,8 @@ case MessageType.RemoteEvent: if (!_inConfiguration) { - byte[] data = received.GetDataAsBytes(); - int deviceNameSize = BitConverter.ToInt32(data, 0); - string deviceName = Encoding.ASCII.GetString(data, 4, deviceNameSize); - int keyCodeSize = BitConverter.ToInt32(data, 4 + deviceNameSize); - string keyCode = Encoding.ASCII.GetString(data, 8 + deviceNameSize, keyCodeSize); + string deviceName = received.MessageData[IrssMessage.DEVICE_NAME] as string; + string keyCode = received.MessageData[IrssMessage.KEY_CODE] as string; RemoteHandler(deviceName, keyCode); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |