From: <an...@us...> - 2007-09-10 16:07:08
|
Revision: 910 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=910&view=rev Author: and-81 Date: 2007-09-10 09:07:01 -0700 (Mon, 10 Sep 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Debug Client/Debug Client.csproj 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/Debug Client/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/IR Blast/IR Blast.csproj trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs trunk/plugins/IR Server Suite/Applications/IR Blast/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/IR Blast (No Window).csproj trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/IR File Tool.csproj trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs trunk/plugins/IR Server Suite/Applications/IR Server/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/SageSetup/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/GetKeyCodeForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/LearnIR.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj trunk/plugins/IR Server Suite/Applications/Tray Launcher/GetKeyCodeForm.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote/Virtual Remote.csproj trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/Virtual Remote Skin Editor.csproj trunk/plugins/IR Server Suite/IPC/AppModule.InterProcessComm/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IPC/AppModule.NamedPipes/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IPC/Named Pipes/PipeAccess.cs trunk/plugins/IR Server Suite/IPC/Named Pipes/PipeMessage.cs trunk/plugins/IR Server Suite/IPC/Named Pipes/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/FusionRemote Receiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IR Server Plugin Interface.csproj trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/IRMan Receiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/IRTrans Transceiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/Windows Message Receiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/X10 Transceiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/XBCDRC Receiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Suite.sln trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/LearnIR.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/MPBlastZonePlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/LearnIR.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/LearnIR.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/LearnIR.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/TV3BlasterPlugin.cs Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/Debug Client.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/Debug Client.csproj 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/Debug Client.csproj 2007-09-10 16:07:01 UTC (rev 910) @@ -47,7 +47,7 @@ <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <DebugType> </DebugType> - <PlatformTarget>AnyCPU</PlatformTarget> + <PlatformTarget>x86</PlatformTarget> <ErrorReport>prompt</ErrorReport> </PropertyGroup> <ItemGroup> Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.Designer.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -38,7 +38,6 @@ this.buttonShutdownServer = new System.Windows.Forms.Button(); this.listBoxStatus = new System.Windows.Forms.ListBox(); this.buttonCrash = new System.Windows.Forms.Button(); - this.buttonListConnected = new System.Windows.Forms.Button(); this.buttonPing = new System.Windows.Forms.Button(); this.groupBoxGenerateMessage = new System.Windows.Forms.GroupBox(); this.textBoxCustom = new System.Windows.Forms.TextBox(); @@ -69,7 +68,7 @@ this.buttonBlast.Location = new System.Drawing.Point(8, 48); this.buttonBlast.Name = "buttonBlast"; this.buttonBlast.Size = new System.Drawing.Size(64, 24); - this.buttonBlast.TabIndex = 2; + this.buttonBlast.TabIndex = 1; this.buttonBlast.Text = "Blast IR"; this.toolTips.SetToolTip(this.buttonBlast, "Blast learned IR code"); this.buttonBlast.UseVisualStyleBackColor = true; @@ -123,10 +122,10 @@ // buttonShutdownServer // this.buttonShutdownServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonShutdownServer.Location = new System.Drawing.Point(296, 16); + this.buttonShutdownServer.Location = new System.Drawing.Point(296, 48); this.buttonShutdownServer.Name = "buttonShutdownServer"; this.buttonShutdownServer.Size = new System.Drawing.Size(64, 24); - this.buttonShutdownServer.TabIndex = 5; + this.buttonShutdownServer.TabIndex = 4; this.buttonShutdownServer.Text = "Shutdown"; this.toolTips.SetToolTip(this.buttonShutdownServer, "Shutdown server"); this.buttonShutdownServer.UseVisualStyleBackColor = true; @@ -150,34 +149,22 @@ // buttonCrash // this.buttonCrash.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonCrash.Location = new System.Drawing.Point(368, 16); + this.buttonCrash.Location = new System.Drawing.Point(368, 48); this.buttonCrash.Name = "buttonCrash"; this.buttonCrash.Size = new System.Drawing.Size(64, 24); - this.buttonCrash.TabIndex = 6; + this.buttonCrash.TabIndex = 5; this.buttonCrash.Text = "Crash"; this.toolTips.SetToolTip(this.buttonCrash, "Crash this program"); this.buttonCrash.UseVisualStyleBackColor = true; this.buttonCrash.Click += new System.EventHandler(this.buttonCrash_Click); // - // buttonListConnected - // - this.buttonListConnected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonListConnected.Location = new System.Drawing.Point(368, 48); - this.buttonListConnected.Name = "buttonListConnected"; - this.buttonListConnected.Size = new System.Drawing.Size(64, 24); - this.buttonListConnected.TabIndex = 8; - this.buttonListConnected.Text = "# clients"; - this.toolTips.SetToolTip(this.buttonListConnected, "Get client count from server"); - this.buttonListConnected.UseVisualStyleBackColor = true; - this.buttonListConnected.Click += new System.EventHandler(this.buttonListConnected_Click); - // // buttonPing // this.buttonPing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonPing.Location = new System.Drawing.Point(296, 48); + this.buttonPing.Location = new System.Drawing.Point(368, 16); this.buttonPing.Name = "buttonPing"; this.buttonPing.Size = new System.Drawing.Size(64, 24); - this.buttonPing.TabIndex = 7; + this.buttonPing.TabIndex = 3; this.buttonPing.Text = "Ping"; this.toolTips.SetToolTip(this.buttonPing, "Ping the server"); this.buttonPing.UseVisualStyleBackColor = true; @@ -334,7 +321,6 @@ this.groupBoxCommands.Controls.Add(this.buttonBlast); this.groupBoxCommands.Controls.Add(this.buttonLearnIR); this.groupBoxCommands.Controls.Add(this.buttonShutdownServer); - this.groupBoxCommands.Controls.Add(this.buttonListConnected); this.groupBoxCommands.Controls.Add(this.buttonPing); this.groupBoxCommands.Location = new System.Drawing.Point(8, 80); this.groupBoxCommands.Name = "groupBoxCommands"; @@ -350,7 +336,7 @@ this.comboBoxPort.Location = new System.Drawing.Point(80, 50); this.comboBoxPort.Name = "comboBoxPort"; this.comboBoxPort.Size = new System.Drawing.Size(80, 21); - this.comboBoxPort.TabIndex = 3; + this.comboBoxPort.TabIndex = 2; this.toolTips.SetToolTip(this.comboBoxPort, "Port for blasting IR"); // // buttonIRBlastAutoTest @@ -417,7 +403,6 @@ private System.Windows.Forms.Button buttonShutdownServer; private System.Windows.Forms.ListBox listBoxStatus; private System.Windows.Forms.Button buttonCrash; - private System.Windows.Forms.Button buttonListConnected; private System.Windows.Forms.Button buttonPing; private System.Windows.Forms.GroupBox groupBoxGenerateMessage; private System.Windows.Forms.TextBox textBoxCustom; Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -163,91 +163,57 @@ { PipeMessage received = PipeMessage.FromString(message); - this.Invoke(_AddStatusLine, new Object[] { String.Format("Received Message: \"{0}\"", received.Name) }); + this.Invoke(_AddStatusLine, new Object[] { String.Format("Received Message: \"{0}\"", Enum.GetName(typeof(PipeMessageType), received.Type)) }); try { - switch (received.Name) + switch (received.Type) { - case "Blast Success": - case "Blast Failure": - case "Keyboard Event": - case "Mouse Event": + case PipeMessageType.RegisterClient: + if ((received.Flags & PipeMessageFlags.Success) == PipeMessageFlags.Success) + { + _irServerInfo = IRServerInfo.FromBytes(received.DataAsBytes); + comboBoxPort.Items.Clear(); + comboBoxPort.Items.AddRange(_irServerInfo.Ports); + comboBoxPort.SelectedIndex = 0; + } + else if ((received.Flags & PipeMessageFlags.Failure) == PipeMessageFlags.Failure) + { + if (PipeAccess.ServerRunning) + PipeAccess.StopServer(); + } return; - case "Clients": - { - string clients = String.Format("There are {0} client(s) attached to the server", BitConverter.ToInt32(received.Data, 0)); - this.Invoke(_AddStatusLine, new Object[] { clients }); + case PipeMessageType.RemoteEvent: + RemoteHandlerCallback(received.DataAsString); return; - } - case "Register Success": - { - _irServerInfo = IRServerInfo.FromBytes(received.Data); + case PipeMessageType.LearnIR: + if ((received.Flags & PipeMessageFlags.Success) == PipeMessageFlags.Success) + { + byte[] dataBytes = received.DataAsBytes; - comboBoxPort.Items.Clear(); - comboBoxPort.Items.AddRange(_irServerInfo.Ports); - comboBoxPort.SelectedIndex = 0; - return; - } + FileStream file = new FileStream(_learnIRFilename, FileMode.Create); + file.Write(dataBytes, 0, dataBytes.Length); + file.Close(); + } - case "Register Failure": - { - if (PipeAccess.ServerRunning) - PipeAccess.StopServer(); - return; - } - - case "Remote Event": - { - string keyCode = Encoding.ASCII.GetString(received.Data); - RemoteHandlerCallback(keyCode); - return; - } - - case "Learn Success": - { - FileStream file = new FileStream(_learnIRFilename, FileMode.Create, FileAccess.Write, FileShare.None); - file.Write(received.Data, 0, received.Data.Length); - file.Flush(); - file.Close(); - _learnIRFilename = null; - return; - } + break; - case "Learn Failure": - { - _learnIRFilename = null; - return; - } - - - case "Server Shutdown": - { + case PipeMessageType.ServerShutdown: if (PipeAccess.ServerRunning) PipeAccess.StopServer(); return; - } - case "Echo": - { - _echoID = BitConverter.ToInt32(received.Data, 0); - break; - } - - case "Error": - { - this.Invoke(_AddStatusLine, new Object[] { Encoding.ASCII.GetString(received.Data) }); + case PipeMessageType.Echo: + _echoID = BitConverter.ToInt32(received.DataAsBytes, 0); return; - } - default: - { - this.Invoke(_AddStatusLine, new Object[] { "Unknown message received: " + received.Name }); + case PipeMessageType.Error: + _learnIRFilename = null; + this.Invoke(_AddStatusLine, new Object[] { received.DataAsString }); return; - } } } catch (Exception ex) @@ -292,8 +258,8 @@ } while (retry); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Register", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.RegisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); return true; } @@ -307,8 +273,8 @@ _learnIRFilename = fileName; - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Learn", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.LearnIR, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); AddStatusLine("Learning"); } @@ -337,8 +303,8 @@ file.Read(outData, 4 + port.Length, (int)file.Length); file.Close(); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Blast", outData); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.BlastIR, PipeMessageFlags.Request, outData); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); } catch (Exception ex) { @@ -392,8 +358,8 @@ try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Unregister", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.UnregisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); } catch (Exception ex) { @@ -460,8 +426,8 @@ try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Shutdown", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.ServerShutdown, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); } catch (Exception ex) { @@ -472,26 +438,6 @@ { throw new System.InvalidOperationException("User initiated exception thrown"); } - private void buttonListConnected_Click(object sender, EventArgs e) - { - AddStatusLine("List Clients"); - - if (!PipeAccess.ServerRunning) - { - AddStatusLine(" - Not connected"); - return; - } - - try - { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "List", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); - } - catch (Exception ex) - { - AddStatusLine(ex.Message); - } - } private void buttonPing_Click(object sender, EventArgs e) { AddStatusLine("Ping Server"); @@ -504,8 +450,8 @@ try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Ping", BitConverter.GetBytes(24)); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.Ping, PipeMessageFlags.Request, BitConverter.GetBytes(24)); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); } catch (Exception ex) { @@ -522,8 +468,10 @@ if (PipeMessage.FromString(textBoxCustom.Text) == null) AddStatusLine("Warning: The specified custom message is not a valid message structure"); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, textBoxCustom.Text); + PipeMessage customMessage = PipeMessage.FromString(textBoxCustom.Text); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, customMessage); + AddStatusLine("Custom message sent"); } catch (Exception ex) @@ -565,8 +513,8 @@ BitConverter.GetBytes(keyCode).CopyTo(data, 0); BitConverter.GetBytes(0).CopyTo(data, 4); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Forward Remote Event", data); - PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.ForwardRemoteEvent, PipeMessageFlags.None, data); + PipeAccess.SendMessage(Common.ServerPipeName, _serverAddress, message); } catch (Exception ex) { Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Debug Client/Properties/AssemblyInfo.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/Debug Client/Properties/AssemblyInfo.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -37,3 +37,4 @@ [assembly: AssemblyFileVersion("1.0.3.4")] [assembly: CLSCompliant(true)] +[assembly: GuidAttribute("8eeb5fcb-322c-45ee-80a9-3d30cc08a48c")] Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/IR Blast.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast/IR Blast.csproj 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Blast/IR Blast.csproj 2007-09-10 16:07:01 UTC (rev 910) @@ -49,7 +49,7 @@ <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <DebugType> </DebugType> - <PlatformTarget>AnyCPU</PlatformTarget> + <PlatformTarget>x86</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> </PropertyGroup> Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -249,8 +249,8 @@ { _registered = false; - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Unregister", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.UnregisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); } } catch { } @@ -305,8 +305,8 @@ { try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Register", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.RegisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); return true; } catch (AppModule.NamedPipes.NamedPipeIOException) @@ -388,8 +388,8 @@ try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Ping", BitConverter.GetBytes(pingID)); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.Ping, PipeMessageFlags.Request, BitConverter.GetBytes(pingID)); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); } catch { @@ -441,64 +441,45 @@ { PipeMessage received = PipeMessage.FromString(message); - IrssLog.Debug("Received Message \"{0}\"", received.Name); + IrssLog.Debug("Received Message \"{0}\"", Enum.GetName(typeof(PipeMessageType), received.Type)); try { - switch (received.Name) + switch (received.Type) { - case "Remote Event": - case "Keyboard Event": - case "Mouse Event": + case PipeMessageType.BlastIR: + if ((received.Flags & PipeMessageFlags.Success) == PipeMessageFlags.Success) + Info("Blast Success"); + else if ((received.Flags & PipeMessageFlags.Failure) == PipeMessageFlags.Failure) + Warn("Blast Failed!"); break; - case "Blast Success": - Info("Blast Success"); - break; - - case "Blast Failure": - Warn("Blast Failed!"); - break; - - case "Register Success": + case PipeMessageType.RegisterClient: + if ((received.Flags & PipeMessageFlags.Success) == PipeMessageFlags.Success) { Info("Registered to IR Server"); _registered = true; - //_irServerInfo = TransceiverInfo.FromBytes(received.Data); - break; + //_irServerInfo = TransceiverInfo.FromString(received.Data); } - - case "Register Failure": + else if ((received.Flags & PipeMessageFlags.Failure) == PipeMessageFlags.Failure) { - Warn("IR Server refused to register"); _registered = false; - break; + Warn("IR Server refused to register"); } + break; - case "Server Shutdown": - { - Warn("IR Server Shutdown - Blasting disabled until IR Server returns"); - _registered = false; - break; - } + case PipeMessageType.ServerShutdown: + _registered = false; + Warn("IR Server Shutdown - Blasting disabled until IR Server returns"); + break; - case "Echo": - { - _echoID = BitConverter.ToInt32(received.Data, 0); - break; - } + case PipeMessageType.Echo: + _echoID = BitConverter.ToInt32(received.DataAsBytes, 0); + break; - case "Error": - { - Warn(Encoding.ASCII.GetString(received.Data)); - break; - } - - default: - { - Warn("Unknown message received from server: " + received.Name); - break; - } + case PipeMessageType.Error: + Warn(received.DataAsString); + break; } } catch (Exception ex) @@ -519,8 +500,8 @@ file.Read(outData, 4 + port.Length, (int)file.Length); file.Close(); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Blast", outData); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.BlastIR, PipeMessageFlags.Request, outData); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); } #region Log Commands Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast/Properties/AssemblyInfo.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Blast/Properties/AssemblyInfo.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -36,4 +36,5 @@ [assembly: AssemblyVersion("1.0.3.4")] [assembly: AssemblyFileVersion("1.0.3.4")] -[assembly: CLSCompliant(true)] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: GuidAttribute("5eeca936-da49-4952-ab3b-9f11ec57e4aa")] Modified: trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/IR Blast (No Window).csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/IR Blast (No Window).csproj 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/IR Blast (No Window).csproj 2007-09-10 16:07:01 UTC (rev 910) @@ -49,7 +49,7 @@ <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <DebugType> </DebugType> - <PlatformTarget>AnyCPU</PlatformTarget> + <PlatformTarget>x86</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> </PropertyGroup> Modified: trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -211,8 +211,8 @@ { _registered = false; - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Unregister", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.UnregisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); } } catch { } @@ -267,8 +267,8 @@ { try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Register", null); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.RegisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); return true; } catch (AppModule.NamedPipes.NamedPipeIOException) @@ -350,8 +350,8 @@ try { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Ping", BitConverter.GetBytes(pingID)); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.Ping, PipeMessageFlags.Request, BitConverter.GetBytes(pingID)); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); } catch { @@ -403,64 +403,45 @@ { PipeMessage received = PipeMessage.FromString(message); - IrssLog.Debug("Received Message \"{0}\"", received.Name); + IrssLog.Debug("Received Message \"{0}\"", Enum.GetName(typeof(PipeMessageType), received.Type)); try { - switch (received.Name) + switch (received.Type) { - case "Remote Event": - case "Keyboard Event": - case "Mouse Event": + case PipeMessageType.BlastIR: + if ((received.Flags & PipeMessageFlags.Success) == PipeMessageFlags.Success) + IrssLog.Info("Blast Success"); + else if ((received.Flags & PipeMessageFlags.Failure) == PipeMessageFlags.Failure) + IrssLog.Warn("Blast Failed!"); break; - case "Blast Success": - IrssLog.Info("Blast Success"); - break; - - case "Blast Failure": - IrssLog.Warn("Blast Failed!"); - break; - - case "Register Success": + case PipeMessageType.RegisterClient: + if ((received.Flags & PipeMessageFlags.Success) == PipeMessageFlags.Success) { IrssLog.Info("Registered to IR Server"); _registered = true; - //_irServerInfo = TransceiverInfo.FromBytes(received.Data); - break; + //_irServerInfo = TransceiverInfo.FromString(received.Data); } - - case "Register Failure": + else if ((received.Flags & PipeMessageFlags.Failure) == PipeMessageFlags.Failure) { - IrssLog.Warn("IR Server refused to register"); _registered = false; - break; + IrssLog.Warn("IR Server refused to register"); } + break; - case "Server Shutdown": - { - IrssLog.Warn("IR Server Shutdown - Blasting disabled until IR Server returns"); - _registered = false; - break; - } + case PipeMessageType.ServerShutdown: + _registered = false; + IrssLog.Warn("IR Server Shutdown - Blasting disabled until IR Server returns"); + break; - case "Echo": - { - _echoID = BitConverter.ToInt32(received.Data, 0); - break; - } + case PipeMessageType.Echo: + _echoID = BitConverter.ToInt32(received.DataAsBytes, 0); + break; - case "Error": - { - IrssLog.Warn(Encoding.ASCII.GetString(received.Data)); - break; - } - - default: - { - IrssLog.Warn("Unknown message received from server: " + received.Name); - break; - } + case PipeMessageType.Error: + IrssLog.Warn(received.DataAsString); + break; } } catch (Exception ex) @@ -481,8 +462,8 @@ file.Read(outData, 4 + port.Length, (int)file.Length); file.Close(); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Blast", outData); - PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.BlastIR, PipeMessageFlags.Request, outData); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message); } } Modified: trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Properties/AssemblyInfo.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Properties/AssemblyInfo.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -36,4 +36,5 @@ [assembly: AssemblyVersion("1.0.3.4")] [assembly: AssemblyFileVersion("1.0.3.4")] -[assembly: CLSCompliant(true)] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: GuidAttribute("81eb136b-cc74-4eed-976d-f96ebccd1ce4")] 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 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -1,4 +1,4 @@ -namespace IR_File_Tool +namespace IrFileTool { partial class FormMain { @@ -28,9 +28,17 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.SuspendLayout(); + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "Form1"; + this.ClientSize = new System.Drawing.Size(284, 264); + this.Name = "FormMain"; + this.Text = "IR File Tool"; + this.ResumeLayout(false); + } #endregion Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -6,7 +6,7 @@ using System.Text; using System.Windows.Forms; -namespace IR_File_Tool +namespace IrFileTool { public partial class FormMain : Form { Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/IR File Tool.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/IR File Tool.csproj 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/IR File Tool.csproj 2007-09-10 16:07:01 UTC (rev 910) @@ -7,8 +7,11 @@ <ProjectGuid>{B5E711A2-E6D0-4BEA-B66B-7A8B0BCA6A4D}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>IR_File_Tool</RootNamespace> + <RootNamespace>IRFileTool</RootNamespace> <AssemblyName>IR File Tool</AssemblyName> + <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> + <StartupObject> + </StartupObject> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -37,11 +40,14 @@ </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>bin\x86\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> + <DefineConstants> + </DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>x86</PlatformTarget> <ErrorReport>prompt</ErrorReport> + <UseVSHostingProcess>false</UseVSHostingProcess> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> <Reference Include="System" /> @@ -61,6 +67,12 @@ <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="FormMain.resx"> + <SubType>Designer</SubType> + <DependentUpon>FormMain.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -2,10 +2,12 @@ using System.Collections.Generic; using System.Windows.Forms; -namespace IR_File_Tool +namespace IrFileTool { + static class Program { + /// <summary> /// The main entry point for the application. /// </summary> @@ -16,5 +18,7 @@ Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); } + } -} \ No newline at end of file + +} Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/Properties/AssemblyInfo.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/Properties/AssemblyInfo.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -8,9 +8,9 @@ [assembly: AssemblyTitle("IR File Tool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("and-81")] [assembly: AssemblyProduct("IR File Tool")] -[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyCopyright("Aaron Dinnage")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -144,8 +144,9 @@ { checkBoxRunAtBoot.Checked = SystemRegistry.GetAutoRun("IR Server"); } - catch + catch (Exception ex) { + IrssLog.Error(ex.ToString()); } ArrayList networkPCs = IrssUtils.Win32.GetNetworkComputers(); Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj 2007-09-10 16:07:01 UTC (rev 910) @@ -71,7 +71,7 @@ <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <DebugType> </DebugType> - <PlatformTarget>AnyCPU</PlatformTarget> + <PlatformTarget>x86</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> </PropertyGroup> Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-09-10 14:16:47 UTC (rev 909) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-09-10 16:07:01 UTC (rev 910) @@ -116,21 +116,33 @@ if (String.IsNullOrEmpty(_pluginNameReceive) && String.IsNullOrEmpty(_pluginNameTransmit)) { - IrssLog.Warn("No transmit/receive plugin loaded"); + IrssLog.Warn("No transmit or receive plugin loaded"); } else { - if (!String.IsNullOrEmpty(_pluginNameReceive)) - _pluginReceive = Program.GetPlugin(_pluginNameReceive); - else + if (String.IsNullOrEmpty(_pluginNameReceive)) + { IrssLog.Warn("No receiver plugin loaded"); + } + else + { + _pluginReceive = Program.GetPlugin(_pluginNameReceive); + } if (_pluginNameTransmit.Equals(_pluginNameReceive, StringComparison.InvariantCultureIgnoreCase)) + { _pluginTransmit = _pluginReceive; - else if (!String.IsNullOrEmpty(_pluginNameTransmit)) - _pluginTransmit = Program.GetPlugin(_pluginNameTransmit); - else + IrssLog.Info("Using the same plugin for transmit and receive"); + } + else if (String.IsNullOrEmpty(_pluginNameTransmit)) + { IrssLog.Warn("No transmit plugin loaded"); + } + else + { + _pluginTransmit = Program.GetPlugin(_pluginNameTransmit); + } + } StartMessageQueue(); @@ -185,6 +197,7 @@ IrssLog.Error(ex.ToString()); } } + if (!_pluginNameTransmit.Equals(_pluginNameReceive, StringComparison.InvariantCultureIgnoreCase)) { if (_pluginTransmit != null) @@ -244,7 +257,7 @@ if (_mode == IRServerMode.ServerMode) { - PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Server Shutdown", null); + PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.ServerShutdown, PipeMessageFlags.Request); SendToAll(message); } @@ -418,8 +431,8 @@ } while (retry); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Register", null); - PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.RegisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message); } catch (Exception ex) { @@ -437,8 +450,8 @@ { _registered = false; - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Unregister", null); - PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.UnregisterClient, PipeMessageFlags.Request); + PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message); } } catch { } @@ -485,8 +498,8 @@ } while (retry); - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Register Repeater", null); - PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.RegisterRepeater); + PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message); } catch (Exception ex) { @@ -504,8 +517,8 @@ { _registered = false; - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Unregister Repeater", null); - PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message.ToString()); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.UnregisterRepeater); + PipeAccess.SendMessage(Common.ServerPipeName, _hostComputer, message); } } catch { } @@ -528,14 +541,14 @@ { case IRServerMode.ServerMode: { - PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Remote Event", bytes); + PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.RemoteEvent, PipeMessageFlags.None, bytes); SendToAll(message); break; } case IRServerMode.RelayMode: { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Forward Remote Event", bytes); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.ForwardRemoteEvent, PipeMessageFlags.None, bytes); SendTo(Common.ServerPipeName, _hostComputer, message); break; } @@ -560,14 +573,14 @@ { case IRServerMode.ServerMode: { - PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Keyboard Event", bytes); + PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.KeyboardEvent, PipeMessageFlags.None, bytes); SendToAll(message); break; } case IRServerMode.RelayMode: { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Forward Keyboard Event", bytes); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.ForwardKeyboardEvent, PipeMessageFlags.None, bytes); SendTo(Common.ServerPipeName, _hostComputer, message); break; } @@ -593,14 +606,14 @@ { case IRServerMode.ServerMode: { - PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Mouse Event", bytes); + PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.MouseEvent, PipeMessageFlags.None, bytes); SendToAll(message); break; } case IRServerMode.RelayMode: { - PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Forward Mouse Event", bytes); + PipeMessage message = new PipeMessage(Environment.MachineName, _localPipeName, PipeMessageType.ForwardMouseEvent, PipeMessageFlags.None, bytes); SendTo(Common.ServerPipeName, _hostComputer, message); break; } @@ -623,10 +636,11 @@ if (_pluginReceive != null) _pluginReceive.Resume(); + if (_pluginTransmit != null && _pluginTransmit != _pluginReceive) _pluginTransmit.Resume(); - // TODO: Inform clients + // TODO: Inform clients ? break; } @@ -636,17 +650,16 @@ if (_pluginReceive != null) _pluginReceive.Suspend(); + if (_pluginTransmit != null && _pluginTransmit != _pluginReceive) _pluginTransmit.Suspend(); - // TODO: Inform clients - /* + // Inform clients ... if (_mode == IRServerMode.ServerMode) { - PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Server Shutdown", null); + PipeMessage message = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.ServerShutdown); SendToAll(message); } - */ break; } } @@ -654,7 +667,7 @@ void SendToAll(PipeMessage message) { - IrssLog.Debug("SendToAll({0})", message.ToString()); + IrssLog.Debug("SendToAll({0})", message); List<Client> unregister = new List<Client>(); @@ -664,7 +677,7 @@ { try { - PipeAccess.SendMessage(client.Pipe, client.Server, message.ToString()); + PipeAccess.SendMessage(client.Pipe, client.Server, message); } catch (Exception ex) { @@ -686,7 +699,7 @@ } void SendToAllExcept(string exceptPipe, string exceptServer, PipeMessage message) { - IrssLog.Debug("SendToAllExcept({0}, {1}, {2})", exceptPipe, exceptServer, message.ToString()); + IrssLog.Debug("SendToAllExcept({0}, {1}, {2})", exceptPipe, exceptServer, message); List<Client> unregister = new List<Client>(); @@ -699,7 +712,7 @@ if (client.Pipe == exceptPipe && client.Server == exceptServer) continue; - PipeAccess.SendMessage(client.Pipe, client.Server, message.ToString()); + PipeAccess.SendMessage(client.Pipe, client.Server, message); } catch (Exception ex) { @@ -721,11 +734,11 @@ } void SendTo(string pipe, string server, PipeMessage message) { - IrssLog.Debug("SendTo({0}, {1}, {2})", pipe, server, message.ToString()); + IrssLog.Debug("SendTo({0}, {1}, {2})", pipe, server, message); try { - PipeAccess.SendMessage(pipe, server, message.ToString()); + PipeAccess.SendMessage(pipe, server, message); } catch (Exception ex) { @@ -737,7 +750,7 @@ } void SendToRepeaters(PipeMessage message) { - IrssLog.Debug("SendToRepeaters({0})", message.ToString()); + IrssLog.Debug("SendToRepeaters({0})", message); List<Client> unregister = new List<Client>(); @@ -747,7 +760,7 @@ { try { - PipeAccess.SendMessage(client.Pipe, client.Server, message.ToString()); + PipeAccess.SendMessage(client.Pipe, client.Server, message); } catch (Exception ex) { @@ -968,203 +981,189 @@ try { - switch (received.Name) + switch (received.Type) { - case "Remote Event": - case "Keyboard Event": - case "Mouse Event": - break; - - case "Register Success": + case PipeMessageType.ForwardRemoteEvent: + { + PipeMessage forward = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.RemoteEvent, PipeMessageFlags.None, received.DataAsBytes); + if (_mode == IRServerMode.RelayMode) { - IrssLog.Info("Registered with host server"); - _registered = true; - break; + forward.Type = received.Type; + SendTo(Common.ServerPipeName, _hostComputer, forward); } - - case "Register Failure": + else { - IrssLog.Warn("Host server refused registration"); - _registered = false; - break; + SendToAllExcept(received.FromPipe, received.FromServer, forward); } + break; + } - case "Forward Remote Event": + case PipeMessageType.ForwardKeyboardEvent: + { + PipeMessage forward = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.KeyboardEvent, PipeMessageFlags.None, received.DataAsBytes); + if (_mode == IRServerMode.RelayMode) { - PipeMessage forward = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Remote Event", received.Data); - if (_mode == IRServerMode.RelayMode) - { - forward.Name = received.Name; - SendTo(Common.ServerPipeName, _hostComputer, forward); - } - else - { - SendToAllExcept(received.FromPipe, received.FromServer, forward); - } - break; + forward.Type = received.Type; + SendTo(Common.ServerPipeName, _hostComputer, forward); } - - case "Forward Keyboard Event": + else { - PipeMessage forward = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Keyboard Event", received.Data); - if (_mode == IRServerMode.RelayMode) - { - forward.Name = received.Name; - SendTo(Common.ServerPipeName, _hostComputer, forward); - } - else - { - SendToAllExcept(received.FromPipe, received.FromServer, forward); - } - break; + SendToAllExcept(received.FromPipe, received.FromServer, forward); } + break; + } - case "Forward Mouse Event": + case PipeMessageType.ForwardMouseEvent: + { + PipeMessage forward = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.MouseEvent, PipeMessageFlags.None, received.DataAsBytes); + if (_mode == IRServerMode.RelayMode) { - PipeMessage forward = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Mouse Event", received.Data); - if (_mode == IRServerMode.RelayMode) - { - forward.Name = received.Name; - SendTo(Common.ServerPipeName, _hostComputer, forward); - } - else - { - SendToAllExcept(received.FromPipe, received.FromServer, forward); - } - break; + forward.Type = received.Type; + SendTo(Common.ServerPipeName, _hostComputer, forward); } - - case "List": + else { - if (_mode != IRServerMode.RelayMode) - { - PipeMessage response = new PipeMessage(Common.ServerPipeName, Environment.MachineName, "Clients", BitConverter.GetBytes(_registeredClients.Count)); - SendTo(received.FromPipe, received.FromServer, response); - } - break; + SendToAllExcept(received.FromPipe, received.FromServer, forward); } + break; + } - case "Blast": - { - if (_mode == IRServerMode.RelayMode) - { - PipeMessage reply = new PipeMessage(Common.ServerPipeName, Environment.MachineName, received.Name + " Failure", null); - SendTo(received.FromPipe, received.FromServer, reply); - break; - } + case PipeMessageType.BlastIR: + { + PipeMessage response = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.BlastIR, PipeMessageFlags.Response); + if (_mode == IRServerMode.RelayMode) + { + response.Flags |= PipeMessageFlags.Failure; + } + else + { if (_registeredRepeaters.Count > 0) SendToRepeaters(received); - PipeMessage response = new PipeMessage(Common.ServerPipeName, Environment.MachineName, received.Name + " Failure", null); + if (BlastIR(received.DataAsBytes)) + response.Flags |= PipeMessageFlags.Success; + else + response.Flags |= PipeMessageFlags.Failure; + } - if (BlastIR(received.Data)) - response.Name = received.Name + " Success"; + SendTo(received.FromPipe, received.FromServer, response); + break; + } - SendTo(received.FromPipe, received.FromServer, response); - break; - } + case PipeMessageType.LearnIR: + { + PipeMessage response = new PipeMessage(Common.ServerPipeName, Environment.MachineName, PipeMessageType.LearnIR, PipeMessageFlags.Response); - case "Learn": + if (_mode == IRServerMode.RelayMode) { - if (_mode == IRServerMode.RelayMode) - { - PipeMessage reply = new PipeMessage(Common.ServerPipeName, Environment.MachineName, received.Name + " Failure", null); - SendTo(received.FromPipe, received.FromServer, reply); - break; - } - - // Prepare response ... - PipeMessage response = new PipeMessage(Common.ServerPipeName, Environment.MachineName, received.Name + " Failure", null); - + response.Flags |= PipeMessageFlags.Failure; + } + else + { byte[] bytes = LearnIR(); - if (bytes != null) - { - response.Name = received.Name + " Success"; - response.Data = bytes; - } - - SendTo(received.FromPipe, received.FromServer, response); - ... [truncated message content] |