From: <che...@us...> - 2009-12-05 17:33:26
|
Revision: 3206 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3206&view=rev Author: chef_koch Date: 2009-12-05 17:33:17 +0000 (Sat, 05 Dec 2009) Log Message: ----------- reworked the way pictures are loaded added build script Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/FritzBox.csproj trunk/plugins/FritzBox/FritzBox/FritzBoxConfig.cs trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs trunk/plugins/FritzBox/FritzBox.sln trunk/plugins/FritzBox/Tools/FritzBoxDebugger/FritzBoxDebugger.csproj Added Paths: ----------- trunk/plugins/FritzBox/Build/ trunk/plugins/FritzBox/Build/BUILD_FritzBoxPlugin.bat trunk/plugins/FritzBox/Build/filever.exe trunk/plugins/FritzBox/FritzBox/ContactImages/ trunk/plugins/FritzBox/FritzBox/ContactImages/FritzBox.CallMonitor.Missing.png trunk/plugins/FritzBox/FritzBox/ContactImages/FritzBox.CallMonitor.Unknown.png trunk/plugins/FritzBox/FritzBox/MpeRelease/ trunk/plugins/FritzBox/FritzBox/MpeRelease/FritzBox.xmp2 trunk/plugins/FritzBox/FritzBox/Settings.cs Removed Paths: ------------- trunk/plugins/FritzBox/FritzBox/gfx/Thumbs/ trunk/plugins/FritzBox/FritzBox.xmp Property Changed: ---------------- trunk/plugins/FritzBox/FritzBox/ Added: trunk/plugins/FritzBox/Build/BUILD_FritzBoxPlugin.bat =================================================================== --- trunk/plugins/FritzBox/Build/BUILD_FritzBoxPlugin.bat (rev 0) +++ trunk/plugins/FritzBox/Build/BUILD_FritzBoxPlugin.bat 2009-12-05 17:33:17 UTC (rev 3206) @@ -0,0 +1,49 @@ +@ECHO OFF + + +REM Select program path based on current machine environment +set ProgramDir=%ProgramFiles% +if not "%ProgramFiles(x86)%".=="". set ProgramDir=%ProgramFiles(x86)% + + +REM set logfile where the infos are written to, and clear that file +set LOG=build_%BUILD_TYPE%.log +echo. > %LOG% + + +echo. +echo -= FritzBox CallMonitor =- +echo -========================- +echo. + + +echo. +echo Writing SVN revision assemblies... +"..\..\IR Server Suite\setup\DeployVersionSVN.exe" /svn=".." >> %LOG% + + +echo. +echo Building IR Server Suite... +"%WINDIR%\Microsoft.NET\Framework\v3.5\MSBUILD.exe" /target:Rebuild /property:Configuration=%BUILD_TYPE%;Platform=x86;AllowUnsafeBlocks=true "..\FritzBox.sln" >> %LOG% + + +echo. +echo Reverting assemblies... +"..\..\IR Server Suite\setup\DeployVersionSVN.exe" /svn=".." /revert >> %LOG% + + +echo. +echo Reading the version number... +set plugindll=..\FritzBox\bin\Release\FritzBox.dll +if not exist "%plugindll%" goto version_error +for /f "Tokens=5" %%a in ('filever "%plugindll%"') do set version=%%a +goto :version_done +:version_error +echo "fritzbox.dll not found. version could not be read" >> %LOG% +goto :EOF +:version_done + + +echo Building MpeExtension package... +"%ProgramDir%\Team MediaPortal\MediaPortal\MpeMaker.exe" "..\FritzBox\MpeRelease\FritzBox.xmp2" /B >> %LOG% + Added: trunk/plugins/FritzBox/Build/filever.exe =================================================================== (Binary files differ) Property changes on: trunk/plugins/FritzBox/Build/filever.exe ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/plugins/FritzBox/FritzBox ___________________________________________________________________ Modified: svn:ignore - *.bak *.cache *.exe *.log *.mpe1 *.patch *.suo *.user _ReSharper.* thumbs.db bin obj _* + *.bak *.cache *.exe *.log *.mpe1 *.patch *.suo *.user _ReSharper.* thumbs.db bin obj _* [Bb]in [Dd]ebug [Rr]elease *.aps *.eto Copied: trunk/plugins/FritzBox/FritzBox/ContactImages/FritzBox.CallMonitor.Missing.png (from rev 3205, trunk/plugins/FritzBox/FritzBox/gfx/Thumbs/YAC/_noImage.png) =================================================================== (Binary files differ) Copied: trunk/plugins/FritzBox/FritzBox/ContactImages/FritzBox.CallMonitor.Unknown.png (from rev 3205, trunk/plugins/FritzBox/FritzBox/gfx/Thumbs/YAC/_unknown.png) =================================================================== (Binary files differ) Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2009-12-05 17:33:17 UTC (rev 3206) @@ -24,6 +24,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Reflection; using MediaPortal.Configuration; using MediaPortal.Dialogs; using MediaPortal.GUI.Library; @@ -35,10 +36,16 @@ [PluginIcons("FritzBox.FritzBox.png", "FritzBox.FritzBoxDisabled.png")] public class FritzBox : ISetupForm, IPlugin { + #region Constants + + private static string ContactPicturesFolder = Config.GetSubFolder(Config.Dir.Thumbs, "FritzBox.Contacts"); + + private static string SkinMediaFolder = Path.Combine(GUIGraphicsContext.Skin, "Media"); + + #endregion + #region Variables - public const string VERSION = "0.3.3.2"; - private readonly List<CallAction> _actionList = new List<CallAction>(); private object _tempNotify = null; @@ -49,6 +56,54 @@ #endregion + #region Properties + + public string UnknownCallerImage + { + get + { + string filePath; + + // check if skin supports it's own images + filePath = Utils.GetCoverArt(SkinMediaFolder, "FritzBox.CallMonitor.Unknown"); + if (!String.IsNullOrEmpty(filePath)) return filePath; + + // use new default image + filePath = Utils.GetCoverArt(ContactPicturesFolder, "FritzBox.CallMonitor.Unknown"); + if (!String.IsNullOrEmpty(filePath)) return filePath; + + // use old default image + filePath = Utils.GetCoverArt(Thumbs.Yac, "_unknown"); + if (!String.IsNullOrEmpty(filePath)) return filePath; + + return String.Empty; + } + } + + public string MissingCallerImage + { + get + { + string filePath; + + // check if skin supports it's own images + filePath = Utils.GetCoverArt(SkinMediaFolder, "FritzBox.CallMonitor.Missing"); + if (!String.IsNullOrEmpty(filePath)) return filePath; + + // use new default image + filePath = Utils.GetCoverArt(ContactPicturesFolder, "FritzBox.CallMonitor.Missing"); + if (!String.IsNullOrEmpty(filePath)) return filePath; + + // use old default image + filePath = Utils.GetCoverArt(Thumbs.Yac, "_noImage"); + if (!String.IsNullOrEmpty(filePath)) return filePath; + + return String.Empty; + } + } + + #endregion + #region Private Functions/Methods private void OnStartExternal(Process proc, bool waitForExit) @@ -184,18 +239,35 @@ #region Helper Methods + private string GetCallerImage(string callerId) + { + // search image for caller + if (Settings.ExtensiveLogging) + Log.Info("searching image for callerId: " + callerId); + + string filePath; + + // use new image path + filePath = Utils.GetCoverArt(ContactPicturesFolder, callerId); + if (!String.IsNullOrEmpty(filePath)) return filePath; + Log.Info("found image not in: " + ContactPicturesFolder); + + // use old image path + filePath = Utils.GetCoverArt(Thumbs.Yac, callerId); + if (!String.IsNullOrEmpty(filePath)) return filePath; + Log.Info("found image not in: " + Thumbs.Yac); + + return String.Empty; + } + private string GetCallerImage(Caller caller) { if (caller.ID == "") - return Utils.GetCoverArt(Thumbs.Yac, "_unknown"); + return UnknownCallerImage; else { - string strImage = Utils.GetCoverArtName(Thumbs.Yac, caller.Name); + string strImage = GetCallerImage(caller.Name); - // search image for caller - if (Settings.ExtensiveLogging) - Log.Info("searching image: " + strImage); - if (File.Exists(strImage)) { if (Settings.ExtensiveLogging) @@ -208,7 +280,7 @@ else { Log.Info("found NO image for caller"); - return Utils.GetCoverArt(Thumbs.Yac, "_noImage"); + return MissingCallerImage; } } } @@ -292,7 +364,7 @@ /// </summary> public void Start() { - Log.Info("FRITZ!Box Plugin {0} starting.", VERSION); + Log.Info("FRITZ!Box Plugin {0} starting.", Assembly.GetExecutingAssembly().GetName().Version); Settings.Load(); Utils.OnStartExternal += new Utils.UtilEventHandler(OnStartExternal); @@ -308,7 +380,7 @@ /// </summary> public void Stop() { - Log.Info("FRITZ!Box Plugin {0} stopping.", VERSION); + Log.Info("FRITZ!Box Plugin {0} stopping.", Assembly.GetExecutingAssembly().GetName().Version); FritzBoxClient.StopClient(); FritzBoxClient.CallEvent -= new FritzBoxClient.CallEventHandler(OnCallAction); Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.csproj =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2009-12-05 17:33:17 UTC (rev 3206) @@ -90,6 +90,15 @@ <EmbeddedResource Include="FritzBox.png" /> <EmbeddedResource Include="FritzBoxDisabled.png" /> </ItemGroup> + <ItemGroup> + <Content Include="gfx\FritzBox.ico" /> + <Content Include="gfx\FritzBoxIconMadeByHarley.png" /> + <Content Include="ContactImages\FritzBox.CallMonitor.Missing.png" /> + <Content Include="ContactImages\FritzBox.CallMonitor.Unknown.png" /> + </ItemGroup> + <ItemGroup> + <None Include="MpeRelease\FritzBox.xmp2" /> + </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/FritzBox/FritzBox/FritzBoxConfig.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxConfig.cs 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxConfig.cs 2009-12-05 17:33:17 UTC (rev 3206) @@ -22,6 +22,7 @@ using System; using System.IO; +using System.Reflection; using System.Windows.Forms; using MediaPortal.Util; @@ -41,7 +42,7 @@ private void LoadSettings() { - labelVersion.Text = "v" + FritzBox.VERSION; + labelVersion.Text = "v" + Assembly.GetExecutingAssembly().GetName().Version; Settings.Load(); Copied: trunk/plugins/FritzBox/FritzBox/MpeRelease/FritzBox.xmp2 (from rev 3204, trunk/plugins/FritzBox/FritzBox.xmp) =================================================================== --- trunk/plugins/FritzBox/FritzBox/MpeRelease/FritzBox.xmp2 (rev 0) +++ trunk/plugins/FritzBox/FritzBox/MpeRelease/FritzBox.xmp2 2009-12-05 17:33:17 UTC (rev 3206) @@ -0,0 +1,226 @@ +<?xml version="1.0" encoding="utf-8"?> +<PackageClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <Version>2.0</Version> + <Groups> + <Items> + <GroupItem Name="Default"> + <ParentGroup /> + <DisplayName>Default</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>Default</Description> + <Files> + <Items> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\bin\Release\FritzBox.dll</LocalFileName> + <ZipFileName>Installer{CopyFile}\{b3856e80-31e2-4738-a5e0-f1c34511d43a}-FritzBox.dll</ZipFileName> + <DestinationFilename>%Plugins%\process\FritzBox.dll</DestinationFilename> + </FileItem> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\ContactImages\FritzBox.CallMonitor.Missing.png</LocalFileName> + <ZipFileName>Installer{CopyFile}\{238daa99-19ae-4dcf-8627-c7a87d165129}-FritzBox.CallMonitor.Missing.png</ZipFileName> + <DestinationFilename>%Thumbs%\FritzBox.Contacts\FritzBox.CallMonitor.Missing.png</DestinationFilename> + </FileItem> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\ContactImages\FritzBox.CallMonitor.Unknown.png</LocalFileName> + <ZipFileName>Installer{CopyFile}\{b1765277-c9f5-4ead-aca4-ebda7b216bd7}-FritzBox.CallMonitor.Unknown.png</ZipFileName> + <DestinationFilename>%Thumbs%\FritzBox.Contacts\FritzBox.CallMonitor.Unknown.png</DestinationFilename> + </FileItem> + </Items> + </Files> + </GroupItem> + </Items> + </Groups> + <Sections> + <Items> + <SectionItem Guid="fea723fd-26bf-4b6b-9991-1b648c22705a" Name="Welcome Screen" ConditionGroup=""> + <Params> + <Items> + <SectionParam Name="Header text"> + <Value>Welcome to the Extension Installer for [Name]</Value> + <ValueType>String</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Description"> + <Value>This will install [Name] version [Version] on your computer. +It is recommended that you close all other applications before continuing. +Click Next to continue or Cancel to exit Setup.</Value> + <ValueType>String</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Left part image"> + <Value /> + <ValueType>File</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Header image"> + <Value /> + <ValueType>File</ValueType> + <Description>Image in upper right part</Description> + </SectionParam> + </Items> + </Params> + <Actions> + <Items /> + </Actions> + <IncludedGroups /> + <PanelName>Welcome Screen</PanelName> + <WizardButtonsEnum>NextCancel</WizardButtonsEnum> + </SectionItem> + <SectionItem Guid="c0b65164-25e4-4a35-a15f-2397c5518058" Name="Install Section" ConditionGroup=""> + <Params> + <Items> + <SectionParam Name="Header Title"> + <Value /> + <ValueType>String</ValueType> + <Description>Header title</Description> + </SectionParam> + <SectionParam Name="Header description"> + <Value /> + <ValueType>String</ValueType> + <Description>Description of section, shown in under section title</Description> + </SectionParam> + <SectionParam Name="Header image"> + <Value /> + <ValueType>File</ValueType> + <Description>Image in upper right part</Description> + </SectionParam> + </Items> + </Params> + <Actions> + <Items> + <ActionItem Name="InstallFiles" ActionType="InstallFiles" ConditionGroup=""> + <Params> + <Items /> + </Params> + <ExecuteLocation>AfterPanelShow</ExecuteLocation> + </ActionItem> + </Items> + </Actions> + <IncludedGroups /> + <PanelName>Install Section</PanelName> + <WizardButtonsEnum>Next</WizardButtonsEnum> + </SectionItem> + <SectionItem Guid="a69ff23b-0fd9-4180-9384-b8b875cea005" Name="Setup Complete" ConditionGroup=""> + <Params> + <Items> + <SectionParam Name="Header text"> + <Value>The Extension Installer Wizard has successfully installed [Name].</Value> + <ValueType>String</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Left part image"> + <Value /> + <ValueType>File</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Header image"> + <Value /> + <ValueType>File</ValueType> + <Description>Image in upper right part</Description> + </SectionParam> + </Items> + </Params> + <Actions> + <Items /> + </Actions> + <IncludedGroups /> + <PanelName>Setup Complete</PanelName> + <WizardButtonsEnum>Finish</WizardButtonsEnum> + </SectionItem> + </Items> + </Sections> + <Dependencies> + <Items /> + </Dependencies> + <GeneralInfo> + <Name>FRITZ!Box CallMonitor</Name> + <Id>175eeceb-e965-4e9b-a26e-0956e3bd94fa</Id> + <Author>chefkoch @ Team MediaPortal</Author> + <HomePage>http://wiki.team-mediaportal.com/Extensions-Plugins/FritzBoxCallMonitor</HomePage> + <ForumPage>http://forum.team-mediaportal.com/FRITZ!Box_CallMonitor-t5165.html</ForumPage> + <UpdateUrl /> + <Version> + <Major>0</Major> + <Minor>3</Minor> + <Build>3</Build> + <Revision>3</Revision> + </Version> + <ExtensionDescription>The FRITZ!Box plugin is a process plugin, which is able to notify you within MediaPortal on an incomming call on your FRITZ!Box. + +All strings are multi language. + +You will be informed with a small notify. It is possible to stop media playback automatically or to resume if you close the notify. You can specify your MSNs now, for which the notify should be shown. That avoids showing the notify when you get a fax. + +In the plugin is a small phonebook integrated, so you can define your own name/text for a specifc caller. You can blacklist each entry, then no notify will be shown if he calls you. If someone calls you who is not already in the phonebook, it is possible to add it automatically. + +The plugin supports pictures for each caller. You can place a picture in "ThumbsYAC"-directory which is in jpg, png or bmp format. The filename have to be the specified name NOT the callerid. </ExtensionDescription> + <VersionDescription>First release supporting mp1e extension format</VersionDescription> + <DevelopmentStatus>Stable</DevelopmentStatus> + <OnlineLocation /> + <ReleaseDate>2009-12-05T14:19:38.5618746+01:00</ReleaseDate> + <Tags>input, phone, calls</Tags> + <Location>D:\MediaPortal\mp-plugins\trunk\plugins\FritzBox\FritzBox\MpeRelease\FritzBox.mpe1</Location> + <Params> + <Items> + <SectionParam Name="Icon"> + <Value>..\FritzBox.png</Value> + <ValueType>File</ValueType> + <Description>The icon file of the package (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Online Icon"> + <Value /> + <ValueType>String</ValueType> + <Description>The icon file of the package stored online (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Configuration file"> + <Value /> + <ValueType>Template</ValueType> + <Description>The file used to configure the extension. + If have .exe extension the will be executed + If have .dll extension used like MP plugin configuration</Description> + </SectionParam> + </Items> + </Params> + </GeneralInfo> + <UniqueFileList> + <Items> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\bin\Release\FritzBox.dll</LocalFileName> + <ZipFileName>Installer{CopyFile}\{b3856e80-31e2-4738-a5e0-f1c34511d43a}-FritzBox.dll</ZipFileName> + <DestinationFilename>%Plugins%\process\FritzBox.dll</DestinationFilename> + </FileItem> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\ContactImages\FritzBox.CallMonitor.Missing.png</LocalFileName> + <ZipFileName>Installer{CopyFile}\{238daa99-19ae-4dcf-8627-c7a87d165129}-FritzBox.CallMonitor.Missing.png</ZipFileName> + <DestinationFilename>%Thumbs%\FritzBox.Contacts\FritzBox.CallMonitor.Missing.png</DestinationFilename> + </FileItem> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\ContactImages\FritzBox.CallMonitor.Unknown.png</LocalFileName> + <ZipFileName>Installer{CopyFile}\{b1765277-c9f5-4ead-aca4-ebda7b216bd7}-FritzBox.CallMonitor.Unknown.png</ZipFileName> + <DestinationFilename>%Thumbs%\FritzBox.Contacts\FritzBox.CallMonitor.Unknown.png</DestinationFilename> + </FileItem> + <FileItem InstallType="CopyFile" SystemFile="true" Modified="true"> + <Param1 /> + <UpdateOption>OverwriteIfOlder</UpdateOption> + <LocalFileName>..\FritzBox.png</LocalFileName> + <ZipFileName>Installer{CopyFile}\{4b27b176-89e5-4fda-a476-c8d78749c428}-FritzBox.png</ZipFileName> + <DestinationFilename /> + </FileItem> + </Items> + </UniqueFileList> + <ProjectSettings> + <FolderGroups /> + </ProjectSettings> +</PackageClass> \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs 2009-12-05 17:33:17 UTC (rev 3206) @@ -28,7 +28,7 @@ // associated with an assembly. [assembly: AssemblyTitle("FRITZ!Box CallMonitor")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Displays FRITZ!Box calling information.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("chefkoch @ Team MediaPortal")] [assembly: AssemblyProduct("FRITZ!Box CallMonitor")] @@ -56,5 +56,5 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion(FritzBox.FritzBox.VERSION)] -[assembly: AssemblyFileVersion(FritzBox.FritzBox.VERSION)] \ No newline at end of file +[assembly: AssemblyVersion("0.3.4.0")] +[assembly: AssemblyFileVersion("0.3.4.0")] \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs 2009-12-05 17:33:17 UTC (rev 3206) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:2.0.50727.1433 +// Laufzeitversion:2.0.50727.4927 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. Added: trunk/plugins/FritzBox/FritzBox/Settings.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/Settings.cs (rev 0) +++ trunk/plugins/FritzBox/FritzBox/Settings.cs 2009-12-05 17:33:17 UTC (rev 3206) @@ -0,0 +1,175 @@ +#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 System; +using System.Collections.Generic; +using System.Reflection; +using MediaPortal.Configuration; +using MediaPortal.ServiceImplementations; + +namespace FritzBox +{ + internal static class Settings + { + #region Properties + + private const string PLUGIN_NAME = "FRITZ!Box"; + + public static bool ExtensiveLogging { get; set; } + + /// <summary> + /// stop media when an event happend + /// </summary> + public static bool StopMedia { get; set; } + + /// <summary> + /// resume media when notify is closed + /// </summary> + public static bool ResumeMedia { get; set; } + + public static int MaxNotifies { get; set; } + + /// <summary> + /// autoclose the dialog after the timeout expired + /// </summary> + public static int NotifyTimeout { get; set; } + + public static bool CloseOnTimeout { get; set; } + + public static bool CloseOnConnectionClosed { get; set; } + + public static bool ShowMsnOnHeading { get; set; } + + public static bool FilterMSN { get; set; } + + public static List<String> MSNList + { + get + { + if (_msnList == null) + _msnList = new List<String>(); + + return _msnList; + } + set { _msnList = value; } + } + + private static List<String> _msnList; + + static Settings() + { + StopMedia = true; + ResumeMedia = true; + MaxNotifies = 20; + NotifyTimeout = 10; + } + + #endregion + + public static void Load() + { + Log.Info("FRITZ!Box: Settings.Load()"); + + PhoneBook.LoadSettings(); + + using ( + MediaPortal.Profile.Settings xmlreader = + new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + ExtensiveLogging = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); + + FritzBoxClient.Address = xmlreader.GetValueAsString("fritzbox", "address", "fritz.box"); + FritzBoxClient.Port = xmlreader.GetValueAsInt("fritzbox", "port", 1012); + + // notify settings + MaxNotifies = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); + CloseOnTimeout = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); + NotifyTimeout = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); + CloseOnConnectionClosed = xmlreader.GetValueAsBool("fritzbox", "closeOnConnectionClosed", true); + + //if ((!CloseOnTimeout) || (NotifyTimeout == 0)) + // NotifyTimeout = -1; + + FilterMSN = xmlreader.GetValueAsBool("fritzbox", "filterMSNs", false); + string strMSN = xmlreader.GetValueAsString("fritzbox", "MSN", ""); + char[] charSeparators = new char[] {';'}; + MSNList.AddRange(strMSN.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries)); + + ShowMsnOnHeading = xmlreader.GetValueAsBool("fritzbox", "showMsnOnHeading", false); + + // media settings + StopMedia = xmlreader.GetValueAsBool("fritzbox", "stopMedia", true); + ResumeMedia = xmlreader.GetValueAsBool("fritzbox", "resumeMedia", true); + } + + WriteToLog(); + } + + public static void Save() + { + Log.Info("FRITZ!Box: Settings.Save()"); + + using ( + MediaPortal.Profile.Settings xmlwriter = + new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValueAsBool("fritzbox", "extensiveLogging", ExtensiveLogging); + + xmlwriter.SetValue("fritzbox", "address", FritzBoxClient.Address); + xmlwriter.SetValue("fritzbox", "port", FritzBoxClient.Port); + + // notify settings + xmlwriter.SetValue("fritzbox", "maxNotifies", MaxNotifies); + xmlwriter.SetValueAsBool("fritzbox", "closeOnTimeout", CloseOnTimeout); + xmlwriter.SetValue("fritzbox", "timeout", NotifyTimeout); + xmlwriter.SetValueAsBool("fritzbox", "closeOnConnectionClosed", CloseOnConnectionClosed); + + xmlwriter.SetValueAsBool("fritzbox", "filterMSNs", FilterMSN); + string strMSN = ""; + foreach (string msn in MSNList) + { + strMSN += msn + ";"; + } + xmlwriter.SetValue("fritzbox", "MSN", strMSN); + + xmlwriter.SetValueAsBool("fritzbox", "showMsnOnHeading", ShowMsnOnHeading); + + // media settings + xmlwriter.SetValueAsBool("fritzbox", "stopMedia", StopMedia); + xmlwriter.SetValueAsBool("fritzbox", "resumeMedia", ResumeMedia); + } + + PhoneBook.SaveSettings(); + } + + public static void WriteToLog() + { + // get all properties + PropertyInfo[] propertyInfos = typeof (Settings).GetProperties(); + // write property names and values + foreach (PropertyInfo propertyInfo in propertyInfos) + { + Log.Info("{0}: {1} = {2}", PLUGIN_NAME, propertyInfo.Name, propertyInfo.GetValue(null, null).ToString()); + } + } + } +} \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox.sln =================================================================== --- trunk/plugins/FritzBox/FritzBox.sln 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox.sln 2009-12-05 17:33:17 UTC (rev 3206) @@ -17,12 +17,10 @@ GlobalSection(ProjectConfigurationPlatforms) = postSolution {7A458560-A537-429E-A016-1A4513CB586F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7A458560-A537-429E-A016-1A4513CB586F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A458560-A537-429E-A016-1A4513CB586F}.Debug|x86.ActiveCfg = Debug|x86 - {7A458560-A537-429E-A016-1A4513CB586F}.Debug|x86.Build.0 = Debug|x86 + {7A458560-A537-429E-A016-1A4513CB586F}.Debug|x86.ActiveCfg = Debug|Any CPU {7A458560-A537-429E-A016-1A4513CB586F}.Release|Any CPU.ActiveCfg = Release|Any CPU {7A458560-A537-429E-A016-1A4513CB586F}.Release|Any CPU.Build.0 = Release|Any CPU - {7A458560-A537-429E-A016-1A4513CB586F}.Release|x86.ActiveCfg = Release|x86 - {7A458560-A537-429E-A016-1A4513CB586F}.Release|x86.Build.0 = Release|x86 + {7A458560-A537-429E-A016-1A4513CB586F}.Release|x86.ActiveCfg = Release|Any CPU {5D751473-DCC5-4044-A6E3-403D97C5B9F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5D751473-DCC5-4044-A6E3-403D97C5B9F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {5D751473-DCC5-4044-A6E3-403D97C5B9F9}.Debug|x86.ActiveCfg = Debug|Any CPU Deleted: trunk/plugins/FritzBox/FritzBox.xmp =================================================================== --- trunk/plugins/FritzBox/FritzBox.xmp 2009-12-05 15:12:22 UTC (rev 3205) +++ trunk/plugins/FritzBox/FritzBox.xmp 2009-12-05 17:33:17 UTC (rev 3206) @@ -1,72 +0,0 @@ -<MPinstaler> - <ver>1.00.000</ver> - <FileList> - <File> - <FileName>_noImage.png</FileName> - <Type>Thumbs</Type> - <SubType>YAC</SubType> - <Source>FritzBox\gfx\Thumbs\YAC\_noImage.png</Source> - <Id>04010</Id> - <Option /> - <Guid>b572e856-14e4-4f14-843b-5dd085b37daf</Guid> - </File> - <File> - <FileName>_unknown.png</FileName> - <Type>Thumbs</Type> - <SubType>YAC</SubType> - <Source>FritzBox\gfx\Thumbs\YAC\_unknown.png</Source> - <Id>04010</Id> - <Option /> - <Guid>42e38b37-e056-4f15-86e2-9f119c0064ae</Guid> - </File> - <File> - <FileName>FritzBox.dll</FileName> - <Type>Plugin</Type> - <SubType>Process</SubType> - <Source>FritzBox\bin\Release\FritzBox.dll</Source> - <Id>01020</Id> - <Option /> - <Guid>de6ec925-acda-4337-bb1d-71fb08154ea9</Guid> - </File> - </FileList> - <StringList /> - <Actions> - <Action Place="POSTSETUP" Id="1" Command="FritzBox.dll" /> - </Actions> - <SetupGroups /> - <SetupGroupMappings /> - <Option> - <BuildFileName>G:\MediaPortal\mp-plugins\trunk\plugins\FritzBox\FritzBox.mpe1</BuildFileName> - <ProiectFileName>G:\MediaPortal\mp-plugins\trunk\plugins\FritzBox\FritzBox.xmp</ProiectFileName> - <ProiectName>FRITZ!Box CallMonitor</ProiectName> - <Author>chefkoch @ Team MediaPortal</Author> - <UpdateURL>http://www.team-mediaportal.com/files/Download/MediaPortalInstaller(MPI)/Input/FRITZ!BoxCallMonitor/</UpdateURL> - <Version>0.3.3.1</Version> - <Description>The FRITZ!Box plugin is a process plugin, which is able to notify you within MediaPortal on an incomming call on your FRITZ!Box. - -All strings are multi language. - -You will be informed with a small notify. It is possible to stop media playback automatically or to resume if you close the notify. You can specify your MSNs now, for which the notify should be shown. That avoids showing the notify when you get a fax. - -In the plugin is a small phonebook integrated, so you can define your own name/text for a specifc caller. You can blacklist each entry, then no notify will be shown if he calls you. If someone calls you who is not already in the phonebook, it is possible to add it automatically. - -The plugin supports pictures for each caller. You can place a picture in "ThumbsYAC"-directory which is in jpg, png or bmp format. The filename have to be the specified name NOT the callerid. </Description> - <Group>Input</Group> - <Release>Stable </Release> - <Script /> @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |