|
From: <an...@us...> - 2008-03-02 16:34:36
|
Revision: 1414
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1414&view=rev
Author: and-81
Date: 2008-03-02 08:34:31 -0800 (Sun, 02 Mar 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IR Server Suite/Applications/Abstractor/MainForm.cs
trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs
trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs
trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs
trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs
trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs
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/Translator/Forms/MacroEditor.cs
trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.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/Tray Launcher/Program.cs
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/RemoteButton.cs
trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/FormMain.cs
trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/FormMain.resx
trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/ServerAddress.cs
trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/MainForm.cs
trunk/plugins/IR Server Suite/Applications/Virtual Remote Skin Editor/Program.cs
trunk/plugins/IR Server Suite/Applications/Web Remote/Program.cs
trunk/plugins/IR Server Suite/Applications/Web Remote/Setup.cs
trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs
trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BlastCommand.cs
trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/LearnIR.cs
trunk/plugins/IR Server Suite/Common/IrssUtils/IrssLog.cs
trunk/plugins/IR Server Suite/Common/IrssUtils/VariableList.cs
trunk/plugins/IR Server Suite/Documentation/new.html
trunk/plugins/IR Server Suite/IR Server Plugins/Keyboard Input/Keyboard Input.cs
trunk/plugins/IR Server Suite/IR Server Suite - Debug.nsi
trunk/plugins/IR Server Suite/IR Server Suite - Release.nsi
trunk/plugins/IR Server Suite/IR Server Suite.sln
trunk/plugins/IR Server Suite/Input Service/Input Service/InputService.cs
trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Program.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/SetupForm.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/MPBlastZonePlugin.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MacroEditor.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/SetupForm.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/PluginSetup.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/TV3BlasterPlugin.cs
trunk/plugins/MCEReplacement/Forms/LearnIR.cs
trunk/plugins/MCEReplacement/Forms/MacroEditor.cs
trunk/plugins/MCEReplacement/Forms/SetupForm.cs
trunk/plugins/MCEReplacement/Forms/StbSetup.cs
trunk/plugins/MCEReplacement/MCEReplacement.cs
Added Paths:
-----------
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Icon.ico
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Keyboard Input Relay.csproj
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/AssemblyInfo.cs
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.Designer.cs
trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.resx
trunk/plugins/IR Server Suite/IR Server Plugins/Keyboard Input/Icon.ico
Modified: trunk/plugins/IR Server Suite/Applications/Abstractor/MainForm.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Abstractor/MainForm.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Abstractor/MainForm.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -212,7 +212,7 @@
public MainForm()
{
IrssLog.LogLevel = IrssLog.Level.Debug;
- IrssLog.Open(Common.FolderIrssLogs + "Abstractor.log");
+ IrssLog.Open("Abstractor.log");
InitializeComponent();
Modified: trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Debug Client/MainForm.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -99,7 +99,7 @@
#region Constants
- static readonly string DebugIRFile = IrssUtils.Common.FolderIRCommands + "DebugClient.IR";
+ static readonly string DebugIRFile = Path.Combine(Common.FolderIRCommands, "DebugClient.IR");
#endregion
@@ -131,7 +131,7 @@
private void MainForm_Load(object sender, EventArgs e)
{
IrssLog.LogLevel = IrssLog.Level.Debug;
- IrssLog.Open(Common.FolderIrssLogs + "Debug Client.log");
+ IrssLog.Open("Debug Client.log");
_addStatusLine = new DelegateAddStatusLine(AddStatusLine);
Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -47,7 +47,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Append(Common.FolderIrssLogs + "IR Blast.log");
+ IrssLog.Append("IR Blast.log");
ShowHeader();
@@ -141,7 +141,7 @@
}
else
{
- fileName = Common.FolderIRCommands + digit + Common.FileExtensionIR;
+ fileName = Path.Combine(Common.FolderIRCommands, digit + Common.FileExtensionIR);
BlastIR(fileName, _blastPort);
}
@@ -155,7 +155,7 @@
}
else
{
- fileName = Common.FolderIRCommands + command;
+ fileName = Path.Combine(Common.FolderIRCommands, command);
BlastIR(fileName, _blastPort);
}
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 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -48,7 +48,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Append(Common.FolderIrssLogs + "IR Blast (No Window).log");
+ IrssLog.Append("IR Blast (No Window).log");
try
{
@@ -140,7 +140,7 @@
}
else
{
- fileName = Common.FolderIRCommands + digit + Common.FileExtensionIR;
+ fileName = Path.Combine(Common.FolderIRCommands, digit + Common.FileExtensionIR);
BlastIR(fileName, _blastPort);
}
@@ -154,7 +154,7 @@
}
else
{
- fileName = Common.FolderIRCommands + command;
+ fileName = Path.Combine(Common.FolderIRCommands, command);
BlastIR(fileName, _blastPort);
}
Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -25,7 +25,7 @@
#region Constants
- static readonly string ConfigurationFile = Common.FolderAppData + "IR File Tool\\IR File Tool.xml";
+ static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "IR File Tool\\IR File Tool.xml");
#endregion Constants
Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/IR File Tool/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -24,7 +24,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Open(Common.FolderIrssLogs + "IR File Tool.log");
+ IrssLog.Open("IR File Tool.log");
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -51,7 +51,7 @@
#region Constants
- static readonly string ConfigurationFile = Common.FolderAppData + "IR Server\\IR Server.xml";
+ static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "IR Server\\IR Server.xml");
#endregion Constants
Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -46,7 +46,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Open(Common.FolderIrssLogs + "IR Server.log");
+ IrssLog.Open("IR Server.log");
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
Property changes on: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Added: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Icon.ico
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Icon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Keyboard Input Relay.csproj
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Keyboard Input Relay.csproj (rev 0)
+++ trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Keyboard Input Relay.csproj 2008-03-02 16:34:31 UTC (rev 1414)
@@ -0,0 +1,78 @@
+<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>{097F7027-77A1-4623-8D6C-3D2020769EFD}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>KeyboardInputRelay</RootNamespace>
+ <AssemblyName>KeyboardInputRelay</AssemblyName>
+ <ApplicationIcon>Icon.ico</ApplicationIcon>
+ <StartupObject>KeyboardInputRelay.Program</StartupObject>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <DocumentationFile>bin\Debug\KeyboardInputRelay.xml</DocumentationFile>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Icon.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Common\IrssComms\IrssComms.csproj">
+ <Project>{BCAFDF45-70DD-46FD-8B98-880DDA585AD2}</Project>
+ <Name>IrssComms</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Common\IrssUtils\IrssUtils.csproj">
+ <Project>{CA15769C-232E-4CA7-94FD-206A06CA3ABB}</Project>
+ <Name>IrssUtils</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <SubType>Designer</SubType>
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </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.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs (rev 0)
+++ trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -0,0 +1,529 @@
+using System;
+using System.ComponentModel;
+#if TRACE
+using System.Diagnostics;
+#endif
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+using System.Xml;
+
+using IrssComms;
+using IrssUtils;
+using IrssUtils.Forms;
+
+namespace KeyboardInputRelay
+{
+
+ static class Program
+ {
+
+ #region Constants
+
+ static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "Keyboard Input Relay\\Keyboard Input Relay.xml");
+
+ #endregion Constants
+
+ #region Interop
+
+ [DllImport("user32.dll")]
+ static extern IntPtr SetWindowsHookEx(HookType code, HookDelegate func, IntPtr hInstance, int threadID);
+
+ [DllImport("user32.dll")]
+ static extern int UnhookWindowsHookEx(IntPtr hhook);
+
+ [DllImport("user32.dll")]
+ static extern int CallNextHookEx(IntPtr hhook, int code, int wParam, IntPtr lParam);
+
+ [DllImport("kernel32.dll")]
+ static extern IntPtr LoadLibrary(string lpFileName);
+
+ #endregion Interop
+
+ #region Delegates
+
+ delegate int HookDelegate(int code, int wParam, IntPtr lParam);
+
+ #endregion Delegates
+
+ #region Enumerations
+
+ enum HookType
+ {
+ WH_JOURNALRECORD = 0,
+ WH_JOURNALPLAYBACK = 1,
+ WH_KEYBOARD = 2,
+ WH_GETMESSAGE = 3,
+ WH_CALLWNDPROC = 4,
+ WH_CBT = 5,
+ WH_SYSMSGFILTER = 6,
+ WH_MOUSE = 7,
+ WH_HARDWARE = 8,
+ WH_DEBUG = 9,
+ WH_SHELL = 10,
+ WH_FOREGROUNDIDLE = 11,
+ WH_CALLWNDPROCRET = 12,
+ WH_KEYBOARD_LL = 13,
+ WH_MOUSE_LL = 14
+ }
+
+ enum AppCommands
+ {
+ None = 0,
+ BrowserBackward = 1,
+ BrowserForward = 2,
+ BrowserRefresh = 3,
+ BrowserStop = 4,
+ BrowserSearch = 5,
+ BrowserFavorites = 6,
+ BrowserHome = 7,
+ VolumeMute = 8,
+ VolumeDown = 9,
+ VolumeUp = 10,
+ MediaNextTrack = 11,
+ MediaPreviousTrack = 12,
+ MediaStop = 13,
+ MediaPlayPause = 14,
+ LaunchMail = 15,
+ LaunchMediaSelect = 16,
+ LaunchApp1 = 17,
+ LaunchApp2 = 18,
+ BassDown = 19,
+ BassBoost = 20,
+ BassUp = 21,
+ TrebleDown = 22,
+ TrebleUp = 23,
+ MicrophoneVolumeMute = 24,
+ MicrophoneVolumeDown = 25,
+ MicrophoneVolumeUp = 26,
+ Help = 27,
+ Find = 28,
+ New = 29,
+ Open = 30,
+ Close = 31,
+ Save = 32,
+ Print = 33,
+ Undo = 34,
+ Redo = 35,
+ Copy = 36,
+ Cut = 37,
+ Paste = 38,
+ ReplyToMail = 39,
+ ForwardMail = 40,
+ SendMail = 41,
+ SpellCheck = 42,
+ DictateOrCommandControlToggle = 43,
+ MicrophoneOnOffToggle = 44,
+ CorrectionList = 45,
+ MediaPlay = 46,
+ MediaPause = 47,
+ MediaRecord = 48,
+ MediaFastForward = 49,
+ MediaRewind = 50,
+ MediaChannelUp = 51,
+ MediaChannelDown = 52,
+ Delete = 53,
+ Flip3D = 54,
+ }
+
+ #endregion Enumerations
+
+ #region Structures
+
+ struct KeyboardHookStruct
+ {
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="KeyboardHookStruct"/> struct.
+ /// </summary>
+ /// <param name="lParam">The lParam to derive from.</param>
+ public KeyboardHookStruct(IntPtr lParam)
+ {
+ KeyboardHookStruct khs = (KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct));
+
+ virtualKey = khs.virtualKey;
+ scanCode = khs.scanCode;
+ flags = khs.flags;
+ time = khs.time;
+ dwExtraInfo = khs.dwExtraInfo;
+ }
+
+ public int virtualKey;
+ public int scanCode;
+ public int flags;
+ public int time;
+ public int dwExtraInfo;
+ }
+
+ #endregion Structures
+
+ #region Variables
+
+ static NotifyIcon _notifyIcon;
+
+ static bool _stealAppCommands = true;
+
+ static IntPtr _hookHandle;
+ static HookDelegate _hookDelegate;
+ static IntPtr _libPtr;
+
+ static Client _client;
+ static bool _registered;
+ static string _serverHost;
+
+ #endregion Variables
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+
+#if DEBUG
+ IrssLog.LogLevel = IrssLog.Level.Debug;
+#else
+ IrssLog.LogLevel = IrssLog.Level.Info;
+#endif
+ IrssLog.Open("Keyboard Input Relay.log");
+
+ Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
+
+ SetupNotify();
+
+ LoadSettings();
+
+ bool clientStarted = false;
+
+ IPAddress serverIP = Client.GetIPFromName(_serverHost);
+ IPEndPoint endPoint = new IPEndPoint(serverIP, IrssComms.Server.DefaultPort);
+
+ try
+ {
+ clientStarted = StartClient(endPoint);
+ }
+ catch (Exception ex)
+ {
+ IrssLog.Error(ex);
+ clientStarted = false;
+ }
+
+ if (clientStarted)
+ {
+ StartHook();
+
+ _notifyIcon.Visible = true;
+
+ Application.Run();
+
+ _notifyIcon.Visible = false;
+
+ StopHook();
+
+ StopClient();
+ }
+
+ Application.ThreadException -= new ThreadExceptionEventHandler(Application_ThreadException);
+
+ IrssLog.Close();
+ }
+
+ /// <summary>
+ /// Handles unhandled exceptions.
+ /// </summary>
+ /// <param name="sender">Sender.</param>
+ /// <param name="e">Event args.</param>
+ static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
+ {
+ IrssLog.Error(e.Exception);
+ }
+
+ static void LoadSettings()
+ {
+ XmlDocument doc = new XmlDocument();
+
+ try
+ {
+ doc.Load(ConfigurationFile);
+ }
+ catch (Exception ex)
+ {
+ IrssLog.Error(ex);
+
+ _serverHost = "localhost";
+
+ return;
+ }
+
+ try { _serverHost = doc.DocumentElement.Attributes["ServerHost"].Value; } catch { _serverHost = "localhost"; }
+ }
+ static void SaveSettings()
+ {
+ try
+ {
+ using (XmlTextWriter writer = new XmlTextWriter(ConfigurationFile, Encoding.UTF8))
+ {
+ writer.Formatting = Formatting.Indented;
+ writer.Indentation = 1;
+ writer.IndentChar = (char)9;
+ writer.WriteStartDocument(true);
+ writer.WriteStartElement("settings"); // <settings>
+
+ writer.WriteAttributeString("ServerHost", _serverHost);
+
+ writer.WriteEndElement(); // </settings>
+ writer.WriteEndDocument();
+ }
+ }
+ catch (Exception ex)
+ {
+ IrssLog.Error(ex);
+ }
+ }
+
+ static void CommsFailure(object obj)
+ {
+ Exception ex = obj as Exception;
+
+ if (ex != null)
+ IrssLog.Error("Communications failure: {0}", ex.Message);
+ else
+ IrssLog.Error("Communications failure");
+
+ _notifyIcon.Text = "Keyboard Input Relay - Serious Communications Failure";
+
+ StopClient();
+
+ MessageBox.Show("Please report this error.", "Keyboard Input Relay - Communications failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ static void Connected(object obj)
+ {
+ IrssLog.Info("Connected to server");
+
+ _notifyIcon.Text = "Keyboard Input Relay";
+
+ IrssMessage message = new IrssMessage(MessageType.RegisterClient, MessageFlags.Request);
+ _client.Send(message);
+ }
+ static void Disconnected(object obj)
+ {
+ IrssLog.Warn("Communications with server has been lost");
+
+ _notifyIcon.Text = "Keyboard Input Relay - Connecting ...";
+
+ Thread.Sleep(1000);
+ }
+
+ static bool StartClient(IPEndPoint endPoint)
+ {
+ if (_client != null)
+ return false;
+
+ ClientMessageSink sink = new ClientMessageSink(ReceivedMessage);
+
+ _client = new Client(endPoint, sink);
+ _client.CommsFailureCallback = new WaitCallback(CommsFailure);
+ _client.ConnectCallback = new WaitCallback(Connected);
+ _client.DisconnectCallback = new WaitCallback(Disconnected);
+
+ if (_client.Start())
+ {
+ return true;
+ }
+ else
+ {
+ _client = null;
+ return false;
+ }
+ }
+ static void StopClient()
+ {
+ if (_client == null)
+ return;
+
+ _client.Dispose();
+ _client = null;
+
+ _registered = false;
+ }
+
+ static void ReceivedMessage(IrssMessage received)
+ {
+ IrssLog.Debug("Received Message \"{0}\"", received.Type);
+
+ try
+ {
+ switch (received.Type)
+ {
+ case MessageType.RegisterClient:
+ if ((received.Flags & MessageFlags.Success) == MessageFlags.Success)
+ {
+ //_irServerInfo = IRServerInfo.FromBytes(received.DataAsBytes);
+ _registered = true;
+
+ IrssLog.Info("Registered to Input Service");
+ }
+ else if ((received.Flags & MessageFlags.Failure) == MessageFlags.Failure)
+ {
+ _registered = false;
+ IrssLog.Warn("Input Service refused to register");
+ }
+ break;
+
+ case MessageType.ServerShutdown:
+ IrssLog.Warn("Input Service Shutdown - Keyboard Input Relay disabled until Input Service returns");
+
+ _notifyIcon.Text = "Keyboard Input Relay - Connecting ...";
+
+ _registered = false;
+ break;
+
+ case MessageType.Error:
+ IrssLog.Error(received.GetDataAsString());
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ IrssLog.Error(ex);
+ }
+ }
+
+ static void SetupNotify()
+ {
+ // Setup notify icon ...
+ _notifyIcon = new NotifyIcon();
+ _notifyIcon.Icon = Properties.Resources.Icon;
+ _notifyIcon.Text = "Keyboard Input Relay - Connecting ...";
+
+ _notifyIcon.ContextMenuStrip = new ContextMenuStrip();
+ _notifyIcon.ContextMenuStrip.Items.Add("&Setup", null, new EventHandler(NotifyIcon_ClickSetup));
+ _notifyIcon.ContextMenuStrip.Items.Add("&Quit", null, new EventHandler(NotifyIcon_ClickQuit));
+
+ _notifyIcon.Visible = true;
+ }
+
+ static void NotifyIcon_ClickSetup(object sender, EventArgs e)
+ {
+ Setup();
+ }
+ static void NotifyIcon_ClickQuit(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ static void Setup()
+ {
+ ServerAddress serverAddress = new ServerAddress();
+ if (serverAddress.ShowDialog() == DialogResult.OK)
+ {
+ _serverHost = serverAddress.ServerHost;
+ SaveSettings();
+ }
+ }
+
+ static void StartHook()
+ {
+ _hookDelegate = new HookDelegate(InternalHookDelegate);
+ _libPtr = LoadLibrary("User32");
+ _hookHandle = SetWindowsHookEx(HookType.WH_KEYBOARD_LL, _hookDelegate, _libPtr, 0);
+ }
+ static void StopHook()
+ {
+ UnhookWindowsHookEx(_hookHandle);
+
+ _hookHandle = IntPtr.Zero;
+ _hookDelegate = null;
+ _libPtr = IntPtr.Zero;
+ }
+
+ static int InternalHookDelegate(int code, int wParam, IntPtr lParam)
+ {
+ try
+ {
+ if (code >= 0 && wParam == 256)
+ {
+ KeyboardHookStruct khs = new KeyboardHookStruct(lParam);
+ int keyCode = khs.virtualKey;
+
+ AppCommands appCommand = KeyCodeToAppCommand((Keys)khs.virtualKey);
+ if (appCommand == AppCommands.None)
+ {
+ if (khs.virtualKey == (int)Keys.LShiftKey || khs.virtualKey == (int)Keys.LControlKey ||
+ khs.virtualKey == (int)Keys.RShiftKey || khs.virtualKey == (int)Keys.RControlKey)
+ return CallNextHookEx(_hookHandle, code, wParam, lParam);
+
+ if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) keyCode |= 0x00100000;
+ if ((Control.ModifierKeys & Keys.Control) == Keys.Control) keyCode |= 0x01000000;
+ if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt) keyCode |= 0x10000000;
+ }
+ else
+ {
+ keyCode |= (((int)appCommand) << 8);
+ }
+
+ if (_registered)
+ {
+ byte[] deviceNameBytes = Encoding.ASCII.GetBytes("Keyboard");
+ byte[] keyCodeBytes = Encoding.ASCII.GetBytes(String.Format("{0:X8}", keyCode));
+
+ byte[] bytes = new byte[8 + deviceNameBytes.Length + keyCodeBytes.Length];
+
+ BitConverter.GetBytes(deviceNameBytes.Length).CopyTo(bytes, 0);
+ deviceNameBytes.CopyTo(bytes, 4);
+ BitConverter.GetBytes(keyCodeBytes.Length).CopyTo(bytes, 4 + deviceNameBytes.Length);
+ keyCodeBytes.CopyTo(bytes, 8 + deviceNameBytes.Length);
+
+ IrssMessage message = new IrssMessage(MessageType.ForwardRemoteEvent, MessageFlags.Notify, bytes);
+ _client.Send(message);
+ }
+
+ if (_stealAppCommands && appCommand != AppCommands.None)
+ return 1;
+ }
+ }
+ catch (Exception ex)
+ {
+ IrssLog.Error(ex);
+ }
+
+ return CallNextHookEx(_hookHandle, code, wParam, lParam);
+ }
+
+ static AppCommands KeyCodeToAppCommand(Keys keyCode)
+ {
+ switch (keyCode)
+ {
+ case Keys.BrowserBack: return AppCommands.BrowserBackward;
+ case Keys.BrowserFavorites: return AppCommands.BrowserFavorites;
+ case Keys.BrowserForward: return AppCommands.BrowserForward;
+ case Keys.BrowserHome: return AppCommands.BrowserHome;
+ case Keys.BrowserRefresh: return AppCommands.BrowserRefresh;
+ case Keys.BrowserSearch: return AppCommands.BrowserSearch;
+ case Keys.BrowserStop: return AppCommands.BrowserStop;
+ case Keys.Help: return AppCommands.Help;
+ case Keys.LaunchApplication1: return AppCommands.LaunchApp1;
+ case Keys.LaunchApplication2: return AppCommands.LaunchApp2;
+ case Keys.LaunchMail: return AppCommands.LaunchMail;
+ case Keys.MediaNextTrack: return AppCommands.MediaNextTrack;
+ case Keys.MediaPlayPause: return AppCommands.MediaPlayPause;
+ case Keys.MediaPreviousTrack: return AppCommands.MediaPreviousTrack;
+ case Keys.MediaStop: return AppCommands.MediaStop;
+ case Keys.SelectMedia: return AppCommands.LaunchMediaSelect;
+ case Keys.VolumeDown: return AppCommands.VolumeDown;
+ case Keys.VolumeMute: return AppCommands.VolumeMute;
+ case Keys.VolumeUp: return AppCommands.VolumeUp;
+ default: return AppCommands.None;
+ }
+ }
+
+ }
+
+}
Added: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/AssemblyInfo.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -0,0 +1,36 @@
+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("Keyboard Input Relay")]
+[assembly: AssemblyDescription("Relays keyboard input to the input service to use like remote button presses")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("and-81")]
+[assembly: AssemblyProduct("Keyboard Input Relay")]
+[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)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("cf85e48e-e867-49e5-b240-693378fdd11c")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.4.2")]
+[assembly: AssemblyFileVersion("1.0.4.2")]
+
+[assembly: CLSCompliant(true)]
Added: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.Designer.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.Designer.cs (rev 0)
+++ trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.Designer.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -0,0 +1,70 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.832
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace KeyboardInputRelay.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KeyboardInputRelay.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ internal static System.Drawing.Icon Icon {
+ get {
+ object obj = ResourceManager.GetObject("Icon", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+ }
+}
Added: trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.resx
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.resx (rev 0)
+++ trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Properties/Resources.resx 2008-03-02 16:34:31 UTC (rev 1414)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <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="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\icon.ico;System.Drawing.Icon, 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/Forms/MacroEditor.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -47,7 +47,7 @@
textBoxName.Text = name;
textBoxName.Enabled = false;
- string fileName = Program.FolderMacros + name + Common.FileExtensionMacro;
+ string fileName = Path.Combine(Program.FolderMacros, name + Common.FileExtensionMacro);
string[] commands = IrssMacro.ReadFromFile(fileName);
listBoxMacro.Items.AddRange(commands);
@@ -344,8 +344,10 @@
foreach (string item in listBoxMacro.Items)
commands[index++] = item;
- IrssMacro.WriteToFile(Program.FolderMacros + name + Common.FileExtensionMacro, commands);
+ string fileName = Path.Combine(Program.FolderMacros, name + Common.FileExtensionMacro);
+ IrssMacro.WriteToFile(fileName, commands);
+
Program.ProcessCommand(Common.CmdPrefixMacro + name, false);
}
catch (Exception ex)
@@ -386,7 +388,9 @@
foreach (string item in listBoxMacro.Items)
commands[index++] = item;
- IrssMacro.WriteToFile(Program.FolderMacros + name + Common.FileExtensionMacro, commands);
+ string fileName = Path.Combine(Program.FolderMacros, name + Common.FileExtensionMacro);
+
+ IrssMacro.WriteToFile(fileName, commands);
}
catch (Exception ex)
{
Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -412,7 +412,7 @@
return;
string command = listViewIR.SelectedItems[0].Text;
- string fileName = Common.FolderIRCommands + command + Common.FileExtensionIR;
+ string fileName = Path.Combine(Common.FolderIRCommands, command + Common.FileExtensionIR);
if (File.Exists(fileName))
{
@@ -438,7 +438,7 @@
return;
string command = listViewMacro.SelectedItems[0].Text;
- string fileName = Program.FolderMacros + command + Common.FileExtensionMacro;
+ string fileName = Path.Combine(Program.FolderMacros, command + Common.FileExtensionMacro);
if (File.Exists(fileName))
{
@@ -805,7 +805,7 @@
ListViewItem originItem = origin.Items[e.Item];
- string oldFileName = Common.FolderIRCommands + originItem.Text + Common.FileExtensionIR;
+ string oldFileName = Path.Combine(Common.FolderIRCommands, originItem.Text + Common.FileExtensionIR);
if (!File.Exists(oldFileName))
{
MessageBox.Show("File not found: " + oldFileName, "Cannot rename, Original file not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -824,7 +824,7 @@
try
{
- string newFileName = Common.FolderIRCommands + name + Common.FileExtensionIR;
+ string newFileName = Path.Combine(Common.FolderIRCommands, name + Common.FileExtensionIR);
File.Move(oldFileName, newFileName);
}
@@ -851,7 +851,7 @@
ListViewItem originItem = origin.Items[e.Item];
- string oldFileName = Program.FolderMacros + originItem.Text + Common.FileExtensionMacro;
+ string oldFileName = Path.Combine(Program.FolderMacros, originItem.Text + Common.FileExtensionMacro);
if (!File.Exists(oldFileName))
{
MessageBox.Show("File not found: " + oldFileName, "Cannot rename, Original file not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -870,8 +870,7 @@
try
{
- string newFileName = Program.FolderMacros + name + Common.FileExtensionMacro;
-
+ string newFileName = Path.Combine(Program.FolderMacros, name + Common.FileExtensionMacro);
File.Move(oldFileName, newFileName);
}
catch (Exception ex)
@@ -1286,7 +1285,7 @@
return;
string file = listViewMacro.SelectedItems[0].Text;
- string fileName = Program.FolderMacros + file + Common.FileExtensionMacro;
+ string fileName = Path.Combine(Program.FolderMacros, file + Common.FileExtensionMacro);
if (File.Exists(fileName))
{
if (MessageBox.Show(this, "Are you sure you want to delete \"" + file + "\"?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
@@ -1328,7 +1327,7 @@
string translatorFolder = Path.Combine(SystemRegistry.GetInstallFolder(), "Translator");
- //shortcut.Arguments = String.Format("-MACRO \"{0}{1}{2}\"", Program.FolderMacros, macroName, Common.FileExtensionMacro);
+ //shortcut.Arguments = String.Format("-MACRO \"{0}\"", Path.Combine(Program.FolderMacros, macroName + Common.FileExtensionMacro));
shortcut.Arguments = String.Format("-MACRO \"{0}\"", macroName);
shortcut.Description = "Launch Macro: " + macroName;
shortcut.Path = Path.Combine(translatorFolder, "Translator.exe");
@@ -1361,7 +1360,7 @@
return;
string file = listViewIR.SelectedItems[0].Text;
- string fileName = Common.FolderIRCommands + file + Common.FileExtensionIR;
+ string fileName = Path.Combine(Common.FolderIRCommands, file + Common.FileExtensionIR);
if (File.Exists(fileName))
{
if (MessageBox.Show(this, "Are you sure you want to delete \"" + file + "\"?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -26,11 +26,11 @@
#region Constants
- internal static readonly string ConfigFile = Common.FolderAppData + "Translator\\Translator.xml";
+ internal static readonly string ConfigFile = Path.Combine(Common.FolderAppData, "Translator\\Translator.xml");
- internal static readonly string FolderMacros = Common.FolderAppData + "Translator\\Macro\\";
+ internal static readonly string FolderMacros = Path.Combine(Common.FolderAppData, "Translator\\Macro");
- const string ProcessCommandThreadName = "ProcessCommand";
+ const string ProcessCommandThreadName = "ProcessCommand";
#endregion Constants
@@ -118,7 +118,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Open(Common.FolderIrssLogs + "Translator.log");
+ IrssLog.Open("Translator.log");
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
@@ -1045,13 +1045,13 @@
if (command.StartsWith(Common.CmdPrefixMacro, StringComparison.OrdinalIgnoreCase))
{
- string fileName = FolderMacros + command.Substring(Common.CmdPrefixMacro.Length) + Common.FileExtensionMacro;
+ string fileName = Path.Combine(FolderMacros, command.Substring(Common.CmdPrefixMacro.Length) + Common.FileExtensionMacro);
IrssMacro.ExecuteMacro(fileName, _variables, new ProcessCommandCallback(ProcCommand));
}
else if (command.StartsWith(Common.CmdPrefixBlast, StringComparison.OrdinalIgnoreCase))
{
string[] commands = Common.SplitBlastCommand(command.Substring(Common.CmdPrefixBlast.Length));
- BlastIR(Common.FolderIRCommands + commands[0] + Common.FileExtensionIR, commands[1]);
+ BlastIR(Path.Combine(Common.FolderIRCommands, commands[0] + Common.FileExtensionIR), commands[1]);
}
else if (command.StartsWith(Common.CmdPrefixPause, StringComparison.OrdinalIgnoreCase))
{
Modified: trunk/plugins/IR Server Suite/Applications/Translator/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Translator/Properties/AssemblyInfo.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Translator/Properties/AssemblyInfo.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -9,7 +9,7 @@
// associated with an assembly.
//
[assembly: AssemblyTitle("Translator")]
-[assembly: AssemblyDescription("Remote control application for use with IR Server")]
+[assembly: AssemblyDescription("PC control application for use with Input Service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("and-81")]
[assembly: AssemblyProduct("Translator")]
Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -29,7 +29,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Open(Common.FolderIrssLogs + "Tray Launcher.log");
+ IrssLog.Open("Tray Launcher.log");
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -27,7 +27,7 @@
const string DefaultKeyCode = "31730";
- static readonly string ConfigurationFile = Common.FolderAppData + "Tray Launcher\\Tray Launcher.xml";
+ static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "Tray Launcher\\Tray Launcher.xml");
#endregion Constants
Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Virtual Remote/MainForm.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -112,8 +112,7 @@
{
try
{
- string path = Path.Combine(Program.InstallFolder, "Skins");
- string[] skins = Directory.GetFiles(path, "*.png", SearchOption.TopDirectoryOnly);
+ string[] skins = Directory.GetFiles(Program.SkinsFolder, "*.png", SearchOption.TopDirectoryOnly);
for (int index = 0; index < skins.Length; index++)
skins[index] = Path.GetFileNameWithoutExtension(skins[index]);
@@ -135,17 +134,17 @@
if (String.IsNullOrEmpty(skin))
return;
- string skinFile = Path.Combine(Program.InstallFolder, String.Format("Skins\\{0}.png", skin));
+ string skinFile = Path.Combine(Program.SkinsFolder, skin + ".png");
if (!File.Exists(skinFile))
throw new FileNotFoundException("Skin graphic file not found", skinFile);
// Try to load xml file of same name, failing that load using first word of skin name ...
- string xmlFile = Path.Combine(Program.InstallFolder, String.Format("Skins\\{0}.xml", skin));
+ string xmlFile = Path.Combine(Program.SkinsFolder, skin + ".xml");
if (!File.Exists(xmlFile))
{
string firstWord = skin.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0];
- xmlFile = Path.Combine(Program.InstallFolder, String.Format("Skins\\{0}.xml", firstWord));
+ xmlFile = Path.Combine(Program.SkinsFolder, firstWord + ".xml");
if (!File.Exists(xmlFile))
throw new FileNotFoundException("Skin file not found", xmlFile);
}
Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Virtual Remote/Program.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -26,7 +26,7 @@
const string DefaultSkin = "MCE";
- static readonly string ConfigurationFile = Common.FolderAppData + "Virtual Remote\\Virtual Remote.xml";
+ static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, "Virtual Remote\\Virtual Remote.xml");
#endregion Constants
@@ -38,7 +38,7 @@
static string _serverHost;
- static string _installFolder;
+ static string _skinsFolder;
static string _remoteSkin;
@@ -61,9 +61,9 @@
set { _serverHost = value; }
}
- internal static string InstallFolder
+ internal static string SkinsFolder
{
- get { return _installFolder; }
+ get { return _skinsFolder; }
}
internal static string RemoteSkin
@@ -100,7 +100,7 @@
#else
IrssLog.LogLevel = IrssLog.Level.Info;
#endif
- IrssLog.Open(Common.FolderIrssLogs + "Virtual Remote.log");
+ IrssLog.Open("Virtual Remote.log");
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
@@ -223,17 +223,17 @@
{
try
{
- _installFolder = SystemRegistry.GetInstallFolder();
- if (String.IsNullOrEmpty(_installFolder))
- _installFolder = ".";
+ _skinsFolder = SystemRegistry.GetInstallFolder();
+ if (String.IsNullOrEmpty(_skinsFolder))
+ _skinsFolder = ".\\Skins";
else
- _installFolder = Path.Combine(_installFolder, "Virtual Remote");
+ _skinsFolder = Path.Combine(_skinsFolder, "Virtual Remote\\Skins");
}
catch (Exception ex)
{
IrssLog.Error(ex);
- _installFolder = ".";
+ _skinsFolder = ".\\Skins";
}
XmlDocument doc = new XmlDocument();
Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote/RemoteButton.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Virtual Remote/RemoteButton.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Virtual Remote/RemoteButton.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -4,6 +4,9 @@
namespace VirtualRemote
{
+ /// <summary>
+ /// Data structure for Virtual Remote button representation.
+ /// </summary>
struct RemoteButton
{
@@ -21,36 +24,64 @@
#region Properties
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>The name.</value>
public string Name
{
get { return _name; }
set { _name = value; }
}
+ /// <summary>
+ /// Gets or sets the code.
+ /// </summary>
+ /// <value>The code.</value>
public string Code
{
get { return _code; }
set { _code = value; }
}
+ /// <summary>
+ /// Gets or sets the shortcut.
+ /// </summary>
+ /// <value>The shortcut.</value>
public Keys Shortcut
{
get { return _shortcut; }
set { _shortcut = value; }
}
+ /// <summary>
+ /// Gets or sets the distance from top.
+ /// </summary>
+ /// <value>The distance from top.</value>
public int Top
{
get { return _top; }
set { _top = value; }
}
+ /// <summary>
+ /// Gets or sets the distance from left.
+ /// </summary>
+ /// <value>The distance from left.</value>
public int Left
{
get { return _left; }
set { _left = value; }
}
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ /// <value>The width.</value>
public int Width
{
get { return _width; }
set { _width = value; }
}
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ /// <value>The height.</value>
public int Height
{
get { return _height; }
Modified: trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/FormMain.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/FormMain.cs 2008-03-02 07:03:40 UTC (rev 1413)
+++ trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/FormMain.cs 2008-03-02 16:34:31 UTC (rev 1414)
@@ -40,7 +40,7 @@
Client _client;
- string _serverHost = "192.168.0.3";
+ string _serverHost;
bool _registered;
@@ -199,12 +199,12 @@
}
catch
{
- _serverHost = "192.168.0.1";
+ _serverHost = null;
return;
}
try { _serverHost = doc.DocumentElement.Attributes["ServerHost"].Value; }
- ...
[truncated message content] |