From: <rs...@us...> - 2011-11-04 13:48:36
|
Revision: 4320 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4320&view=rev Author: rsenden Date: 2011-11-04 13:48:30 +0000 (Fri, 04 Nov 2011) Log Message: ----------- Updated for MP 1.2.1 compatibility, updated file locations Modified Paths: -------------- trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputHandler.cs trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputMappingForm.cs trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj.user Modified: trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputHandler.cs =================================================================== --- trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputHandler.cs 2011-11-04 13:48:02 UTC (rev 4319) +++ trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputHandler.cs 2011-11-04 13:48:30 UTC (rev 4320) @@ -63,8 +63,24 @@ /// </summary> public int CurrentLayer { get { return _currentLayer; } } + /// <summary> + /// Returns the path to the directory, which contains all available default input device mappings. + /// </summary> + public static string DefaultsDirectory + { + get { return Config.GetSubFolder(Config.Dir.Base, @"Defaults\InputDeviceMappings"); } + } /// <summary> + /// Returns the path to the directory, which contains the customized mappings directory. + /// </summary> + public static string CustomizedMappingsDirectory + { + get { return Config.GetSubFolder(Config.Dir.Config, @"InputDeviceMappings"); } + } + + + /// <summary> /// Condition/action class /// </summary> public class Mapping @@ -133,9 +149,10 @@ /// <param name="deviceXmlName">Input device name</param> public InputHandler(string deviceXmlName) { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - _basicHome = xmlreader.GetValueAsBool("general", "startbasichome", false); - //_basicHome = false; + using (Settings xmlreader = new MPSettings()) + { + _basicHome = xmlreader.GetValueAsBool("gui", "startbasichome", false); + } string xmlPath = GetXmlPath(deviceXmlName); LoadMapping(xmlPath); } @@ -180,8 +197,8 @@ public string GetXmlPath(string deviceXmlName) { string path = string.Empty; - string pathCustom = Config.GetFile(Config.Dir.CustomInputDevice, deviceXmlName + ".xml"); - string pathDefault = Config.GetFile(Config.Dir.CustomInputDefault, deviceXmlName + ".xml"); + string pathCustom = Path.Combine(InputHandler.CustomizedMappingsDirectory, deviceXmlName + ".xml"); + string pathDefault = Path.Combine(InputHandler.DefaultsDirectory, deviceXmlName + ".xml"); if (System.IO.File.Exists(pathCustom) && CheckXmlFile(pathCustom)) { Modified: trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputMappingForm.cs =================================================================== --- trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputMappingForm.cs 2011-11-04 13:48:02 UTC (rev 4319) +++ trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/InputMappingForm.cs 2011-11-04 13:48:30 UTC (rev 4320) @@ -24,19 +24,17 @@ #endregion using System; -using System.Diagnostics; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Xml; using System.IO; -using System.Runtime.InteropServices; using MediaPortal.GUI.Library; -using MediaPortal.Util; using System.Threading; using MediaPortal.Configuration; using System.Reflection; +using System.Text; namespace KeyboardInputPlugin // KBIP CHANGED: namespace { @@ -196,20 +194,20 @@ case (int)GUIWindow.Window.WINDOW_INVALID: case (int)GUIWindow.Window.WINDOW_MINI_GUIDE: case (int)GUIWindow.Window.WINDOW_TV_CROP_SETTINGS: - case (int)GUIWindow.Window.WINDOW_MSNOSD: + //case (int)GUIWindow.Window.WINDOW_MSNOSD: case (int)GUIWindow.Window.WINDOW_MUSIC: case (int)GUIWindow.Window.WINDOW_MUSIC_COVERART_GRABBER_RESULTS: case (int)GUIWindow.Window.WINDOW_MUSIC_INFO: case (int)GUIWindow.Window.WINDOW_OSD: case (int)GUIWindow.Window.WINDOW_TOPBAR: //case (int)GUIWindow.Window.WINDOW_TOPBARHOME: - case (int)GUIWindow.Window.WINDOW_TVMSNOSD: + //case (int)GUIWindow.Window.WINDOW_TVMSNOSD: case (int)GUIWindow.Window.WINDOW_TVOSD: case (int)GUIWindow.Window.WINDOW_TVZAPOSD: case (int)GUIWindow.Window.WINDOW_VIDEO_ARTIST_INFO: case (int)GUIWindow.Window.WINDOW_VIDEO_INFO: case (int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD: - case (int)GUIWindow.Window.WINDOW_VIRTUAL_WEB_KEYBOARD: + //case (int)GUIWindow.Window.WINDOW_VIRTUAL_WEB_KEYBOARD: break; default: windowsListFiltered.Add(GetFriendlyName(wnd.ToString())); @@ -914,14 +912,19 @@ void LoadMapping(string xmlFile, bool defaults) { + string pathDefault = Path.Combine(InputHandler.DefaultsDirectory, xmlFile); + string pathCustom = Path.Combine(InputHandler.CustomizedMappingsDirectory, xmlFile); + groupBoxMapping.Enabled = false; groupBoxButton.Enabled = false; groupBoxLayer.Enabled = false; groupBoxCondition.Enabled = false; groupBoxAction.Enabled = false; - string path = Config.GetFolder(Config.Dir.Base) + "\\InputDeviceMappings\\defaults\\" + xmlFile; - if (!defaults && File.Exists(Config.GetFile(Config.Dir.CustomInputDevice, xmlFile))) - path = Config.GetFile(Config.Dir.CustomInputDevice, xmlFile); + string path = pathDefault; + if (!defaults && File.Exists(pathCustom)) + { + path = pathCustom; + } try { @@ -930,7 +933,7 @@ catch (Exception ex) { Log.Error(LOG_PREFIX + ex); - File.Delete(Config.GetFile(Config.Dir.CustomInputDevice, xmlFile)); + File.Delete(pathCustom); if ( !defaults ) { LoadMapping(xmlFile, true); } } } @@ -1089,7 +1092,7 @@ try #endif { - DirectoryInfo dir = Directory.CreateDirectory(Config.GetFolder(Config.Dir.CustomInputDevice)); + DirectoryInfo dir = Directory.CreateDirectory(InputHandler.CustomizedMappingsDirectory); } #if !DEBUG catch @@ -1100,7 +1103,8 @@ //try #endif { - XmlTextWriter writer = new XmlTextWriter(Config.GetFile(Config.Dir.CustomInputDevice, xmlFile), System.Text.Encoding.UTF8); + string pathCustom = Path.Combine(InputHandler.CustomizedMappingsDirectory, xmlFile); + XmlTextWriter writer = new XmlTextWriter(pathCustom, Encoding.UTF8); writer.Formatting = Formatting.Indented; writer.Indentation = 1; writer.IndentChar = (char)9; @@ -1880,8 +1884,9 @@ MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { - if (File.Exists(Config.GetFile(Config.Dir.CustomInputDevice, inputClassName + ".xml"))) - File.Delete(Config.GetFile(Config.Dir.CustomInputDevice, inputClassName + ".xml")); + string pathCustom = Path.Combine(InputHandler.CustomizedMappingsDirectory, inputClassName); + if (File.Exists(pathCustom)) + File.Delete(pathCustom); InitializeTreeMapping(inputClassName); } } @@ -2210,7 +2215,7 @@ { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "xml-file (*.xml)|*.xml"; - dlg.InitialDirectory = Config.GetFolder(Config.Dir.Base) + "\\InputDeviceMappings\\defaults\\KeyboardInputPlugin"; + dlg.InitialDirectory = Path.Combine(InputHandler.DefaultsDirectory, "KeyboardInputPlugin"); if (dlg.ShowDialog() == DialogResult.OK) { AddMapping(dlg.FileName); Modified: trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj =================================================================== --- trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj 2011-11-04 13:48:02 UTC (rev 4319) +++ trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj 2011-11-04 13:48:30 UTC (rev 4320) @@ -3,7 +3,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.21022</ProductVersion> + <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0E665FA4-1C44-4828-962E-6EC6F6D59F00}</ProjectGuid> <OutputType>Library</OutputType> @@ -48,6 +48,11 @@ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> + <Reference Include="Common.Utils, Version=1.1.6.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> + <Private>False</Private> + </Reference> <Reference Include="Core, Version=1.0.6.28732, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> Modified: trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj.user =================================================================== --- trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj.user 2011-11-04 13:48:02 UTC (rev 4319) +++ trunk/plugins/KeyboardInputPlugin/Source/KeyboardInputPlugin/KeyboardInputPlugin.csproj.user 2011-11-04 13:48:30 UTC (rev 4320) @@ -1,5 +1,5 @@ -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> - <ReferencePath>D:\Development\MediaPortal\Releases\Release 1.1.0\mediaportal\xbmc\bin\Release\</ReferencePath> + <ReferencePath>C:\Program Files\Team MediaPortal\MediaPortal</ReferencePath> </PropertyGroup> </Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |