From: <che...@us...> - 2010-12-17 16:59:20
|
Revision: 4042 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4042&view=rev Author: chef_koch Date: 2010-12-17 16:59:14 +0000 (Fri, 17 Dec 2010) Log Message: ----------- made irss compatible with latest svn, should also be compatible with older MediaPortal releases Modified Paths: -------------- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MPUtils/MPCommon.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandHibernate.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandStandBy.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/MediaPortalCommands.csproj trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs Removed Paths: ------------- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/Common.cs Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MPUtils/MPCommon.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MPUtils/MPCommon.cs 2010-12-17 08:46:22 UTC (rev 4041) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MPUtils/MPCommon.cs 2010-12-17 16:59:14 UTC (rev 4042) @@ -42,12 +42,12 @@ /// <summary> /// Folder for Input Device data default files. /// </summary> - public static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault); + public static readonly string CustomInputDefault = Config.GetSubFolder(Config.Dir.Base, @"Defaults\InputDeviceMappings"); /// <summary> /// Folder for Custom Input Device data files. /// </summary> - public static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice); + public static readonly string CustomInputDevice = Config.GetSubFolder(Config.Dir.Config, @"InputDeviceMappings"); /// <summary> /// Path to the MediaPortal configuration file. Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandHibernate.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandHibernate.cs 2010-12-17 08:46:22 UTC (rev 4041) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandHibernate.cs 2010-12-17 16:59:14 UTC (rev 4042) @@ -24,6 +24,7 @@ using MediaPortal.Player; using MediaPortal.Profile; using MediaPortal.Util; +using MPUtils; namespace Commands.MediaPortal { @@ -79,7 +80,7 @@ public override void Execute(VariableList variables) { bool mpBasicHome = false; - using (Settings xmlreader = new Settings(Common.MPConfigFile)) + using (Settings xmlreader = new Settings(MPCommon.MPConfigFile)) mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false); GUIGraphicsContext.ResetLastActivity(); Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandStandBy.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandStandBy.cs 2010-12-17 08:46:22 UTC (rev 4041) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/CommandStandBy.cs 2010-12-17 16:59:14 UTC (rev 4042) @@ -24,6 +24,7 @@ using MediaPortal.Player; using MediaPortal.Profile; using MediaPortal.Util; +using MPUtils; namespace Commands.MediaPortal { @@ -79,7 +80,7 @@ public override void Execute(VariableList variables) { bool mpBasicHome = false; - using (Settings xmlreader = new Settings(Common.MPConfigFile)) + using (Settings xmlreader = new Settings(MPCommon.MPConfigFile)) mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false); GUIGraphicsContext.ResetLastActivity(); Deleted: trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/Common.cs 2010-12-17 08:46:22 UTC (rev 4041) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/Common.cs 2010-12-17 16:59:14 UTC (rev 4042) @@ -1,44 +0,0 @@ -#region Copyright (C) 2005-2009 Team MediaPortal - -// Copyright (C) 2005-2009 Team MediaPortal -// http://www.team-mediaportal.com -// -// This Program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2, or (at your option) -// any later version. -// -// This Program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with GNU Make; see the file COPYING. If not, write to -// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -// http://www.gnu.org/copyleft/gpl.html - -#endregion - -using MediaPortal.Configuration; - -namespace Commands.MediaPortal -{ - internal static class Common - { - /// <summary> - /// Folder for Input Device data default files. - /// </summary> - public static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault) + "\\"; - - /// <summary> - /// Folder for Custom Input Device data files. - /// </summary> - public static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice) + "\\"; - - /// <summary> - /// Path to the MediaPortal configuration file. - /// </summary> - public static readonly string MPConfigFile = Config.GetFolder(Config.Dir.Config) + "\\MediaPortal.xml"; - } -} \ No newline at end of file Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/MediaPortalCommands.csproj =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/MediaPortalCommands.csproj 2010-12-17 08:46:22 UTC (rev 4041) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/Common/MediaPortalCommands/MediaPortalCommands.csproj 2010-12-17 16:59:14 UTC (rev 4042) @@ -72,7 +72,6 @@ <Compile Include="CommandReboot.cs" /> <Compile Include="CommandShutdown.cs" /> <Compile Include="CommandHibernate.cs" /> - <Compile Include="Common.cs" /> <Compile Include="CommandStandBy.cs" /> <Compile Include="CommandSendAction.cs" /> <Compile Include="CommandSendMessage.cs" /> @@ -146,6 +145,10 @@ <Project>{CA15769C-232E-4CA7-94FD-206A06CA3ABB}</Project> <Name>IrssUtils</Name> </ProjectReference> + <ProjectReference Include="..\MPUtils\MPUtils.csproj"> + <Project>{08F57DD7-2C6E-484E-9CC5-835F70C5BC64}</Project> + <Name>MPUtils</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. Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs 2010-12-17 08:46:22 UTC (rev 4041) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs 2010-12-17 16:59:14 UTC (rev 4042) @@ -178,6 +178,9 @@ private void LoadMapping(string xmlFile, bool defaults) { + string pathDefault = Path.Combine(MPUtils.MPCommon.CustomInputDefault, xmlFile); + string pathCustom = Path.Combine(MPUtils.MPCommon.CustomInputDevice, xmlFile); + try { groupBoxLayer.Enabled = false; @@ -185,9 +188,9 @@ groupBoxAction.Enabled = false; treeMapping.Nodes.Clear(); XmlDocument doc = new XmlDocument(); - 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; if (!File.Exists(path)) { MessageBox.Show( @@ -376,26 +379,29 @@ catch (Exception ex) { Log.Error(ex); - File.Delete(Config.GetFile(Config.Dir.CustomInputDevice, xmlFile)); + File.Delete(pathCustom); LoadMapping(xmlFile, true); } } private bool SaveMapping(string xmlFile) { + string customDir = MPUtils.MPCommon.CustomInputDevice; + string pathCustom = Path.Combine(customDir, xmlFile); + try { - Directory.CreateDirectory(Config.GetFolder(Config.Dir.CustomInputDevice)); + Directory.CreateDirectory(customDir); } catch { - Log.Info("MAP: Error accessing directory \"InputDeviceMappings\\custom\""); + Log.Info("MAP: Error accessing directory '{0}'", customDir); } try { using ( - XmlTextWriter writer = new XmlTextWriter(Config.GetFile(Config.Dir.CustomInputDevice, xmlFile), Encoding.UTF8) + XmlTextWriter writer = new XmlTextWriter(pathCustom, Encoding.UTF8) ) { writer.Formatting = Formatting.Indented; @@ -1249,7 +1255,7 @@ private void buttonDefault_Click(object sender, EventArgs e) { string fileName = _inputClassName + ".xml"; - string filePath = Config.GetFile(Config.Dir.CustomInputDevice, fileName); + string filePath = Path.Combine(MPUtils.MPCommon.CustomInputDevice, fileName); if (File.Exists(filePath)) File.Delete(filePath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |