From: <an...@us...> - 2007-07-13 02:56:31
|
Revision: 690 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=690&view=rev Author: and-81 Date: 2007-07-12 19:56:29 -0700 (Thu, 12 Jul 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.resx trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.Designer.cs trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.resx trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs Added Paths: ----------- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/ 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/ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickLeft.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickMiddle.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickRight.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveDown.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveLeft.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveRight.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveUp.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ScrollDown.png trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ScrollUp.png Added: 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 (rev 0) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/IR Blast (No Window).csproj 2007-07-13 02:56:29 UTC (rev 690) @@ -0,0 +1,77 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{54E0E8FA-09C3-4755-B9CE-E7E5DDA3E932}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>IRBlast</RootNamespace> + <AssemblyName>IRBlast-NoWindow</AssemblyName> + <ApplicationIcon> + </ApplicationIcon> + <StartupObject>IRBlast.Program</StartupObject> + <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>false</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants> + </DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Common\irssUtils\IrssUtils.csproj"> + <Project>{CA15769C-232E-4CA7-94FD-206A06CA3ABB}</Project> + <Name>IrssUtils</Name> + </ProjectReference> + <ProjectReference Include="..\..\IPC\AppModule.InterProcessComm\AppModule.InterProcessComm.csproj"> + <Project>{E98F1F7E-40B6-44C8-AC66-EC867B141FA1}</Project> + <Name>AppModule.InterProcessComm</Name> + </ProjectReference> + <ProjectReference Include="..\..\IPC\AppModule.NamedPipes\AppModule.NamedPipes.csproj"> + <Project>{077B53BB-404A-4B2F-BA17-AAE98C5E9C66}</Project> + <Name>AppModule.NamedPipes</Name> + </ProjectReference> + <ProjectReference Include="..\..\IPC\Named Pipes\Named Pipes.csproj"> + <Project>{F4EA6055-7133-4F18-8971-E19ADEB482C1}</Project> + <Name>Named Pipes</Name> + </ProjectReference> + </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. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>copy "$(TargetFileName)" "\MediaPortal Development\Plugin Releases\IR Server Suite\IR Blast\"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -0,0 +1,480 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.IO; +using System.Text; +using System.Threading; +using System.Windows.Forms; +using System.Xml; + +using NamedPipes; +using IrssUtils; + +namespace IRBlast +{ + + static class Program + { + + #region Variables + + static bool _registered = false; + static bool _keepAlive = true; + static int _echoID = -1; + static Thread _keepAliveThread; + + static string _serverHost = null; + static string _localPipeName; + + static string _blastPort = "None"; + static string _blastSpeed = "None"; + + static bool _treatAsChannelNumber = false; + + #endregion Variables + + /// <summary> + /// The main entry point for the application. + /// </summary> + [STAThread] + static void Main(string[] args) + { + IrssLog.LogLevel = IrssLog.Level.Debug; + IrssLog.Open(Common.FolderIrssLogs + "IR Blast (No Window).log"); + + IrssLog.Debug("Platform is {0}", (IntPtr.Size == 4 ? "32-bit" : "64-bit")); + + try + { + + if (args.Length > 0) // Command Line Start ... + { + List<String> irCommands = new List<string>(); + + for (int index = 0; index < args.Length; index++) + { + switch (args[index].ToLowerInvariant()) + { + case "-host": + _serverHost = args[++index]; + continue; + + case "-port": + _blastPort = args[++index]; + continue; + + case "-speed": + _blastSpeed = args[++index]; + continue; + + case "-channel": + _treatAsChannelNumber = true; + continue; + + default: + irCommands.Add(args[index]); + continue; + } + } + + if (String.IsNullOrEmpty(_serverHost) || irCommands.Count == 0) + { + Console.WriteLine("Malformed command line parameters ..."); + Console.WriteLine(); + + ShowHelp(); + } + else if (StartComms()) + { + Thread.Sleep(250); + + // Wait for registered ... Give up after 10 seconds ... + int attempt = 0; + while (!_registered) + { + if (++attempt >= 10) + break; + else + Thread.Sleep(1000); + } + + if (_registered) + { + string fileName; + foreach (String command in irCommands) + { + if (_treatAsChannelNumber) + { + IrssLog.Info("Processing channel: {0}", command); + foreach (char digit in command) + { + if (digit == '~') + { + Thread.Sleep(500); + } + else + { + fileName = Common.FolderIRCommands + digit + Common.FileExtensionIR; + BlastIR(fileName, _blastPort, _blastSpeed); + } + } + } + else if (command.StartsWith("~")) + { + Thread.Sleep(command.Length * 500); + } + else + { + fileName = Common.FolderIRCommands + command; + BlastIR(fileName, _blastPort, _blastSpeed); + } + } + + Thread.Sleep(500); + } + else + { + IrssLog.Warn("Failed to register with server host \"{0}\", blasting not sent", _serverHost); + } + + } + } + else + { + ShowHelp(); + } + } + catch (Exception ex) + { + IrssLog.Error(ex.ToString()); + } + + StopComms(); + + IrssLog.Close(); + } + + static void ShowHelp() + { + IrssLog.Debug("Show Help"); + + MessageBox.Show( +@"IR Blast (No Window) is a windowless version on IR Blast. +Refer to IR Blast help for more information.", +"IR Blast (No Window)", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + static bool StartComms() + { + try + { + if (OpenLocalPipe()) + { + _keepAliveThread = new Thread(new ThreadStart(KeepAliveThread)); + _keepAliveThread.Start(); + return true; + } + } + catch (Exception ex) + { + IrssLog.Error(ex.ToString()); + } + + return false; + } + static void StopComms() + { + _keepAlive = false; + + try + { + if (_keepAliveThread != null && _keepAliveThread.IsAlive) + _keepAliveThread.Abort(); + } + catch { } + + try + { + if (_registered) + { + _registered = false; + + PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Unregister", null); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + } + } + catch { } + + try + { + if (PipeAccess.ServerRunning) + PipeAccess.StopServer(); + } + catch { } + } + + static bool OpenLocalPipe() + { + try + { + int pipeNumber = 1; + bool retry = false; + + do + { + string localPipeTest = String.Format(Common.LocalPipeFormat, pipeNumber); + + if (PipeAccess.PipeExists(String.Format("\\\\.\\pipe\\{0}", localPipeTest))) + { + if (++pipeNumber <= Common.MaximumLocalClientCount) + retry = true; + else + throw new Exception(String.Format("Maximum local client limit ({0}) reached", Common.MaximumLocalClientCount)); + } + else + { + if (!PipeAccess.StartServer(localPipeTest, new PipeMessageHandler(ReceivedMessage))) + throw new Exception(String.Format("Failed to start local pipe server \"{0}\"", localPipeTest)); + + _localPipeName = localPipeTest; + retry = false; + } + } + while (retry); + + return true; + } + catch (Exception ex) + { + IrssLog.Error(ex.ToString()); + return false; + } + } + + static bool ConnectToServer() + { + try + { + PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Register", null); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + return true; + } + catch (AppModule.NamedPipes.NamedPipeIOException) + { + return false; + } + catch (Exception ex) + { + IrssLog.Error(ex.ToString()); + return false; + } + } + + static void KeepAliveThread() + { + Random random = new Random((int)DateTime.Now.Ticks); + bool reconnect; + int attempt; + + _registered = false; + _keepAlive = true; + while (_keepAlive) + { + reconnect = true; + + #region Connect to server + + IrssLog.Info("Connecting ({0}) ...", _serverHost); + attempt = 0; + while (_keepAlive && reconnect) + { + if (ConnectToServer()) + { + reconnect = false; + } + else + { + int wait; + + if (attempt <= 50) + attempt++; + + if (attempt > 50) + wait = 30; // 30 seconds + else if (attempt > 20) + wait = 10; // 10 seconds + else if (attempt > 10) + wait = 5; // 5 seconds + else + wait = 1; // 1 second + + for (int sleeps = 0; sleeps < wait && _keepAlive; sleeps++) + Thread.Sleep(1000); + } + } + + #endregion Connect to server + + #region Wait for registered + + // Give up after 10 seconds ... + attempt = 0; + while (_keepAlive && !_registered && !reconnect) + { + if (++attempt >= 10) + reconnect = true; + else + Thread.Sleep(1000); + } + + #endregion Wait for registered + + #region Ping the server repeatedly + + while (_keepAlive && _registered && !reconnect) + { + int pingID = random.Next(); + long pingTime = DateTime.Now.Ticks; + + try + { + PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Ping", BitConverter.GetBytes(pingID)); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + } + catch + { + // Failed to ping ... reconnect ... + IrssLog.Warn("Failed to ping, attempting to reconnect ..."); + _registered = false; + reconnect = true; + break; + } + + // Wait 10 seconds for a ping echo ... + bool receivedEcho = false; + while (_keepAlive && _registered && !reconnect && + !receivedEcho && DateTime.Now.Ticks - pingTime < 10 * 1000 * 10000) + { + if (_echoID == pingID) + { + receivedEcho = true; + } + else + { + Thread.Sleep(1000); + } + } + + if (receivedEcho) // Received ping echo ... + { + // Wait 60 seconds before re-pinging ... + for (int sleeps = 0; sleeps < 60 && _keepAlive && _registered; sleeps++) + Thread.Sleep(1000); + } + else // Didn't receive ping echo ... + { + IrssLog.Warn("No echo to ping, attempting to reconnect ..."); + + // Break out of pinging cycle ... + _registered = false; + reconnect = true; + } + } + + #endregion Ping the server repeatedly + + } + + } + + static void ReceivedMessage(string message) + { + PipeMessage received = PipeMessage.FromString(message); + + IrssLog.Debug("Received Message \"{0}\"", received.Name); + + try + { + switch (received.Name) + { + case "Remote Button": + break; + + case "Blast Success": + IrssLog.Info("Blast Success"); + break; + + case "Blast Failure": + IrssLog.Warn("Blast Failed!"); + break; + + case "Register Success": + { + IrssLog.Info("Registered to IR Server"); + _registered = true; + //_transceiverInfo = TransceiverInfo.FromBytes(received.Data); + break; + } + + case "Register Failure": + { + IrssLog.Warn("IR Server refused to register"); + _registered = false; + break; + } + + case "Server Shutdown": + { + IrssLog.Warn("IR Server Shutdown - Blasting disabled until IR Server returns"); + _registered = false; + break; + } + + case "Echo": + { + _echoID = BitConverter.ToInt32(received.Data, 0); + break; + } + + case "Error": + { + IrssLog.Warn(Encoding.ASCII.GetString(received.Data)); + break; + } + + default: + { + IrssLog.Warn("Unknown message received from server: " + received.Name); + break; + } + } + } + catch (Exception ex) + { + IrssLog.Error(ex.ToString()); + } + } + + static void BlastIR(string fileName, string port, string speed) + { + FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); + + byte[] outData = new byte[8 + port.Length + speed.Length + file.Length]; + + BitConverter.GetBytes(port.Length).CopyTo(outData, 0); + Encoding.ASCII.GetBytes(port).CopyTo(outData, 4); + BitConverter.GetBytes(speed.Length).CopyTo(outData, 4 + port.Length); + Encoding.ASCII.GetBytes(speed).CopyTo(outData, 8 + port.Length); + + file.Read(outData, 8 + port.Length + speed.Length, (int)file.Length); + file.Close(); + + PipeMessage message = new PipeMessage(_localPipeName, Environment.MachineName, "Blast", outData); + PipeAccess.SendMessage(Common.ServerPipeName, _serverHost, message.ToString()); + } + + } + +} Added: 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 (rev 0) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Properties/AssemblyInfo.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -0,0 +1,39 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("IR Blast (No Window)")] +[assembly: AssemblyDescription("Command line application for blasting IR commands to IR Server")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("and-81")] +[assembly: AssemblyProduct("IRBlastNoWindow")] +[assembly: AssemblyCopyright("Aaron Dinnage")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.3.2")] +[assembly: AssemblyFileVersion("1.0.3.2")] + +[assembly: CLSCompliant(true)] \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.Designer.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -28,6 +28,7 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ButtonMappingForm)); this.groupBoxButton = new System.Windows.Forms.GroupBox(); this.labelKeyCode = new System.Windows.Forms.Label(); @@ -97,9 +98,25 @@ this.buttonKeyHelp = new System.Windows.Forms.Button(); this.labelKeystrokes = new System.Windows.Forms.Label(); this.textBoxKeys = new System.Windows.Forms.TextBox(); + this.tabPageMouse = new System.Windows.Forms.TabPage(); + this.groupBoxMouseScroll = new System.Windows.Forms.GroupBox(); + this.checkBoxMouseScrollDown = new System.Windows.Forms.CheckBox(); + this.checkBoxMouseScrollUp = new System.Windows.Forms.CheckBox(); + this.groupBoxMouseClick = new System.Windows.Forms.GroupBox(); + this.checkBoxMouseClickRight = new System.Windows.Forms.CheckBox(); + this.checkBoxMouseClickMiddle = new System.Windows.Forms.CheckBox(); + this.checkBoxMouseClickLeft = new System.Windows.Forms.CheckBox(); + this.groupBoxMouseMove = new System.Windows.Forms.GroupBox(); + this.checkBoxMouseMoveLeft = new System.Windows.Forms.CheckBox(); + this.checkBoxMouseMoveDown = new System.Windows.Forms.CheckBox(); + this.checkBoxMouseMoveRight = new System.Windows.Forms.CheckBox(); + this.checkBoxMouseMoveUp = new System.Windows.Forms.CheckBox(); + this.labelMouseMove = new System.Windows.Forms.Label(); + this.numericUpDownMouseMove = new System.Windows.Forms.NumericUpDown(); this.buttonTest = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOK = new System.Windows.Forms.Button(); + this.toolTips = new System.Windows.Forms.ToolTip(this.components); this.groupBoxButton.SuspendLayout(); this.groupBoxSet.SuspendLayout(); this.tabControl.SuspendLayout(); @@ -117,6 +134,11 @@ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWParam)).BeginInit(); this.groupBoxMessageTarget.SuspendLayout(); this.tabPageKeystrokes.SuspendLayout(); + this.tabPageMouse.SuspendLayout(); + this.groupBoxMouseScroll.SuspendLayout(); + this.groupBoxMouseClick.SuspendLayout(); + this.groupBoxMouseMove.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMouseMove)).BeginInit(); this.SuspendLayout(); // // groupBoxButton @@ -210,6 +232,7 @@ this.buttonSet.Size = new System.Drawing.Size(48, 20); this.buttonSet.TabIndex = 1; this.buttonSet.Text = "Set"; + this.toolTips.SetToolTip(this.buttonSet, "Click here to set the command"); this.buttonSet.UseVisualStyleBackColor = true; this.buttonSet.Click += new System.EventHandler(this.buttonSet_Click); // @@ -224,6 +247,7 @@ this.tabControl.Controls.Add(this.tabPageSerial); this.tabControl.Controls.Add(this.tabPageMessage); this.tabControl.Controls.Add(this.tabPageKeystrokes); + this.tabControl.Controls.Add(this.tabPageMouse); this.tabControl.Location = new System.Drawing.Point(8, 24); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; @@ -903,6 +927,206 @@ this.textBoxKeys.Size = new System.Drawing.Size(416, 144); this.textBoxKeys.TabIndex = 1; // + // tabPageMouse + // + this.tabPageMouse.Controls.Add(this.groupBoxMouseScroll); + this.tabPageMouse.Controls.Add(this.groupBoxMouseClick); + this.tabPageMouse.Controls.Add(this.groupBoxMouseMove); + this.tabPageMouse.Location = new System.Drawing.Point(4, 22); + this.tabPageMouse.Name = "tabPageMouse"; + this.tabPageMouse.Padding = new System.Windows.Forms.Padding(3); + this.tabPageMouse.Size = new System.Drawing.Size(432, 206); + this.tabPageMouse.TabIndex = 6; + this.tabPageMouse.Text = "Mouse"; + this.tabPageMouse.UseVisualStyleBackColor = true; + // + // groupBoxMouseScroll + // + this.groupBoxMouseScroll.Anchor = System.Windows.Forms.AnchorStyles.None; + this.groupBoxMouseScroll.Controls.Add(this.checkBoxMouseScrollDown); + this.groupBoxMouseScroll.Controls.Add(this.checkBoxMouseScrollUp); + this.groupBoxMouseScroll.Location = new System.Drawing.Point(296, 16); + this.groupBoxMouseScroll.Name = "groupBoxMouseScroll"; + this.groupBoxMouseScroll.Size = new System.Drawing.Size(128, 176); + this.groupBoxMouseScroll.TabIndex = 2; + this.groupBoxMouseScroll.TabStop = false; + this.groupBoxMouseScroll.Text = "Scroll"; + // + // checkBoxMouseScrollDown + // + this.checkBoxMouseScrollDown.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseScrollDown.Image = global::Translator.Properties.Resources.ScrollDown; + this.checkBoxMouseScrollDown.Location = new System.Drawing.Point(48, 96); + this.checkBoxMouseScrollDown.Name = "checkBoxMouseScrollDown"; + this.checkBoxMouseScrollDown.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseScrollDown.TabIndex = 1; + this.toolTips.SetToolTip(this.checkBoxMouseScrollDown, "Scroll the mouse wheel down"); + this.checkBoxMouseScrollDown.UseVisualStyleBackColor = true; + this.checkBoxMouseScrollDown.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // checkBoxMouseScrollUp + // + this.checkBoxMouseScrollUp.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseScrollUp.Image = global::Translator.Properties.Resources.ScrollUp; + this.checkBoxMouseScrollUp.Location = new System.Drawing.Point(48, 40); + this.checkBoxMouseScrollUp.Name = "checkBoxMouseScrollUp"; + this.checkBoxMouseScrollUp.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseScrollUp.TabIndex = 0; + this.toolTips.SetToolTip(this.checkBoxMouseScrollUp, "Scroll the mouse wheel up"); + this.checkBoxMouseScrollUp.UseVisualStyleBackColor = true; + this.checkBoxMouseScrollUp.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // groupBoxMouseClick + // + this.groupBoxMouseClick.Anchor = System.Windows.Forms.AnchorStyles.None; + this.groupBoxMouseClick.Controls.Add(this.checkBoxMouseClickRight); + this.groupBoxMouseClick.Controls.Add(this.checkBoxMouseClickMiddle); + this.groupBoxMouseClick.Controls.Add(this.checkBoxMouseClickLeft); + this.groupBoxMouseClick.Location = new System.Drawing.Point(160, 16); + this.groupBoxMouseClick.Name = "groupBoxMouseClick"; + this.groupBoxMouseClick.Size = new System.Drawing.Size(128, 176); + this.groupBoxMouseClick.TabIndex = 1; + this.groupBoxMouseClick.TabStop = false; + this.groupBoxMouseClick.Text = "Click"; + // + // checkBoxMouseClickRight + // + this.checkBoxMouseClickRight.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseClickRight.Image = global::Translator.Properties.Resources.ClickRight; + this.checkBoxMouseClickRight.Location = new System.Drawing.Point(88, 64); + this.checkBoxMouseClickRight.Name = "checkBoxMouseClickRight"; + this.checkBoxMouseClickRight.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseClickRight.TabIndex = 2; + this.toolTips.SetToolTip(this.checkBoxMouseClickRight, "Click the right mouse button"); + this.checkBoxMouseClickRight.UseVisualStyleBackColor = true; + this.checkBoxMouseClickRight.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // checkBoxMouseClickMiddle + // + this.checkBoxMouseClickMiddle.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseClickMiddle.Image = global::Translator.Properties.Resources.ClickMiddle; + this.checkBoxMouseClickMiddle.Location = new System.Drawing.Point(48, 64); + this.checkBoxMouseClickMiddle.Name = "checkBoxMouseClickMiddle"; + this.checkBoxMouseClickMiddle.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseClickMiddle.TabIndex = 1; + this.toolTips.SetToolTip(this.checkBoxMouseClickMiddle, "Click the middle mouse button"); + this.checkBoxMouseClickMiddle.UseVisualStyleBackColor = true; + this.checkBoxMouseClickMiddle.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // checkBoxMouseClickLeft + // + this.checkBoxMouseClickLeft.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseClickLeft.Image = global::Translator.Properties.Resources.ClickLeft; + this.checkBoxMouseClickLeft.Location = new System.Drawing.Point(8, 64); + this.checkBoxMouseClickLeft.Name = "checkBoxMouseClickLeft"; + this.checkBoxMouseClickLeft.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseClickLeft.TabIndex = 0; + this.toolTips.SetToolTip(this.checkBoxMouseClickLeft, "Click the left mouse button"); + this.checkBoxMouseClickLeft.UseVisualStyleBackColor = true; + this.checkBoxMouseClickLeft.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // groupBoxMouseMove + // + this.groupBoxMouseMove.Anchor = System.Windows.Forms.AnchorStyles.None; + this.groupBoxMouseMove.Controls.Add(this.checkBoxMouseMoveLeft); + this.groupBoxMouseMove.Controls.Add(this.checkBoxMouseMoveDown); + this.groupBoxMouseMove.Controls.Add(this.checkBoxMouseMoveRight); + this.groupBoxMouseMove.Controls.Add(this.checkBoxMouseMoveUp); + this.groupBoxMouseMove.Controls.Add(this.labelMouseMove); + this.groupBoxMouseMove.Controls.Add(this.numericUpDownMouseMove); + this.groupBoxMouseMove.Location = new System.Drawing.Point(8, 16); + this.groupBoxMouseMove.Name = "groupBoxMouseMove"; + this.groupBoxMouseMove.Size = new System.Drawing.Size(144, 176); + this.groupBoxMouseMove.TabIndex = 0; + this.groupBoxMouseMove.TabStop = false; + this.groupBoxMouseMove.Text = "Move"; + // + // checkBoxMouseMoveLeft + // + this.checkBoxMouseMoveLeft.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseMoveLeft.Image = global::Translator.Properties.Resources.MoveLeft; + this.checkBoxMouseMoveLeft.Location = new System.Drawing.Point(24, 64); + this.checkBoxMouseMoveLeft.Name = "checkBoxMouseMoveLeft"; + this.checkBoxMouseMoveLeft.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseMoveLeft.TabIndex = 1; + this.toolTips.SetToolTip(this.checkBoxMouseMoveLeft, "Move the mouse position left on screen"); + this.checkBoxMouseMoveLeft.UseVisualStyleBackColor = true; + this.checkBoxMouseMoveLeft.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // checkBoxMouseMoveDown + // + this.checkBoxMouseMoveDown.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseMoveDown.Image = global::Translator.Properties.Resources.MoveDown; + this.checkBoxMouseMoveDown.Location = new System.Drawing.Point(56, 96); + this.checkBoxMouseMoveDown.Name = "checkBoxMouseMoveDown"; + this.checkBoxMouseMoveDown.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseMoveDown.TabIndex = 3; + this.toolTips.SetToolTip(this.checkBoxMouseMoveDown, "Move the mousse position down the screen"); + this.checkBoxMouseMoveDown.UseVisualStyleBackColor = true; + this.checkBoxMouseMoveDown.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // checkBoxMouseMoveRight + // + this.checkBoxMouseMoveRight.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseMoveRight.Image = global::Translator.Properties.Resources.MoveRight; + this.checkBoxMouseMoveRight.Location = new System.Drawing.Point(88, 64); + this.checkBoxMouseMoveRight.Name = "checkBoxMouseMoveRight"; + this.checkBoxMouseMoveRight.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseMoveRight.TabIndex = 2; + this.toolTips.SetToolTip(this.checkBoxMouseMoveRight, "Move the mouse position right on screen"); + this.checkBoxMouseMoveRight.UseVisualStyleBackColor = true; + this.checkBoxMouseMoveRight.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // checkBoxMouseMoveUp + // + this.checkBoxMouseMoveUp.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBoxMouseMoveUp.Image = global::Translator.Properties.Resources.MoveUp; + this.checkBoxMouseMoveUp.Location = new System.Drawing.Point(56, 32); + this.checkBoxMouseMoveUp.Name = "checkBoxMouseMoveUp"; + this.checkBoxMouseMoveUp.Size = new System.Drawing.Size(32, 32); + this.checkBoxMouseMoveUp.TabIndex = 0; + this.toolTips.SetToolTip(this.checkBoxMouseMoveUp, "Move the mouse position up the screen"); + this.checkBoxMouseMoveUp.UseVisualStyleBackColor = true; + this.checkBoxMouseMoveUp.CheckedChanged += new System.EventHandler(this.checkBoxMouse_CheckedChanged); + // + // labelMouseMove + // + this.labelMouseMove.Location = new System.Drawing.Point(8, 144); + this.labelMouseMove.Name = "labelMouseMove"; + this.labelMouseMove.Size = new System.Drawing.Size(72, 20); + this.labelMouseMove.TabIndex = 4; + this.labelMouseMove.Text = "Distance:"; + this.labelMouseMove.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownMouseMove + // + this.numericUpDownMouseMove.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numericUpDownMouseMove.Location = new System.Drawing.Point(80, 144); + this.numericUpDownMouseMove.Maximum = new decimal(new int[] { + 5000, + 0, + 0, + 0}); + this.numericUpDownMouseMove.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownMouseMove.Name = "numericUpDownMouseMove"; + this.numericUpDownMouseMove.Size = new System.Drawing.Size(56, 20); + this.numericUpDownMouseMove.TabIndex = 5; + this.numericUpDownMouseMove.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTips.SetToolTip(this.numericUpDownMouseMove, "The distance (in pixels) to move the mouse"); + this.numericUpDownMouseMove.Value = new decimal(new int[] { + 16, + 0, + 0, + 0}); + // // buttonTest // this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -911,6 +1135,7 @@ this.buttonTest.Size = new System.Drawing.Size(48, 20); this.buttonTest.TabIndex = 3; this.buttonTest.Text = "Test"; + this.toolTips.SetToolTip(this.buttonTest, "Click here to test the currently set command"); this.buttonTest.UseVisualStyleBackColor = true; this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); // @@ -979,6 +1204,11 @@ this.groupBoxMessageTarget.PerformLayout(); this.tabPageKeystrokes.ResumeLayout(false); this.tabPageKeystrokes.PerformLayout(); + this.tabPageMouse.ResumeLayout(false); + this.groupBoxMouseScroll.ResumeLayout(false); + this.groupBoxMouseClick.ResumeLayout(false); + this.groupBoxMouseMove.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMouseMove)).EndInit(); this.ResumeLayout(false); } @@ -1056,6 +1286,22 @@ private System.Windows.Forms.Button buttonFindMsgTarget; private System.Windows.Forms.GroupBox groupBoxMessageTarget; private System.Windows.Forms.GroupBox groupBoxMessageDetails; + private System.Windows.Forms.TabPage tabPageMouse; + private System.Windows.Forms.GroupBox groupBoxMouseMove; + private System.Windows.Forms.Label labelMouseMove; + private System.Windows.Forms.NumericUpDown numericUpDownMouseMove; + private System.Windows.Forms.CheckBox checkBoxMouseMoveUp; + private System.Windows.Forms.GroupBox groupBoxMouseScroll; + private System.Windows.Forms.CheckBox checkBoxMouseScrollDown; + private System.Windows.Forms.CheckBox checkBoxMouseScrollUp; + private System.Windows.Forms.GroupBox groupBoxMouseClick; + private System.Windows.Forms.CheckBox checkBoxMouseClickRight; + private System.Windows.Forms.CheckBox checkBoxMouseClickMiddle; + private System.Windows.Forms.CheckBox checkBoxMouseClickLeft; + private System.Windows.Forms.CheckBox checkBoxMouseMoveLeft; + private System.Windows.Forms.CheckBox checkBoxMouseMoveDown; + private System.Windows.Forms.CheckBox checkBoxMouseMoveRight; + private System.Windows.Forms.ToolTip toolTips; } } \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -209,6 +209,29 @@ textBoxKeys.Text = suffix; break; } + + case Common.CmdPrefixMouse: + { + tabControl.SelectTab(tabPageMouse); + switch (suffix) + { + case Common.MouseClickLeft: checkBoxMouseClickLeft.Checked = true; break; + case Common.MouseClickMiddle: checkBoxMouseClickMiddle.Checked = true; break; + case Common.MouseClickRight: checkBoxMouseClickRight.Checked = true; break; + case Common.MouseScrollDown: checkBoxMouseScrollDown.Checked = true; break; + case Common.MouseScrollUp: checkBoxMouseScrollUp.Checked = true; break; + + default: + if (suffix.StartsWith(Common.MouseMoveDown)) checkBoxMouseMoveDown.Checked = true; + else if (suffix.StartsWith(Common.MouseMoveLeft)) checkBoxMouseMoveLeft.Checked = true; + else if (suffix.StartsWith(Common.MouseMoveRight)) checkBoxMouseMoveRight.Checked = true; + else if (suffix.StartsWith(Common.MouseMoveUp)) checkBoxMouseMoveUp.Checked = true; + + numericUpDownMouseMove.Value = Decimal.Parse(suffix.Substring(suffix.IndexOf(" "))); + break; + } + break; + } } } @@ -335,6 +358,31 @@ textBoxCommand.Text = _command = Common.CmdPrefixKeys + textBoxKeys.Text; break; } + + case "tabPageMouse": + { + StringBuilder newCommand = new StringBuilder(); + newCommand.Append(Common.CmdPrefixMouse); + + if (checkBoxMouseClickLeft.Checked) newCommand.Append(Common.MouseClickLeft); + else if (checkBoxMouseClickRight.Checked) newCommand.Append(Common.MouseClickRight); + else if (checkBoxMouseClickMiddle.Checked) newCommand.Append(Common.MouseClickMiddle); + else if (checkBoxMouseScrollUp.Checked) newCommand.Append(Common.MouseScrollUp); + else if (checkBoxMouseScrollDown.Checked) newCommand.Append(Common.MouseScrollDown); + else + { + if (checkBoxMouseMoveUp.Checked) newCommand.Append(Common.MouseMoveUp); + else if (checkBoxMouseMoveDown.Checked) newCommand.Append(Common.MouseMoveDown); + else if (checkBoxMouseMoveLeft.Checked) newCommand.Append(Common.MouseMoveLeft); + else if (checkBoxMouseMoveRight.Checked) newCommand.Append(Common.MouseMoveRight); + else break; + + newCommand.Append(numericUpDownMouseMove.Value.ToString()); + } + + textBoxCommand.Text = _command = newCommand.ToString(); + break; + } } } @@ -459,6 +507,24 @@ #endregion Controls + private void checkBoxMouse_CheckedChanged(object sender, EventArgs e) + { + CheckBox origin = (CheckBox)sender; + + if (!origin.Checked) + return; + + if (origin != checkBoxMouseClickLeft) checkBoxMouseClickLeft.Checked = false; + if (origin != checkBoxMouseClickRight) checkBoxMouseClickRight.Checked = false; + if (origin != checkBoxMouseClickMiddle) checkBoxMouseClickMiddle.Checked = false; + if (origin != checkBoxMouseMoveUp) checkBoxMouseMoveUp.Checked = false; + if (origin != checkBoxMouseMoveDown) checkBoxMouseMoveDown.Checked = false; + if (origin != checkBoxMouseMoveLeft) checkBoxMouseMoveLeft.Checked = false; + if (origin != checkBoxMouseMoveRight) checkBoxMouseMoveRight.Checked = false; + if (origin != checkBoxMouseScrollUp) checkBoxMouseScrollUp.Checked = false; + if (origin != checkBoxMouseScrollDown) checkBoxMouseScrollDown.Checked = false; + } + } } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.resx =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.resx 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/ButtonMappingForm.resx 2007-07-13 02:56:29 UTC (rev 690) @@ -117,6 +117,9 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="toolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickLeft.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickLeft.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickMiddle.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickMiddle.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickRight.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ClickRight.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveDown.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveDown.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveLeft.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveLeft.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveRight.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveRight.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveUp.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/MoveUp.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ScrollDown.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ScrollDown.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ScrollUp.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Translator/Graphics/ScrollUp.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -990,6 +990,11 @@ string keyCommand = command.Substring(Common.CmdPrefixKeys.Length); Common.ProcessKeyCommand(keyCommand); } + else if (command.StartsWith(Common.CmdPrefixMouse)) // Mouse Command + { + string mouseCommand = command.Substring(Common.CmdPrefixMouse.Length); + Common.ProcessMouseCommand(mouseCommand); + } else { throw new ArgumentException(String.Format("Cannot process unrecognized command \"{0}\"", command), "command"); Modified: trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.Designer.cs 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.Designer.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -60,6 +60,27 @@ } } + internal static System.Drawing.Bitmap ClickLeft { + get { + object obj = ResourceManager.GetObject("ClickLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap ClickMiddle { + get { + object obj = ResourceManager.GetObject("ClickMiddle", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap ClickRight { + get { + object obj = ResourceManager.GetObject("ClickRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Icon Icon16 { get { object obj = ResourceManager.GetObject("Icon16", resourceCulture); @@ -73,5 +94,47 @@ return ((System.Drawing.Icon)(obj)); } } + + internal static System.Drawing.Bitmap MoveDown { + get { + object obj = ResourceManager.GetObject("MoveDown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap MoveLeft { + get { + object obj = ResourceManager.GetObject("MoveLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap MoveRight { + get { + object obj = ResourceManager.GetObject("MoveRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap MoveUp { + get { + object obj = ResourceManager.GetObject("MoveUp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap ScrollDown { + get { + object obj = ResourceManager.GetObject("ScrollDown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap ScrollUp { + get { + object obj = ResourceManager.GetObject("ScrollUp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.resx =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.resx 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Properties/Resources.resx 2007-07-13 02:56:29 UTC (rev 690) @@ -118,10 +118,37 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="ClickLeft" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\clickleft.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="ClickMiddle" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\clickmiddle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="ClickRight" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\clickright.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> <data name="Icon16" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Icon16.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <data name="Icon16Connecting" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Icon16Connecting.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="MoveDown" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\movedown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="MoveLeft" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\moveleft.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="MoveRight" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\moveright.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="MoveUp" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\moveup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="ScrollDown" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\scrolldown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="ScrollUp" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\graphics\scrollup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-07-13 02:56:29 UTC (rev 690) @@ -165,6 +165,17 @@ <ItemGroup> <None Include="Icon16Connecting.ico" /> </ItemGroup> + <ItemGroup> + <Content Include="Graphics\ClickLeft.png" /> + <Content Include="Graphics\ClickMiddle.png" /> + <Content Include="Graphics\ClickRight.png" /> + <Content Include="Graphics\MoveDown.png" /> + <Content Include="Graphics\MoveLeft.png" /> + <Content Include="Graphics\MoveRight.png" /> + <Content Include="Graphics\MoveUp.png" /> + <Content Include="Graphics\ScrollDown.png" /> + <Content Include="Graphics\ScrollUp.png" /> + </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/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2007-07-12 18:58:38 UTC (rev 689) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2007-07-13 02:56:29 UTC (rev 690) @@ -114,6 +114,8 @@ public const string CmdPrefixReboot = "Reboot"; public const string CmdPrefixShutdown = "Shutdown"; + public const string CmdPrefixMouse = "Mouse: "; + #endregion Command Prefixes #region XML Tags @@ -138,6 +140,8 @@ public const string XmlTagReboot = "REBOOT"; public const string XmlTagShutdown = "SHUTDOWN"; + public const string XmlTagMouse = "MOUSE"; + #endregion XML Tags #region User Interface Text @@ -161,8 +165,26 @@ public const string UITextReboot = "Reboot"; public const string UITextShutdown = "Shutdown"; + public const string UITextMouse = "Mouse Command"; + #endregion User Interface Text + #region Mouse Commands + + public const string MouseMoveUp = "Move_Up "; + public const string MouseMoveDown = "Move_Down "; + public const string MouseMoveLeft = "Move_Left "; + public const string MouseMoveRight = "Move_Right "; + + public const string MouseClickLeft = "Click_Left"; + public const string MouseClickRight = "Click_Right"; + public const string MouseClickMiddle = "Click_Middle"; + + public const string MouseScrollUp = "Scroll_Up"; + public const string MouseScrollDown = "Scroll_Down"; + + #endregion Mouse Commands + #endregion Strings #endregion Constants @@ -360,6 +382,52 @@ tcpClient.Close(); } + /// <summary> + /// Given a Mouse Command this method will move, click or scroll the mouse according to the command issued. + /// </summary> + /// <param name="command">The Mouse Command string</param> + public static void ProcessMouseCommand(string command) + { + switch (command) + { + case MouseClickLeft: + Mouse.Button(Mouse.MouseEvents.LeftDown); + Mouse.Button(Mouse.MouseEvents.LeftUp); + break; + + case MouseClickMiddle: + Mouse.Button(Mouse.MouseEvents.MiddleDown); + Mouse.Button(Mouse.MouseEvents.MiddleUp); + break; + + case MouseClickRight: + Mouse.Button(Mouse.MouseEvents.RightDown); + Mouse.Button(Mouse.MouseEvents.RightUp); + break; + + case MouseScrollDown: + Mouse.Scroll(Mouse.ScrollDir.Down); + break; + + case MouseScrollUp: + Mouse.Scroll(Mouse.ScrollDir.Up); + break; + + default: + if (command.StartsWith(MouseMoveDown)) + Mouse.Move(0, int.Parse(command.Substring(MouseMoveDown.Length)), false); + else if (command.StartsWith(MouseMoveLeft)) + Mouse.Move(-int.Parse(command.Substring(MouseMoveLeft.Length)), 0, false); + else if (command.StartsWith(MouseMoveRight)) + Mouse.Move(int.Parse(command.Substring(MouseMoveRight.Length)), 0, false); + else if (command.StartsWith(MouseMoveUp)) + Mouse.Move(0, -int.Parse(command.Substring(MouseMoveUp.Length)), false); + else + throw new ApplicationException("Invalid Mouse Command"); + break; + } + } + #endregion Command Execution #region Misc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |