From: <che...@us...> - 2008-07-25 10:58:43
|
Revision: 1966 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1966&view=rev Author: chef_koch Date: 2008-07-25 10:58:38 +0000 (Fri, 25 Jul 2008) Log Message: ----------- fixed an exception when phoneBook was disabled Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs trunk/plugins/FritzBox/FritzBox.xmp Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2008-07-25 07:43:30 UTC (rev 1965) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2008-07-25 10:58:38 UTC (rev 1966) @@ -70,7 +70,7 @@ #region Variables - public const string _version = "0.3.1.0"; + public const string _version = "0.3.1.1"; public static int _lastVersion = 0; static bool _extensiveLogging = false; @@ -130,6 +130,8 @@ private void ReceiveThread() { + Log.Info("FRITZ!Box: ReceiveThread()"); + while (!stopThread) { System.Threading.Thread.Sleep(100); @@ -141,22 +143,24 @@ void FritzBox_ReceivedData(object sender, EventArgs e) { + Log.Info("FRITZ!Box: FritzBox_ReceivedData()"); + byte[] myReadBuffer = new byte[1024]; StringBuilder myCompleteMessage = new StringBuilder(); int numberOfBytesRead = 0; // Incoming message may be larger than the buffer size. - do + while (networkStream.DataAvailable) { numberOfBytesRead = networkStream.Read(myReadBuffer, 0, myReadBuffer.Length); myCompleteMessage.AppendFormat("{0}", Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead)); } - while (networkStream.DataAvailable); - if (_extensiveLogging) Log.Info("received data: {0}", myCompleteMessage.ToString()); + CallAction callAction = ParseAction(myCompleteMessage.ToString()); + if (callAction == null) return; if (_extensiveLogging) callAction.WriteToLog(); @@ -187,6 +191,8 @@ void OnCallAction(CallAction callAction) { + Log.Info("FRITZ!Box: OnCallAction()"); + if (!_showNotify) { Log.Info("External process is running. Notify is queued and will be shown later."); @@ -197,7 +203,8 @@ switch (callAction.type) { case CallAction.CallType.Incoming: - callAction.caller = phoneBook.GetCaller(callAction.caller); + if (_usePhonebook) + callAction.caller = phoneBook.GetCaller(callAction.caller); OnIncomingCall(callAction); break; case CallAction.CallType.Outgoing: @@ -222,6 +229,8 @@ void OnIncomingCall(CallAction callAction) { + Log.Info("FRITZ!Box: OnIncomingCall()"); + if (tempNotify != null) { Log.Info("yet another dialog is active. action is sent to queue."); @@ -269,11 +278,10 @@ private void LoadSettings() { + Log.Info("FRITZ!Box: LoadSettings()"); + char[] charSeparators = new char[] { ';' }; - if (_extensiveLogging) - Log.Info("FRITZ!Box: LoadSettings"); - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _lastVersion = xmlreader.GetValueAsInt("fritzbox", "lastVersion", 0); @@ -335,8 +343,7 @@ private void SaveSettings() { - if (_extensiveLogging) - Log.Info("FRITZ!Box: SaveSettings"); + Log.Info("FRITZ!Box: SaveSettings()"); using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { @@ -352,6 +359,9 @@ CallAction ParseAction(string dataStream) { + Log.Info("FRITZ!Box: ParseAction()"); + if (dataStream == null) return null; + // data-stream can be in following format: // incoming calls: DateTime;RING;ConnectionID;CallerID;MSN;??POTS??; // outgoing calls: DateTime;CALL;ConnectionID;??Nebenstelle??;MSN;CallerID;??POTS??; @@ -361,7 +371,7 @@ // DateTime format: // 12.12.06 12:12:12 // dd.MM.yy hh:mm:ss - + string[] strList = dataStream.Trim().Split(';'); CallAction callAction = new CallAction(); @@ -391,8 +401,9 @@ case "DISCONNECT": callAction.type = CallAction.CallType.ConnectionClosed; break; + default: + return null; } - return callAction; } @@ -546,6 +557,7 @@ /// </summary> public void Stop() { + Log.Info("FRITZ!Box Plugin {0} stopping.", _version); stopThread = true; ReceivedData -= new ReceivedDataEventHandler(FritzBox_ReceivedData); Modified: trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs 2008-07-25 07:43:30 UTC (rev 1965) +++ trunk/plugins/FritzBox/FritzBox/Properties/AssemblyInfo.cs 2008-07-25 10:58:38 UTC (rev 1966) @@ -29,5 +29,5 @@ // Buildnummer // Revision // -[assembly: AssemblyVersion("0.3.1.0")] -[assembly: AssemblyFileVersion("0.3.1.0")] +[assembly: AssemblyVersion(FritzBox.FritzBox._version)] +[assembly: AssemblyFileVersion(FritzBox.FritzBox._version)] Modified: trunk/plugins/FritzBox/FritzBox.xmp =================================================================== --- trunk/plugins/FritzBox/FritzBox.xmp 2008-07-25 07:43:30 UTC (rev 1965) +++ trunk/plugins/FritzBox/FritzBox.xmp 2008-07-25 10:58:38 UTC (rev 1966) @@ -8,7 +8,7 @@ <Source>FritzBox\gfx\Thumbs\YAC\_noImage.png</Source> <Id>04010</Id> <Option>OutputFileName=|DefaultFile=False|</Option> - <Guid>3ffa94ec-3feb-4a17-a810-172c92c8327d</Guid> + <Guid>d666735b-206e-48a9-be1c-95b38102d5fe</Guid> </File> <File> <FileName>_unknown.png</FileName> @@ -17,7 +17,7 @@ <Source>FritzBox\gfx\Thumbs\YAC\_unknown.png</Source> <Id>04010</Id> <Option /> - <Guid>eff8eaba-dd4a-41a5-b5b6-8d2a7f883ce4</Guid> + <Guid>2a655c5d-c556-47ba-8392-9dc0d3b438dd</Guid> </File> <File> <FileName>FritzBox.dll</FileName> @@ -26,7 +26,7 @@ <Source>FritzBox\bin\Release\FritzBox.dll</Source> <Id>01020</Id> <Option /> - <Guid>9e67d038-ac40-4084-9d43-51a541f5c092</Guid> + <Guid>259204ab-d64b-40d6-82cf-761972fa3fa2</Guid> </File> </FileList> <StringList /> @@ -36,12 +36,12 @@ <SetupGroups /> <SetupGroupMappings /> <Option> - <BuildFileName>D:\mediaportal\mediaportal_plugins\FritzBox\FritzBox_v0.3.1.0.mpi</BuildFileName> + <BuildFileName>D:\mediaportal\mediaportal_plugins\FritzBox\FritzBox_v0.3.1.1.mpi</BuildFileName> <ProiectFileName>D:\mediaportal\mediaportal_plugins\FritzBox\FritzBox.xmp</ProiectFileName> <ProiectName>FritzBox CallMonitor</ProiectName> <Author>chefkoch @ Team MediaPortal</Author> <UpdateURL>http://mpi.team-mediaportal.com/downloads</UpdateURL> - <Version>0.3.1.0</Version> + <Version>0.3.1.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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |