From: <che...@us...> - 2007-06-21 23:40:12
|
Revision: 591 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=591&view=rev Author: chef_koch Date: 2007-06-21 16:40:06 -0700 (Thu, 21 Jun 2007) Log Message: ----------- added new folder no need for the png-file anymore, it's the same like FritzBox.png Added Paths: ----------- trunk/plugins/FritzBox/FritzBox/Resources/ Removed Paths: ------------- trunk/plugins/FritzBox/FritzBox/gfx/FritzBoxIconTransparent.png Deleted: trunk/plugins/FritzBox/FritzBox/gfx/FritzBoxIconTransparent.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-22 18:03:20
|
Revision: 598 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=598&view=rev Author: chef_koch Date: 2007-06-22 11:03:18 -0700 (Fri, 22 Jun 2007) Log Message: ----------- cleanup for Resources cleanup for setup, now use it's own designer.cs Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/FritzBox.csproj trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs trunk/plugins/FritzBox/FritzBox/Properties/Resources.resx Added Paths: ----------- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-22 17:42:35 UTC (rev 597) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-22 18:03:18 UTC (rev 598) @@ -51,8 +51,7 @@ * - add more comments to code * - split code more in methods/classes */ - - [PluginIcons("FritzBox.FritzBox.png", "FritzBox.FritzBoxDisabled.png")] + [PluginIcons("FritzBox.png", "FritzBoxDisabled.png")] public class FritzBox : ISetupForm, IPlugin { #region Variables @@ -687,7 +686,7 @@ public void ShowPlugin() { - Form setup = new FritzBoxSetupForm(); + Form setup = new FritzBoxSetupFrom(); setup.ShowDialog(); } Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.csproj =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2007-06-22 17:42:35 UTC (rev 597) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2007-06-22 18:03:18 UTC (rev 598) @@ -46,18 +46,37 @@ <ErrorReport>prompt</ErrorReport> </PropertyGroup> <ItemGroup> + <Reference Include="Core, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\mediaportal\xbmc\bin\Release\Core.dll</HintPath> + </Reference> + <Reference Include="Dialogs, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\mediaportal\xbmc\bin\Release\plugins\Windows\Dialogs.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\mediaportal\xbmc\bin\Release\Utils.dll</HintPath> + </Reference> + <Reference Include="WindowPlugins, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\mediaportal\xbmc\bin\Release\plugins\Windows\WindowPlugins.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="Caller.cs" /> - <Compile Include="FritzBox.cs" /> <Compile Include="FritzBoxSetupFrom.cs"> <SubType>Form</SubType> </Compile> + <Compile Include="FritzBoxSetupFrom.Designer.cs"> + <DependentUpon>FritzBoxSetupFrom.cs</DependentUpon> + </Compile> + <Compile Include="FritzBox.cs" /> <Compile Include="FritzBoxWatch.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> @@ -66,28 +85,6 @@ </Compile> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\mediaportal\Core\Core.csproj"> - <Project>{02FFFC1F-2555-4B99-8B01-3432D0673855}</Project> - <Name>Core</Name> - </ProjectReference> - <ProjectReference Include="..\..\mediaportal\Dialogs\Dialogs.csproj"> - <Project>{396C5208-5D46-4A11-92C1-FD0F2F42D7DD}</Project> - <Name>Dialogs</Name> - </ProjectReference> - <ProjectReference Include="..\..\mediaportal\Utils\Utils.csproj"> - <Project>{6DA0E4DF-6230-4642-98B5-E690BB6942BB}</Project> - <Name>Utils</Name> - </ProjectReference> - <ProjectReference Include="..\..\mediaportal\WindowPlugins\WindowPlugins.csproj"> - <Project>{B282C55B-A37B-4CEC-A4FC-00791069BF00}</Project> - <Name>WindowPlugins</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="FritzBoxSetupFrom.resx"> - <DependentUpon>FritzBoxSetupFrom.cs</DependentUpon> - <SubType>Designer</SubType> - </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <SubType>Designer</SubType> <Generator>ResXFileCodeGenerator</Generator> @@ -95,11 +92,20 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> + <EmbeddedResource Include="FritzBoxSetupFrom.resx"> + <SubType>Designer</SubType> + <DependentUpon>FritzBoxSetupFrom.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="FritzBoxDisabled.png" /> <EmbeddedResource Include="FritzBox.png" /> </ItemGroup> <ItemGroup> - <None Include="gfx\FritzBoxIconTransparent.png" /> + <Content Include="FritzBox.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="FritzBoxDisabled.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Added: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs (rev 0) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs 2007-06-22 18:03:18 UTC (rev 598) @@ -0,0 +1,699 @@ +namespace FritzBox +{ + partial class FritzBoxSetupFrom + { + /// <summary> + /// Erforderliche Designervariable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Verwendete Ressourcen bereinigen. + /// </summary> + /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// <summary> + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// </summary> + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FritzBoxSetupFrom)); + this.tabControlFritzBoxSettings = new MediaPortal.UserInterface.Controls.MPTabControl(); + this.tabGeneral = new System.Windows.Forms.TabPage(); + this.checkBoxExtensiveLogging = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.buttonTest = new MediaPortal.UserInterface.Controls.MPButton(); + this.textBoxPort = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.textBoxAddress = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.labelPort = new MediaPortal.UserInterface.Controls.MPLabel(); + this.labelAddress = new MediaPortal.UserInterface.Controls.MPLabel(); + this.labelHelp = new MediaPortal.UserInterface.Controls.MPLabel(); + this.tabIncoming = new System.Windows.Forms.TabPage(); + this.groupBoxPhonebook = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.mpImportFBMonitor = new MediaPortal.UserInterface.Controls.MPButton(); + this.checkBoxSaveUnknownCaller = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.checkBoxShowUnknownCaller = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.checkBoxUsePhonebook = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.groupBoxNotify = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.checkBoxShowMsnOnHeading = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.buttonMSNsRemove = new MediaPortal.UserInterface.Controls.MPButton(); + this.checkBoxFilterMSNs = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.buttonMSNsAdd = new MediaPortal.UserInterface.Controls.MPButton(); + this.comboBoxMSNs = new MediaPortal.UserInterface.Controls.MPComboBox(); + this.numericUpDownTimeout = new MediaPortal.UserInterface.Controls.MPNumericUpDown(); + this.checkBoxCloseOnTimout = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.groupBoxMedia = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.checkBoxResumeMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.checkBoxStopMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.tabPhonebook = new System.Windows.Forms.TabPage(); + this.pictureBoxCaller = new System.Windows.Forms.PictureBox(); + this.buttonCallerChange = new MediaPortal.UserInterface.Controls.MPButton(); + this.checkBoxCallerShow = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.textBoxCallerName = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.textBoxCallerId = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.buttonCallerRemove = new MediaPortal.UserInterface.Controls.MPButton(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.colCallerId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShow = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.labelCallerId = new MediaPortal.UserInterface.Controls.MPLabel(); + this.labelCallerName = new MediaPortal.UserInterface.Controls.MPLabel(); + this.labelVersion = new MediaPortal.UserInterface.Controls.MPLabel(); + this.buttonSave = new MediaPortal.UserInterface.Controls.MPButton(); + this.buttonCancel = new MediaPortal.UserInterface.Controls.MPButton(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.tabControlFritzBoxSettings.SuspendLayout(); + this.tabGeneral.SuspendLayout(); + this.mpGroupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.tabIncoming.SuspendLayout(); + this.groupBoxPhonebook.SuspendLayout(); + this.groupBoxNotify.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).BeginInit(); + this.groupBoxMedia.SuspendLayout(); + this.tabPhonebook.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // tabControlFritzBoxSettings + // + this.tabControlFritzBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControlFritzBoxSettings.Controls.Add(this.tabGeneral); + this.tabControlFritzBoxSettings.Controls.Add(this.tabIncoming); + this.tabControlFritzBoxSettings.Controls.Add(this.tabPhonebook); + this.tabControlFritzBoxSettings.Location = new System.Drawing.Point(11, 12); + this.tabControlFritzBoxSettings.Name = "tabControlFritzBoxSettings"; + this.tabControlFritzBoxSettings.SelectedIndex = 0; + this.tabControlFritzBoxSettings.Size = new System.Drawing.Size(531, 337); + this.tabControlFritzBoxSettings.TabIndex = 14; + // + // tabGeneral + // + this.tabGeneral.Controls.Add(this.checkBoxExtensiveLogging); + this.tabGeneral.Controls.Add(this.mpGroupBox1); + this.tabGeneral.Location = new System.Drawing.Point(4, 22); + this.tabGeneral.Name = "tabGeneral"; + this.tabGeneral.Padding = new System.Windows.Forms.Padding(3); + this.tabGeneral.Size = new System.Drawing.Size(523, 311); + this.tabGeneral.TabIndex = 0; + this.tabGeneral.Text = "General"; + this.tabGeneral.UseVisualStyleBackColor = true; + // + // checkBoxExtensiveLogging + // + this.checkBoxExtensiveLogging.AutoSize = true; + this.checkBoxExtensiveLogging.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxExtensiveLogging.Location = new System.Drawing.Point(6, 138); + this.checkBoxExtensiveLogging.Name = "checkBoxExtensiveLogging"; + this.checkBoxExtensiveLogging.Size = new System.Drawing.Size(339, 17); + this.checkBoxExtensiveLogging.TabIndex = 1; + this.checkBoxExtensiveLogging.Text = "extensive logging (!!! phonenumbers are written to the logfile !!!)"; + this.checkBoxExtensiveLogging.UseVisualStyleBackColor = true; + // + // mpGroupBox1 + // + this.mpGroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.mpGroupBox1.Controls.Add(this.pictureBox1); + this.mpGroupBox1.Controls.Add(this.buttonTest); + this.mpGroupBox1.Controls.Add(this.textBoxPort); + this.mpGroupBox1.Controls.Add(this.textBoxAddress); + this.mpGroupBox1.Controls.Add(this.labelPort); + this.mpGroupBox1.Controls.Add(this.labelAddress); + this.mpGroupBox1.Controls.Add(this.labelHelp); + this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.mpGroupBox1.Location = new System.Drawing.Point(6, 6); + this.mpGroupBox1.Name = "mpGroupBox1"; + this.mpGroupBox1.Size = new System.Drawing.Size(511, 125); + this.mpGroupBox1.TabIndex = 0; + this.mpGroupBox1.TabStop = false; + this.mpGroupBox1.Text = "connection"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::FritzBox.Properties.Resources.FritzBox; + this.pictureBox1.Location = new System.Drawing.Point(6, 20); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(97, 99); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // buttonTest + // + this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonTest.Location = new System.Drawing.Point(430, 20); + this.buttonTest.Name = "buttonTest"; + this.buttonTest.Size = new System.Drawing.Size(75, 21); + this.buttonTest.TabIndex = 2; + this.buttonTest.Text = "Test"; + this.buttonTest.UseVisualStyleBackColor = true; + this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); + // + // textBoxPort + // + this.textBoxPort.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxPort.BorderColor = System.Drawing.Color.Empty; + this.textBoxPort.Location = new System.Drawing.Point(165, 47); + this.textBoxPort.Name = "textBoxPort"; + this.textBoxPort.Size = new System.Drawing.Size(259, 21); + this.textBoxPort.TabIndex = 1; + // + // textBoxAddress + // + this.textBoxAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxAddress.BorderColor = System.Drawing.Color.Empty; + this.textBoxAddress.Location = new System.Drawing.Point(165, 20); + this.textBoxAddress.Name = "textBoxAddress"; + this.textBoxAddress.Size = new System.Drawing.Size(259, 21); + this.textBoxAddress.TabIndex = 0; + // + // labelPort + // + this.labelPort.AutoSize = true; + this.labelPort.Location = new System.Drawing.Point(128, 50); + this.labelPort.Name = "labelPort"; + this.labelPort.Size = new System.Drawing.Size(31, 13); + this.labelPort.TabIndex = 8; + this.labelPort.Text = "Port:"; + // + // labelAddress + // + this.labelAddress.AutoSize = true; + this.labelAddress.Location = new System.Drawing.Point(109, 24); + this.labelAddress.Name = "labelAddress"; + this.labelAddress.Size = new System.Drawing.Size(50, 13); + this.labelAddress.TabIndex = 7; + this.labelAddress.Text = "Address:"; + // + // labelHelp + // + this.labelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.labelHelp.Location = new System.Drawing.Point(165, 73); + this.labelHelp.Name = "labelHelp"; + this.labelHelp.Size = new System.Drawing.Size(340, 49); + this.labelHelp.TabIndex = 6; + // + // tabIncoming + // + this.tabIncoming.Controls.Add(this.groupBoxPhonebook); + this.tabIncoming.Controls.Add(this.groupBoxNotify); + this.tabIncoming.Controls.Add(this.groupBoxMedia); + this.tabIncoming.Location = new System.Drawing.Point(4, 22); + this.tabIncoming.Name = "tabIncoming"; + this.tabIncoming.Padding = new System.Windows.Forms.Padding(3); + this.tabIncoming.Size = new System.Drawing.Size(523, 311); + this.tabIncoming.TabIndex = 1; + this.tabIncoming.Text = "Incoming Call"; + this.tabIncoming.UseVisualStyleBackColor = true; + // + // groupBoxPhonebook + // + this.groupBoxPhonebook.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxPhonebook.Controls.Add(this.mpImportFBMonitor); + this.groupBoxPhonebook.Controls.Add(this.checkBoxSaveUnknownCaller); + this.groupBoxPhonebook.Controls.Add(this.checkBoxShowUnknownCaller); + this.groupBoxPhonebook.Controls.Add(this.checkBoxUsePhonebook); + this.groupBoxPhonebook.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.groupBoxPhonebook.Location = new System.Drawing.Point(6, 208); + this.groupBoxPhonebook.Name = "groupBoxPhonebook"; + this.groupBoxPhonebook.Size = new System.Drawing.Size(511, 95); + this.groupBoxPhonebook.TabIndex = 2; + this.groupBoxPhonebook.TabStop = false; + this.groupBoxPhonebook.Text = "phonebook settings"; + // + // mpImportFBMonitor + // + this.mpImportFBMonitor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.mpImportFBMonitor.Location = new System.Drawing.Point(355, 20); + this.mpImportFBMonitor.Name = "mpImportFBMonitor"; + this.mpImportFBMonitor.Size = new System.Drawing.Size(150, 23); + this.mpImportFBMonitor.TabIndex = 3; + this.mpImportFBMonitor.Text = "Import FRITZ!Box Monitor"; + this.mpImportFBMonitor.UseVisualStyleBackColor = true; + this.mpImportFBMonitor.Click += new System.EventHandler(this.mpImportFBMonitor_Click); + // + // checkBoxSaveUnknownCaller + // + this.checkBoxSaveUnknownCaller.AutoSize = true; + this.checkBoxSaveUnknownCaller.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxSaveUnknownCaller.Location = new System.Drawing.Point(24, 68); + this.checkBoxSaveUnknownCaller.Name = "checkBoxSaveUnknownCaller"; + this.checkBoxSaveUnknownCaller.Size = new System.Drawing.Size(121, 17); + this.checkBoxSaveUnknownCaller.TabIndex = 2; + this.checkBoxSaveUnknownCaller.Text = "save unknown caller"; + this.checkBoxSaveUnknownCaller.UseVisualStyleBackColor = true; + // + // checkBoxShowUnknownCaller + // + this.checkBoxShowUnknownCaller.AutoSize = true; + this.checkBoxShowUnknownCaller.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxShowUnknownCaller.Location = new System.Drawing.Point(24, 45); + this.checkBoxShowUnknownCaller.Name = "checkBoxShowUnknownCaller"; + this.checkBoxShowUnknownCaller.Size = new System.Drawing.Size(123, 17); + this.checkBoxShowUnknownCaller.TabIndex = 1; + this.checkBoxShowUnknownCaller.Text = "show unknown caller"; + this.checkBoxShowUnknownCaller.UseVisualStyleBackColor = true; + // + // checkBoxUsePhonebook + // + this.checkBoxUsePhonebook.AutoSize = true; + this.checkBoxUsePhonebook.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxUsePhonebook.Location = new System.Drawing.Point(6, 20); + this.checkBoxUsePhonebook.Name = "checkBoxUsePhonebook"; + this.checkBoxUsePhonebook.Size = new System.Drawing.Size(97, 17); + this.checkBoxUsePhonebook.TabIndex = 0; + this.checkBoxUsePhonebook.Text = "use phonebook"; + this.checkBoxUsePhonebook.UseVisualStyleBackColor = true; + this.checkBoxUsePhonebook.CheckedChanged += new System.EventHandler(this.checkBoxUsePhonebook_CheckedChanged); + // + // groupBoxNotify + // + this.groupBoxNotify.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxNotify.Controls.Add(this.checkBoxShowMsnOnHeading); + this.groupBoxNotify.Controls.Add(this.buttonMSNsRemove); + this.groupBoxNotify.Controls.Add(this.checkBoxFilterMSNs); + this.groupBoxNotify.Controls.Add(this.buttonMSNsAdd); + this.groupBoxNotify.Controls.Add(this.comboBoxMSNs); + this.groupBoxNotify.Controls.Add(this.numericUpDownTimeout); + this.groupBoxNotify.Controls.Add(this.checkBoxCloseOnTimout); + this.groupBoxNotify.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.groupBoxNotify.Location = new System.Drawing.Point(6, 6); + this.groupBoxNotify.Name = "groupBoxNotify"; + this.groupBoxNotify.Size = new System.Drawing.Size(511, 122); + this.groupBoxNotify.TabIndex = 0; + this.groupBoxNotify.TabStop = false; + this.groupBoxNotify.Text = "notify settings"; + // + // checkBoxShowMsnOnHeading + // + this.checkBoxShowMsnOnHeading.AutoSize = true; + this.checkBoxShowMsnOnHeading.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxShowMsnOnHeading.Location = new System.Drawing.Point(6, 99); + this.checkBoxShowMsnOnHeading.Name = "checkBoxShowMsnOnHeading"; + this.checkBoxShowMsnOnHeading.Size = new System.Drawing.Size(161, 17); + this.checkBoxShowMsnOnHeading.TabIndex = 6; + this.checkBoxShowMsnOnHeading.Text = "show MSN on notify-heading"; + this.checkBoxShowMsnOnHeading.UseVisualStyleBackColor = true; + // + // buttonMSNsRemove + // + this.buttonMSNsRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonMSNsRemove.Location = new System.Drawing.Point(275, 72); + this.buttonMSNsRemove.Name = "buttonMSNsRemove"; + this.buttonMSNsRemove.Size = new System.Drawing.Size(63, 21); + this.buttonMSNsRemove.TabIndex = 5; + this.buttonMSNsRemove.Text = "Remove"; + this.buttonMSNsRemove.UseVisualStyleBackColor = true; + this.buttonMSNsRemove.Click += new System.EventHandler(this.buttonMSNsRemove_Click); + // + // checkBoxFilterMSNs + // + this.checkBoxFilterMSNs.AutoSize = true; + this.checkBoxFilterMSNs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxFilterMSNs.Location = new System.Drawing.Point(6, 49); + this.checkBoxFilterMSNs.Name = "checkBoxFilterMSNs"; + this.checkBoxFilterMSNs.Size = new System.Drawing.Size(194, 17); + this.checkBoxFilterMSNs.TabIndex = 2; + this.checkBoxFilterMSNs.Text = "show notify only for following MSNs"; + this.checkBoxFilterMSNs.UseVisualStyleBackColor = true; + this.checkBoxFilterMSNs.Click += new System.EventHandler(this.checkBoxFilterMSNs_CheckedChanged); + // + // buttonMSNsAdd + // + this.buttonMSNsAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonMSNsAdd.Location = new System.Drawing.Point(206, 72); + this.buttonMSNsAdd.Name = "buttonMSNsAdd"; + this.buttonMSNsAdd.Size = new System.Drawing.Size(63, 21); + this.buttonMSNsAdd.TabIndex = 4; + this.buttonMSNsAdd.Text = "Add"; + this.buttonMSNsAdd.UseVisualStyleBackColor = true; + this.buttonMSNsAdd.Click += new System.EventHandler(this.buttonMSNsAdd_Click); + // + // comboBoxMSNs + // + this.comboBoxMSNs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxMSNs.BorderColor = System.Drawing.Color.Empty; + this.comboBoxMSNs.FormattingEnabled = true; + this.comboBoxMSNs.Location = new System.Drawing.Point(24, 72); + this.comboBoxMSNs.Name = "comboBoxMSNs"; + this.comboBoxMSNs.Size = new System.Drawing.Size(176, 21); + this.comboBoxMSNs.Sorted = true; + this.comboBoxMSNs.TabIndex = 3; + // + // numericUpDownTimeout + // + this.numericUpDownTimeout.Enabled = false; + this.numericUpDownTimeout.Location = new System.Drawing.Point(206, 20); + this.numericUpDownTimeout.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownTimeout.Name = "numericUpDownTimeout"; + this.numericUpDownTimeout.Size = new System.Drawing.Size(53, 21); + this.numericUpDownTimeout.TabIndex = 1; + this.numericUpDownTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDownTimeout.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // checkBoxCloseOnTimout + // + this.checkBoxCloseOnTimout.AutoSize = true; + this.checkBoxCloseOnTimout.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxCloseOnTimout.Location = new System.Drawing.Point(6, 20); + this.checkBoxCloseOnTimout.Name = "checkBoxCloseOnTimout"; + this.checkBoxCloseOnTimout.Size = new System.Drawing.Size(179, 17); + this.checkBoxCloseOnTimout.TabIndex = 0; + this.checkBoxCloseOnTimout.Text = "auto-close after timeout expired"; + this.checkBoxCloseOnTimout.UseVisualStyleBackColor = true; + this.checkBoxCloseOnTimout.CheckedChanged += new System.EventHandler(this.checkBoxCloseOnTimout_CheckedChanged); + // + // groupBoxMedia + // + this.groupBoxMedia.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxMedia.Controls.Add(this.checkBoxResumeMedia); + this.groupBoxMedia.Controls.Add(this.checkBoxStopMedia); + this.groupBoxMedia.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.groupBoxMedia.Location = new System.Drawing.Point(6, 134); + this.groupBoxMedia.Name = "groupBoxMedia"; + this.groupBoxMedia.Size = new System.Drawing.Size(511, 68); + this.groupBoxMedia.TabIndex = 1; + this.groupBoxMedia.TabStop = false; + this.groupBoxMedia.Text = "media settings"; + // + // checkBoxResumeMedia + // + this.checkBoxResumeMedia.AutoSize = true; + this.checkBoxResumeMedia.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxResumeMedia.Location = new System.Drawing.Point(24, 45); + this.checkBoxResumeMedia.Name = "checkBoxResumeMedia"; + this.checkBoxResumeMedia.Size = new System.Drawing.Size(166, 17); + this.checkBoxResumeMedia.TabIndex = 1; + this.checkBoxResumeMedia.Text = "auto-resume on closing notify"; + this.checkBoxResumeMedia.UseVisualStyleBackColor = true; + // + // checkBoxStopMedia + // + this.checkBoxStopMedia.AutoSize = true; + this.checkBoxStopMedia.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxStopMedia.Location = new System.Drawing.Point(6, 20); + this.checkBoxStopMedia.Name = "checkBoxStopMedia"; + this.checkBoxStopMedia.Size = new System.Drawing.Size(122, 17); + this.checkBoxStopMedia.TabIndex = 0; + this.checkBoxStopMedia.Text = "stop on incoming call"; + this.checkBoxStopMedia.UseVisualStyleBackColor = true; + this.checkBoxStopMedia.CheckedChanged += new System.EventHandler(this.checkBoxStopMedia_CheckedChanged); + // + // tabPhonebook + // + this.tabPhonebook.Controls.Add(this.pictureBoxCaller); + this.tabPhonebook.Controls.Add(this.buttonCallerChange); + this.tabPhonebook.Controls.Add(this.checkBoxCallerShow); + this.tabPhonebook.Controls.Add(this.textBoxCallerName); + this.tabPhonebook.Controls.Add(this.textBoxCallerId); + this.tabPhonebook.Controls.Add(this.buttonCallerRemove); + this.tabPhonebook.Controls.Add(this.dataGridView); + this.tabPhonebook.Controls.Add(this.labelCallerId); + this.tabPhonebook.Controls.Add(this.labelCallerName); + this.tabPhonebook.Location = new System.Drawing.Point(4, 22); + this.tabPhonebook.Name = "tabPhonebook"; + this.tabPhonebook.Padding = new System.Windows.Forms.Padding(3); + this.tabPhonebook.Size = new System.Drawing.Size(523, 311); + this.tabPhonebook.TabIndex = 2; + this.tabPhonebook.Text = "Phonebook"; + this.tabPhonebook.UseVisualStyleBackColor = true; + // + // pictureBoxCaller + // + this.pictureBoxCaller.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBoxCaller.Location = new System.Drawing.Point(417, 38); + this.pictureBoxCaller.Name = "pictureBoxCaller"; + this.pictureBoxCaller.Size = new System.Drawing.Size(100, 122); + this.pictureBoxCaller.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBoxCaller.TabIndex = 13; + this.pictureBoxCaller.TabStop = false; + // + // buttonCallerChange + // + this.buttonCallerChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCallerChange.Location = new System.Drawing.Point(417, 278); + this.buttonCallerChange.Name = "buttonCallerChange"; + this.buttonCallerChange.Size = new System.Drawing.Size(100, 25); + this.buttonCallerChange.TabIndex = 3; + this.buttonCallerChange.Text = "Change"; + this.buttonCallerChange.UseVisualStyleBackColor = true; + this.buttonCallerChange.Click += new System.EventHandler(this.buttonCallerChange_Click); + // + // checkBoxCallerShow + // + this.checkBoxCallerShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxCallerShow.AutoSize = true; + this.checkBoxCallerShow.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxCallerShow.Location = new System.Drawing.Point(437, 254); + this.checkBoxCallerShow.Name = "checkBoxCallerShow"; + this.checkBoxCallerShow.Size = new System.Drawing.Size(80, 17); + this.checkBoxCallerShow.TabIndex = 2; + this.checkBoxCallerShow.Text = "show notify"; + this.checkBoxCallerShow.UseVisualStyleBackColor = true; + // + // textBoxCallerName + // + this.textBoxCallerName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxCallerName.BorderColor = System.Drawing.Color.Empty; + this.textBoxCallerName.Location = new System.Drawing.Point(417, 222); + this.textBoxCallerName.Name = "textBoxCallerName"; + this.textBoxCallerName.Size = new System.Drawing.Size(100, 21); + this.textBoxCallerName.TabIndex = 1; + // + // textBoxCallerId + // + this.textBoxCallerId.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxCallerId.BorderColor = System.Drawing.Color.Empty; + this.textBoxCallerId.Location = new System.Drawing.Point(417, 180); + this.textBoxCallerId.Name = "textBoxCallerId"; + this.textBoxCallerId.Size = new System.Drawing.Size(100, 21); + this.textBoxCallerId.TabIndex = 0; + // + // buttonCallerRemove + // + this.buttonCallerRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCallerRemove.Location = new System.Drawing.Point(417, 6); + this.buttonCallerRemove.Name = "buttonCallerRemove"; + this.buttonCallerRemove.Size = new System.Drawing.Size(100, 25); + this.buttonCallerRemove.TabIndex = 6; + this.buttonCallerRemove.Text = "Remove"; + this.buttonCallerRemove.UseVisualStyleBackColor = true; + this.buttonCallerRemove.Click += new System.EventHandler(this.buttonCallerRemove_Click); + // + // dataGridView + // + this.dataGridView.AllowUserToDeleteRows = false; + this.dataGridView.AllowUserToResizeRows = false; + this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.colCallerId, + this.colName, + this.colShow}); + this.dataGridView.Location = new System.Drawing.Point(6, 6); + this.dataGridView.MultiSelect = false; + this.dataGridView.Name = "dataGridView"; + this.dataGridView.ReadOnly = true; + this.dataGridView.RowHeadersVisible = false; + this.dataGridView.RowTemplate.Height = 23; + this.dataGridView.RowTemplate.ReadOnly = true; + this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView.Size = new System.Drawing.Size(405, 297); + this.dataGridView.TabIndex = 5; + this.dataGridView.Sorted += new System.EventHandler(this.dataGridView_Sorted); + this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged); + // + // colCallerId + // + this.colCallerId.DataPropertyName = "dataSet_colCallerId"; + this.colCallerId.HeaderText = "CallerId"; + this.colCallerId.Name = "colCallerId"; + this.colCallerId.ReadOnly = true; + // + // colName + // + this.colName.DataPropertyName = "dataSet_colName"; + this.colName.HeaderText = "Name"; + this.colName.Name = "colName"; + this.colName.ReadOnly = true; + // + // colShow + // + this.colShow.DataPropertyName = "dataSet_colShow"; + this.colShow.HeaderText = "Show"; + this.colShow.Name = "colShow"; + this.colShow.ReadOnly = true; + // + // labelCallerId + // + this.labelCallerId.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.labelCallerId.AutoSize = true; + this.labelCallerId.Location = new System.Drawing.Point(423, 163); + this.labelCallerId.Name = "labelCallerId"; + this.labelCallerId.Size = new System.Drawing.Size(44, 13); + this.labelCallerId.TabIndex = 12; + this.labelCallerId.Text = "CallerId"; + // + // labelCallerName + // + this.labelCallerName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.labelCallerName.AutoSize = true; + this.labelCallerName.Location = new System.Drawing.Point(423, 205); + this.labelCallerName.Name = "labelCallerName"; + this.labelCallerName.Size = new System.Drawing.Size(34, 13); + this.labelCallerName.TabIndex = 11; + this.labelCallerName.Text = "Name"; + // + // labelVersion + // + this.labelVersion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.labelVersion.Location = new System.Drawing.Point(295, 356); + this.labelVersion.Name = "labelVersion"; + this.labelVersion.Size = new System.Drawing.Size(85, 25); + this.labelVersion.TabIndex = 17; + this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // buttonSave + // + this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonSave.Location = new System.Drawing.Point(386, 356); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(75, 25); + this.buttonSave.TabIndex = 15; + this.buttonSave.Text = "Save"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.Location = new System.Drawing.Point(467, 356); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 25); + this.buttonCancel.TabIndex = 16; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(552, 393); + this.Controls.Add(this.tabControlFritzBoxSettings); + this.Controls.Add(this.labelVersion); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.buttonCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "FRITZ!Box configuration"; + this.tabControlFritzBoxSettings.ResumeLayout(false); + this.tabGeneral.ResumeLayout(false); + this.tabGeneral.PerformLayout(); + this.mpGroupBox1.ResumeLayout(false); + this.mpGroupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.tabIncoming.ResumeLayout(false); + this.groupBoxPhonebook.ResumeLayout(false); + this.groupBoxPhonebook.PerformLayout(); + this.groupBoxNotify.ResumeLayout(false); + this.groupBoxNotify.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).EndInit(); + this.groupBoxMedia.ResumeLayout(false); + this.groupBoxMedia.PerformLayout(); + this.tabPhonebook.ResumeLayout(false); + this.tabPhonebook.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private MediaPortal.UserInterface.Controls.MPTabControl tabControlFritzBoxSettings; + private System.Windows.Forms.TabPage tabGeneral; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxExtensiveLogging; + private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox1; + private System.Windows.Forms.PictureBox pictureBox1; + private MediaPortal.UserInterface.Controls.MPButton buttonTest; + private MediaPortal.UserInterface.Controls.MPTextBox textBoxPort; + private MediaPortal.UserInterface.Controls.MPTextBox textBoxAddress; + private MediaPortal.UserInterface.Controls.MPLabel labelPort; + private MediaPortal.UserInterface.Controls.MPLabel labelAddress; + private MediaPortal.UserInterface.Controls.MPLabel labelHelp; + private System.Windows.Forms.TabPage tabIncoming; + private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxPhonebook; + private MediaPortal.UserInterface.Controls.MPButton mpImportFBMonitor; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxSaveUnknownCaller; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxShowUnknownCaller; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxUsePhonebook; + private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxNotify; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxShowMsnOnHeading; + private MediaPortal.UserInterface.Controls.MPButton buttonMSNsRemove; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxFilterMSNs; + private MediaPortal.UserInterface.Controls.MPButton buttonMSNsAdd; + private MediaPortal.UserInterface.Controls.MPComboBox comboBoxMSNs; + private MediaPortal.UserInterface.Controls.MPNumericUpDown numericUpDownTimeout; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxCloseOnTimout; + private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxMedia; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxResumeMedia; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxStopMedia; + private System.Windows.Forms.TabPage tabPhonebook; + private System.Windows.Forms.PictureBox pictureBoxCaller; + private MediaPortal.UserInterface.Controls.MPButton buttonCallerChange; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxCallerShow; + private MediaPortal.UserInterface.Controls.MPTextBox textBoxCallerName; + private MediaPortal.UserInterface.Controls.MPTextBox textBoxCallerId; + private MediaPortal.UserInterface.Controls.MPButton buttonCallerRemove; + private System.Windows.Forms.DataGridView dataGridView; + private System.Windows.Forms.DataGridViewTextBoxColumn colCallerId; + private System.Windows.Forms.DataGridViewTextBoxColumn colName; + private System.Windows.Forms.DataGridViewCheckBoxColumn colShow; + private MediaPortal.UserInterface.Controls.MPLabel labelCallerId; + private MediaPortal.UserInterface.Controls.MPLabel labelCallerName; + private MediaPortal.UserInterface.Controls.MPLabel labelVersion; + private MediaPortal.UserInterface.Controls.MPButton buttonSave; + private MediaPortal.UserInterface.Controls.MPButton buttonCancel; + private System.Windows.Forms.OpenFileDialog openFileDialog; + } +} \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-22 17:42:35 UTC (rev 597) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-22 18:03:18 UTC (rev 598) @@ -1,756 +1,31 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 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.Drawing; -using System.Collections; +using System.Collections.Generic; using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; using System.Windows.Forms; + +using System.Collections; using System.Net.Sockets; using System.IO; -using MediaPortal.Profile; -using MediaPortal.Util; -using MediaPortal.GUI.Library; using MediaPortal.Configuration; +using MediaPortal.GUI.Library; +using MediaPortal.Profile; +using MediaPortal.Util; namespace FritzBox { - /// <summary> - /// Zusammenfassung f\xFCr CallSetupFrom. - /// </summary> - public class FritzBoxSetupForm : Form + public partial class FritzBoxSetupFrom : Form { - private MediaPortal.UserInterface.Controls.MPTabControl tabControlFritzBoxSettings; - private TabPage tabGeneral; - private TabPage tabIncoming; - private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxNotify; - private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxMedia; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxStopMedia; - private TabPage tabPhonebook; - private DataGridView dataGridView; - private DataGridViewTextBoxColumn colCallerId; - private DataGridViewTextBoxColumn colName; - private DataGridViewCheckBoxColumn colShow; - private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxPhonebook; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxSaveUnknownCaller; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxShowUnknownCaller; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxUsePhonebook; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxCallerShow; - private MediaPortal.UserInterface.Controls.MPTextBox textBoxCallerName; - private MediaPortal.UserInterface.Controls.MPTextBox textBoxCallerId; - private MediaPortal.UserInterface.Controls.MPButton buttonCallerRemove; - private MediaPortal.UserInterface.Controls.MPLabel labelCallerId; - private MediaPortal.UserInterface.Controls.MPLabel labelCallerName; - private MediaPortal.UserInterface.Controls.MPButton buttonCallerChange; - private MediaPortal.UserInterface.Controls.MPButton buttonCancel; - private MediaPortal.UserInterface.Controls.MPButton buttonSave; - private MediaPortal.UserInterface.Controls.MPNumericUpDown numericUpDownTimeout; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxCloseOnTimout; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxResumeMedia; - private MediaPortal.UserInterface.Controls.MPLabel labelVersion; - private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox1; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxExtensiveLogging; - private MediaPortal.UserInterface.Controls.MPButton buttonTest; - private MediaPortal.UserInterface.Controls.MPTextBox textBoxPort; - private MediaPortal.UserInterface.Controls.MPTextBox textBoxAddress; - private MediaPortal.UserInterface.Controls.MPLabel labelPort; - private MediaPortal.UserInterface.Controls.MPLabel labelAddress; - private MediaPortal.UserInterface.Controls.MPLabel labelHelp; - private MediaPortal.UserInterface.Controls.MPButton buttonMSNsRemove; - private MediaPortal.UserInterface.Controls.MPButton buttonMSNsAdd; - private PictureBox pictureBoxCaller; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxFilterMSNs; - private MediaPortal.UserInterface.Controls.MPComboBox comboBoxMSNs; - private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxShowMsnOnHeading; - private PictureBox pictureBox1; - private MediaPortal.UserInterface.Controls.MPButton mpImportFBMonitor; - private OpenFileDialog openFileDialog; - - /// <summary> - /// Erforderliche Designervariable. - /// </summary> - private Container components = null; - - public FritzBoxSetupForm() + public FritzBoxSetupFrom() { - // - // Erforderlich f\xFCr die Windows Form-Designerunterst\xFCtzung - // InitializeComponent(); LoadSettings(); - // - // TODO: F\xFCgen Sie den Konstruktorcode nach dem Aufruf von InitializeComponent hinzu - // } - /// <summary> - /// Die verwendeten Ressourcen bereinigen. - /// </summary> - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (components != null) - { - components.Dispose(); - } - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// <summary> - /// Erforderliche Methode f\xFCr die Designerunterst\xFCtzung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor ge\xE4ndert werden. - /// </summary> - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FritzBoxSetupForm)); - this.tabControlFritzBoxSettings = new MediaPortal.UserInterface.Controls.MPTabControl(); - this.tabGeneral = new System.Windows.Forms.TabPage(); - this.checkBoxExtensiveLogging = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.buttonTest = new MediaPortal.UserInterface.Controls.MPButton(); - this.textBoxPort = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.textBoxAddress = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.labelPort = new MediaPortal.UserInterface.Controls.MPLabel(); - this.labelAddress = new MediaPortal.UserInterface.Controls.MPLabel(); - this.labelHelp = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tabIncoming = new System.Windows.Forms.TabPage(); - this.groupBoxPhonebook = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.mpImportFBMonitor = new MediaPortal.UserInterface.Controls.MPButton(); - this.checkBoxSaveUnknownCaller = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.checkBoxShowUnknownCaller = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.checkBoxUsePhonebook = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.groupBoxNotify = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.checkBoxShowMsnOnHeading = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.buttonMSNsRemove = new MediaPortal.UserInterface.Controls.MPButton(); - this.checkBoxFilterMSNs = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.buttonMSNsAdd = new MediaPortal.UserInterface.Controls.MPButton(); - this.comboBoxMSNs = new MediaPortal.UserInterface.Controls.MPComboBox(); - this.numericUpDownTimeout = new MediaPortal.UserInterface.Controls.MPNumericUpDown(); - this.checkBoxCloseOnTimout = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.groupBoxMedia = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.checkBoxResumeMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.checkBoxStopMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.tabPhonebook = new System.Windows.Forms.TabPage(); - this.pictureBoxCaller = new System.Windows.Forms.PictureBox(); - this.buttonCallerChange = new MediaPortal.UserInterface.Controls.MPButton(); - this.checkBoxCallerShow = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.textBoxCallerName = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.textBoxCallerId = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.buttonCallerRemove = new MediaPortal.UserInterface.Controls.MPButton(); - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.colCallerId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShow = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.labelCallerId = new MediaPortal.UserInterface.Controls.MPLabel(); - this.labelCallerName = new MediaPortal.UserInterface.Controls.MPLabel(); - this.buttonCancel = new MediaPortal.UserInterface.Controls.MPButton(); - this.buttonSave = new MediaPortal.UserInterface.Controls.MPButton(); - this.labelVersion = new MediaPortal.UserInterface.Controls.MPLabel(); - this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); - this.tabControlFritzBoxSettings.SuspendLayout(); - this.tabGeneral.SuspendLayout(); - this.mpGroupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.tabIncoming.SuspendLayout(); - this.groupBoxPhonebook.SuspendLayout(); - this.groupBoxNotify.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).BeginInit(); - this.groupBoxMedia.SuspendLayout(); - this.tabPhonebook.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); - // - // tabControlFritzBoxSettings - // - this.tabControlFritzBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControlFritzBoxSettings.Controls.Add(this.tabGeneral); - this.tabControlFritzBoxSettings.Controls.Add(this.tabIncoming); - this.tabControlFritzBoxSettings.Controls.Add(this.tabPhonebook); - this.tabControlFritzBoxSettings.Location = new System.Drawing.Point(12, 13); - this.tabControlFritzBoxSettings.Name = "tabControlFritzBoxSettings"; - this.tabControlFritzBoxSettings.SelectedIndex = 0; - this.tabControlFritzBoxSettings.Size = new System.Drawing.Size(531, 337); - this.tabControlFritzBoxSettings.TabIndex = 0; - // - // tabGeneral - // - this.tabGeneral.Controls.Add(this.checkBoxExtensiveLogging); - this.tabGeneral.Controls.Add(this.mpGroupBox1); - this.tabGeneral.Location = new System.Drawing.Point(4, 22); - this.tabGeneral.Name = "tabGeneral"; - this.tabGeneral.Padding = new System.Windows.Forms.Padding(3); - this.tabGeneral.Size = new System.Drawing.Size(523, 311); - this.tabGeneral.TabIndex = 0; - this.tabGeneral.Text = "General"; - this.tabGeneral.UseVisualStyleBackColor = true; - // - // checkBoxExtensiveLogging - // - this.checkBoxExtensiveLogging.AutoSize = true; - this.checkBoxExtensiveLogging.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.checkBoxExtensiveLogging.Location = new System.Drawing.Point(6, 138); - this.checkBoxExtensiveLogging.Name = "checkBoxExtensiveLogging"; - this.checkBoxExtensiveLogging.Size = new System.Drawing.Size(339, 17); - this.checkBoxExtensiveLogging.TabIndex = 1; - this.checkBoxExtensiveLogging.Text = "extensive logging (!!! phonenumbers are written to the logfile !!!)"; - this.checkBoxExtensiveLogging.UseVisualStyleBackColor = true; - // - // mpGroupBox1 - // - this.mpGroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.mpGroupBox1.Controls.Add(this.pictureBox1); - this.mpGroupBox1.Controls.Add(this.buttonTest); - this.mpGroupBox1.Controls.Add(this.textBoxPort); - this.mpGroupBox1.Controls.Add(this.textBoxAddress); - this.mpGroupBox1.Controls.Add(this.labelPort); - this.mpGroupBox1.Controls.Add(this.labelAddress); - this.mpGroupBox1.Controls.Add(this.labelHelp); - this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.mpGroupBox1.Location = new System.Drawing.Point(6, 6); - this.mpGroupBox1.Name = "mpGroupBox1"; - this.mpGroupBox1.Size = new System.Drawing.Size(511, 125); - this.mpGroupBox1.TabIndex = 0; - this.mpGroupBox1.TabStop = false; - this.mpGroupBox1.Text = "connection"; - // - // pictureBox1 - // - this.pictureBox1.Image = global::FritzBox.Properties.Resources.FritzBoxIconTransparent; - this.pictureBox1.Location = new System.Drawing.Point(6, 20); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(97, 99); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 2; - this.pictureBox1.TabStop = false; - // - // buttonTest - // - this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonTest.Location = new System.Drawing.Point(430, 20); - this.buttonTest.Name = "buttonTest"; - this.buttonTest.Size = new System.Drawing.Size(75, 21); - this.buttonTest.TabIndex = 2; - this.buttonTest.Text = "Test"; - this.buttonTest.UseVisualStyleBackColor = true; - this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); - // - // textBoxPort - // - this.textBoxPort.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxPort.BorderColor = System.Drawing.Color.Empty; - this.textBoxPort.Location = new System.Drawing.Point(165, 47); - this.textBoxPort.Name = "textBoxPort"; - this.textBoxPort.Size = new System.Drawing.Size(259, 21); - this.textBoxPort.TabIndex = 1; - // - // textBoxAddress - // - this.textBoxAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxAddress.BorderColor = System.Drawing.Color.Empty; - this.textBoxAddress.Location = new System.Drawing.Point(165, 20); - this.textBoxAddress... [truncated message content] |
From: <che...@us...> - 2007-06-22 22:11:18
|
Revision: 603 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=603&view=rev Author: chef_koch Date: 2007-06-22 15:11:15 -0700 (Fri, 22 Jun 2007) Log Message: ----------- added new option to limit the notifies Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-22 21:34:44 UTC (rev 602) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-22 22:11:15 UTC (rev 603) @@ -45,7 +45,7 @@ * - add more comments to code * - split code more in methods/classes */ - [PluginIcons("FritzBox.png", "FritzBoxDisabled.png")] + [PluginIcons("FritzBox.FritzBox.png", "FritzBox.FritzBoxDisabled.png")] public class FritzBox : ISetupForm, IPlugin { #region Variables @@ -110,6 +110,7 @@ FritzBoxWatch.fritzBoxPort = xmlreader.GetValueAsString("fritzbox", "port", "1012"); // notify settings + FritzBoxWatch.maxNotifies = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); _closeOnTimeout = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); _timeout = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); @@ -139,6 +140,7 @@ Log.Info("FRITZ!Box: closeOnTimeout = {0}", _closeOnTimeout.ToString()); Log.Info("FRITZ!Box: timeout = {0}", _timeout.ToString()); Log.Info("FRITZ!Box: showMsnOnHeading = {0}", _showMsnOnHeading.ToString()); + Log.Info("FRITZ!Box: maxNotifies = {0}", FritzBoxWatch.maxNotifies.ToString()); Log.Info("FRITZ!Box: stopMedia = {0}", _stopMedia.ToString()); Log.Info("FRITZ!Box: resumeMedia = {0}", _resumeMedia.ToString()); @@ -330,6 +332,7 @@ { case "RING": OnIncomingCall(strList[0], strList[3], strList[4]); + FritzBoxWatch.notifyCount--; break; case "CALL": Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs 2007-06-22 21:34:44 UTC (rev 602) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs 2007-06-22 22:11:15 UTC (rev 603) @@ -33,7 +33,6 @@ this.tabGeneral = new System.Windows.Forms.TabPage(); this.checkBoxExtensiveLogging = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.buttonTest = new MediaPortal.UserInterface.Controls.MPButton(); this.textBoxPort = new MediaPortal.UserInterface.Controls.MPTextBox(); this.textBoxAddress = new MediaPortal.UserInterface.Controls.MPTextBox(); @@ -58,7 +57,6 @@ this.checkBoxResumeMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.checkBoxStopMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabPhonebook = new System.Windows.Forms.TabPage(); - this.pictureBoxCaller = new System.Windows.Forms.PictureBox(); this.buttonCallerChange = new MediaPortal.UserInterface.Controls.MPButton(); this.checkBoxCallerShow = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.textBoxCallerName = new MediaPortal.UserInterface.Controls.MPTextBox(); @@ -74,18 +72,23 @@ this.buttonSave = new MediaPortal.UserInterface.Controls.MPButton(); this.buttonCancel = new MediaPortal.UserInterface.Controls.MPButton(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.pictureBoxCaller = new System.Windows.Forms.PictureBox(); + this.upDownMaxNotifies = new MediaPortal.UserInterface.Controls.MPNumericUpDown(); + this.lblMaxNotifies = new MediaPortal.UserInterface.Controls.MPLabel(); this.tabControlFritzBoxSettings.SuspendLayout(); this.tabGeneral.SuspendLayout(); this.mpGroupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.tabIncoming.SuspendLayout(); this.groupBoxPhonebook.SuspendLayout(); this.groupBoxNotify.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).BeginInit(); this.groupBoxMedia.SuspendLayout(); this.tabPhonebook.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.upDownMaxNotifies)).BeginInit(); this.SuspendLayout(); // // tabControlFritzBoxSettings @@ -144,16 +147,6 @@ this.mpGroupBox1.TabStop = false; this.mpGroupBox1.Text = "connection"; // - // pictureBox1 - // - this.pictureBox1.Image = global::FritzBox.Properties.Resources.FritzBox; - this.pictureBox1.Location = new System.Drawing.Point(6, 20); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(97, 99); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 2; - this.pictureBox1.TabStop = false; - // // buttonTest // this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -291,6 +284,8 @@ // this.groupBoxNotify.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxNotify.Controls.Add(this.lblMaxNotifies); + this.groupBoxNotify.Controls.Add(this.upDownMaxNotifies); this.groupBoxNotify.Controls.Add(this.checkBoxShowMsnOnHeading); this.groupBoxNotify.Controls.Add(this.buttonMSNsRemove); this.groupBoxNotify.Controls.Add(this.checkBoxFilterMSNs); @@ -450,16 +445,6 @@ this.tabPhonebook.Text = "Phonebook"; this.tabPhonebook.UseVisualStyleBackColor = true; // - // pictureBoxCaller - // - this.pictureBoxCaller.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBoxCaller.Location = new System.Drawing.Point(417, 38); - this.pictureBoxCaller.Name = "pictureBoxCaller"; - this.pictureBoxCaller.Size = new System.Drawing.Size(100, 122); - this.pictureBoxCaller.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBoxCaller.TabIndex = 13; - this.pictureBoxCaller.TabStop = false; - // // buttonCallerChange // this.buttonCallerChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -610,8 +595,60 @@ this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // - // Form1 + // pictureBox1 // + this.pictureBox1.Image = global::FritzBox.Properties.Resources.FritzBox; + this.pictureBox1.Location = new System.Drawing.Point(6, 20); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(97, 99); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // pictureBoxCaller + // + this.pictureBoxCaller.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBoxCaller.Location = new System.Drawing.Point(417, 38); + this.pictureBoxCaller.Name = "pictureBoxCaller"; + this.pictureBoxCaller.Size = new System.Drawing.Size(100, 122); + this.pictureBoxCaller.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBoxCaller.TabIndex = 13; + this.pictureBoxCaller.TabStop = false; + // + // upDownMaxNotifies + // + this.upDownMaxNotifies.Location = new System.Drawing.Point(465, 20); + this.upDownMaxNotifies.Maximum = new decimal(new int[] { + 20, + 0, + 0, + 0}); + this.upDownMaxNotifies.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.upDownMaxNotifies.Name = "upDownMaxNotifies"; + this.upDownMaxNotifies.Size = new System.Drawing.Size(40, 21); + this.upDownMaxNotifies.TabIndex = 7; + this.upDownMaxNotifies.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.upDownMaxNotifies.Value = new decimal(new int[] { + 20, + 0, + 0, + 0}); + // + // lblMaxNotifies + // + this.lblMaxNotifies.AutoSize = true; + this.lblMaxNotifies.Location = new System.Drawing.Point(365, 22); + this.lblMaxNotifies.Name = "lblMaxNotifies"; + this.lblMaxNotifies.Size = new System.Drawing.Size(94, 13); + this.lblMaxNotifies.TabIndex = 8; + this.lblMaxNotifies.Text = "maximum Notifies:"; + // + // FritzBoxSetupFrom + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(552, 393); @@ -623,7 +660,7 @@ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "Form1"; + this.Name = "FritzBoxSetupFrom"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "FRITZ!Box configuration"; this.tabControlFritzBoxSettings.ResumeLayout(false); @@ -631,7 +668,6 @@ this.tabGeneral.PerformLayout(); this.mpGroupBox1.ResumeLayout(false); this.mpGroupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.tabIncoming.ResumeLayout(false); this.groupBoxPhonebook.ResumeLayout(false); this.groupBoxPhonebook.PerformLayout(); @@ -642,8 +678,10 @@ this.groupBoxMedia.PerformLayout(); this.tabPhonebook.ResumeLayout(false); this.tabPhonebook.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.upDownMaxNotifies)).EndInit(); this.ResumeLayout(false); } @@ -695,5 +733,7 @@ private MediaPortal.UserInterface.Controls.MPButton buttonSave; private MediaPortal.UserInterface.Controls.MPButton buttonCancel; private System.Windows.Forms.OpenFileDialog openFileDialog; + private MediaPortal.UserInterface.Controls.MPNumericUpDown upDownMaxNotifies; + private MediaPortal.UserInterface.Controls.MPLabel lblMaxNotifies; } } \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-22 21:34:44 UTC (rev 602) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-22 22:11:15 UTC (rev 603) @@ -42,6 +42,7 @@ textBoxPort.Text = xmlreader.GetValueAsString("fritzbox", "port", "1012"); // notify settings + upDownMaxNotifies.Value = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); checkBoxCloseOnTimout.Checked = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); numericUpDownTimeout.Value = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); @@ -88,6 +89,7 @@ xmlwriter.SetValue("fritzbox", "port", textBoxPort.Text); // notify settings + xmlwriter.SetValue("fritzbox", "maxNotifies", upDownMaxNotifies.Value); xmlwriter.SetValueAsBool("fritzbox", "closeOnTimeout", checkBoxCloseOnTimout.Checked); xmlwriter.SetValue("fritzbox", "timeout", numericUpDownTimeout.Value); Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs 2007-06-22 21:34:44 UTC (rev 602) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs 2007-06-22 22:11:15 UTC (rev 603) @@ -52,6 +52,9 @@ public static string fritzBoxAddress; // address for the connected fritzbox public static string fritzBoxPort; // port for the connected fritzbox + + public static int maxNotifies = 20; + public static int notifyCount = 0; public void Start() { @@ -95,7 +98,11 @@ } if (cChar == '\n') { - FritzBoxAction(strLine); + if (notifyCount < maxNotifies) + { + FritzBoxAction(strLine); + notifyCount++; + } strLine = ""; cChar = '\0'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-24 07:22:10
|
Revision: 610 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=610&view=rev Author: chef_koch Date: 2007-06-24 00:22:08 -0700 (Sun, 24 Jun 2007) Log Message: ----------- huge code changes Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/Caller.cs trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/FritzBox.csproj trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs Added Paths: ----------- trunk/plugins/FritzBox/FritzBox/CallAction.cs trunk/plugins/FritzBox/FritzBox/bin/ trunk/plugins/FritzBox/FritzBox/bin/Release/ Added: trunk/plugins/FritzBox/FritzBox/CallAction.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/CallAction.cs (rev 0) +++ trunk/plugins/FritzBox/FritzBox/CallAction.cs 2007-06-24 07:22:08 UTC (rev 610) @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace FritzBox +{ + public class CallAction + { + public enum CallType + { + Incoming, + Outgoing, + ConnectionStarted, + ConnectionClosed, + } + + public CallType type; + public DateTime time = DateTime.MinValue; + public Caller caller = new Caller(); + public string msn = string.Empty; + } +} Modified: trunk/plugins/FritzBox/FritzBox/Caller.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/Caller.cs 2007-06-23 16:19:44 UTC (rev 609) +++ trunk/plugins/FritzBox/FritzBox/Caller.cs 2007-06-24 07:22:08 UTC (rev 610) @@ -39,7 +39,7 @@ { this._id = ""; this._name = ""; - this._show = false; + this._show = true; } public Caller(string id, string name, bool show) Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-23 16:19:44 UTC (rev 609) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-24 07:22:08 UTC (rev 610) @@ -54,13 +54,15 @@ public static int _lastVersion = 0; public static bool _extensiveLogging = false; - FritzBoxWatch FritzBoxWatch; - private bool _fritzBoxDisabled = false; + List<CallAction> actionList = new List<CallAction>(); + object tempNotify = null; + // notify settings private int _timeout = -1; // autoclose the dialog after the timeout expired private bool _closeOnTimeout = false; + private bool _closeOnConnectionClosed = false; public static bool _filterMSNs = false; public static List<String> _msnList = new List<String>(); @@ -72,7 +74,7 @@ private bool _resumeMedia = true; // resume media when notify is closed private bool _showNotify = true; - private List<String> notifyQueue = new List<String>(); + private List<CallAction> notifyQueue = new List<CallAction>(); // phonebook settings public static bool _usePhonebook = true; @@ -104,15 +106,16 @@ { _lastVersion = xmlreader.GetValueAsInt("fritzbox", "lastVersion", 0); - _extensiveLogging = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); - FritzBoxWatch.fritzBoxAddress = xmlreader.GetValueAsString("fritzbox", "address", "fritz.box"); - FritzBoxWatch.fritzBoxPort = xmlreader.GetValueAsString("fritzbox", "port", "1012"); + FritzBoxWatch.fritzBoxPort = xmlreader.GetValueAsInt("fritzbox", "port", 1012); + _extensiveLogging = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); + // notify settings FritzBoxWatch.maxNotifies = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); _closeOnTimeout = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); _timeout = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); + _closeOnConnectionClosed = xmlreader.GetValueAsBool("fritzbox", "closeOnConnectionClosed", true); if ((!_closeOnTimeout) || (_timeout == 0)) _timeout = -1; @@ -140,7 +143,7 @@ Log.Info("FRITZ!Box: closeOnTimeout = {0}", _closeOnTimeout.ToString()); Log.Info("FRITZ!Box: timeout = {0}", _timeout.ToString()); Log.Info("FRITZ!Box: showMsnOnHeading = {0}", _showMsnOnHeading.ToString()); - Log.Info("FRITZ!Box: maxNotifies = {0}", FritzBoxWatch.maxNotifies.ToString()); + //Log.Info("FRITZ!Box: maxNotifies = {0}", FritzBoxWatch.maxNotifies.ToString()); Log.Info("FRITZ!Box: stopMedia = {0}", _stopMedia.ToString()); Log.Info("FRITZ!Box: resumeMedia = {0}", _resumeMedia.ToString()); @@ -302,208 +305,192 @@ #region FritzBoxActions - private void OnFritzBoxEvent(string dataStream) + public void OnCallAction(CallAction callAction) { + LogAction(callAction); + if (!_showNotify) { Log.Info("External process is running. Notify is queued and will be shown later."); - notifyQueue.Add(dataStream); + notifyQueue.Add(callAction); return; } - string[] strList; // splitted data - - // data-stream can be in following format: - // incoming calls: DateTime;RING;ConnectionID;CallerID;MSN;??POTS??; - // outgoing calls: DateTime;CALL;ConnectionID;??Nebenstelle??;MSN;CallerID;??POTS??; - // connection started: DateTime;CONNECT;ConnectionID;??Nebenstelle??;CallerID; - // connection closed: DateTime;DISCONNECT;ConnectionID;ConnectedTime; - - // DateTime format: - // 12.12.06 12:12:12 - // dd.MM.yy hh:mm:ss - - dataStream = dataStream.Replace("\n", ""); - if (FritzBox._extensiveLogging) - Log.Info("received data: {0}", dataStream); - strList = dataStream.Split(';'); - - switch (strList[1]) + switch (callAction.type) { - case "RING": - OnIncomingCall(strList[0], strList[3], strList[4]); + case CallAction.CallType.Incoming: + OnIncomingCall(callAction); break; - - case "CALL": - OnOutgoingCall(strList[0], strList[3], strList[4], strList[5]); + case CallAction.CallType.Outgoing: break; - - case "CONNECT": - OnConnectionStarted(strList[0], strList[3], strList[4]); + case CallAction.CallType.ConnectionStarted: break; - - case "DISCONNECT": - OnConnectionClosed(strList[0], int.Parse(strList[3])); + case CallAction.CallType.ConnectionClosed: + if (_closeOnConnectionClosed) + { + Log.Info("_closeOnConnectionClosed is enabled. try to close active notify."); + if (tempNotify != null) + { + Action act = new Action(); + act.wID = Action.ActionType.ACTION_CLOSE_DIALOG; + GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY).OnAction(act); + } + } break; } - FritzBoxWatch.notifyCount--; + } - private void OnIncomingCall(string dateTime, string callerId, string msn) + void OnIncomingCall(CallAction callAction) { - Log.Info("incoming call:"); - Log.Info(" DateTime: {0}", dateTime); - if (FritzBox._extensiveLogging) + if (tempNotify != null) { - Log.Info(" Caller: {0}", callerId); - Log.Info(" MSN: {0}", msn); + Log.Info("yet another dialog is active. action is sent to queue."); + if (actionList.Count < FritzBoxWatch.maxNotifies - 1) + actionList.Add(callAction); + return; } - if (!IsMsnEnabled(msn)) return; + //config settings for dialog + string strHeading = String.Empty; + string strImage = String.Empty; + string strText = String.Empty; + + // Set Heading for NotifyDialog + if (_showMsnOnHeading) + strHeading = GUILocalizeStrings.Get(1023) + " on " + callAction.msn; // ???? Incoming call on + else + strHeading = GUILocalizeStrings.Get(1023); // 1023 Incoming call - if (callerId == "") - { - Log.Info("Caller is not identified by CLIP."); - - if (FritzBox._showUnknownCaller) - DialogOnIncomingCall("", msn); - } + // Set Image for NotifyDialog + strImage = GetCallerImage(callAction.caller); + + // Set MessageText for NotifyDialog + if (callAction.caller.ID == "") + strText = GUILocalizeStrings.Get(2014); // 2014 = unknown + else if (callAction.caller.Name == "") + strText = callAction.caller.ID; else - { - if (FritzBox._usePhonebook) - { - bool foundCaller = false; + strText = callAction.caller.Name; - if (phonebook.Count == 0) - { - Log.Info("Phonebook is empty. Caller is added to the phonebook."); - Caller caller = new Caller(callerId, callerId, true); - phonebook.Add(caller); - } - else - { - int i = 0; + //config settings for dialog FINISHED + + //if msn is disabled, stop here + if (!IsMsnEnabled(callAction.msn)) return; - do - { - Caller caller = phonebook[i]; + //if notifies are disabled for this call, stop here + if (!IsCallerEnabled(callAction.caller)) return; - if (caller.ID.Equals(callerId)) - { - Log.Info("Caller is identified by phonebook as {0}.", caller.Name); - foundCaller = true; + ShowNotify(strHeading, strImage, strText); + } - if (caller.Show) - { - Log.Info("Caller is accepted by phonebook and dialog will be shown."); + #endregion - DialogOnIncomingCall(caller.Name, msn); - } - else - { - Log.Info("Caller is denied by phonebook and dialog won't be shown."); - } - } - i++; - } - while (!foundCaller && (i < phonebook.Count)); + #region Helper Methods - if (!foundCaller) - { - Log.Info("Caller is not identified by phonebook."); + Caller GetCallerFromPhonebook(Caller caller) + { + if (caller.ID == "") return caller; - if (FritzBox._saveUnknownCaller) - { - Log.Info("saveUnknownCallers is ON - Caller is added to the phonebook."); - - Caller caller = new Caller(callerId, callerId, FritzBox._showUnknownCaller); - phonebook.Add(caller); - } - - if (FritzBox._showUnknownCaller) - { - Log.Info("showUnknownCallers is ON - Caller is shown."); - - DialogOnIncomingCall(callerId, msn); - } - } - + if (phonebook.Count == 0) + { + Log.Info("Phonebook is empty. Caller is added to the phonebook."); + phonebook.Add(caller); + } + else + { + bool foundCaller = false; + for (int i = 0; i < phonebook.Count; i++) + { + Caller tempCaller = phonebook[i]; + if (tempCaller.ID == caller.ID) + { + Log.Info("Caller is identified by phonebook as {0}.", tempCaller.Name); + caller = tempCaller; + foundCaller = true; } + if (foundCaller) break; } - else - DialogOnIncomingCall(callerId, msn); - } - } - private void OnOutgoingCall(string dateTime, string nebenstelle, string msn, string callerId) - { - Log.Info("outgoing call:"); - Log.Info(" DateTime: {0}", dateTime); - if (FritzBox._extensiveLogging) - { - Log.Info(" Nebenstelle: {0}", nebenstelle); - Log.Info(" MSN: {0}", msn); - Log.Info(" Caller: {0}", callerId); - } - } + if (!foundCaller) + { + if (_showUnknownCaller) + caller.Show = true; + else + caller.Show = false; - private void OnConnectionStarted(string dateTime, string nebenstelle, string callerId) - { - Log.Info("connection started:"); - Log.Info(" DateTime: {0}", dateTime); - if (FritzBox._extensiveLogging) - { - Log.Info(" Nebenstelle: {0}", nebenstelle); - Log.Info(" Caller: {0}", callerId); + if (FritzBox._saveUnknownCaller) + phonebook.Add(caller); + } } - } - private void OnConnectionClosed(string dateTime, int connectedTime) - { - Log.Info("connection closed:"); - Log.Info(" DateTime: {0}", dateTime); - Log.Info(" conneted time (in s): {0}", connectedTime.ToString()); + return caller; } - #endregion - - void DialogOnIncomingCall(string strCallerId, string strMSN) + string GetCallerImage(Caller caller) { - string strImage = null; - string strHeading = null; - - if (strCallerId == "") - { - strCallerId = GUILocalizeStrings.Get(2014); // 2014 = unknown - strImage = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, "_unknown"); - } + if (caller.ID == "") + return MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, "_unknown"); else { - //search image for caller - if (_extensiveLogging) - Log.Info("searching image: " + MediaPortal.Util.Utils.GetCoverArtName(Thumbs.Yac, strCallerId)); + string strImage = MediaPortal.Util.Utils.GetCoverArtName(Thumbs.Yac, caller.ID); - if (File.Exists(MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, strCallerId))) + // search image for caller + if (_extensiveLogging) + Log.Info("searching image: " + strImage); + + if (File.Exists(strImage)) { if (_extensiveLogging) - Log.Info("found image for caller: " + MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, strCallerId)); + Log.Info("found image for caller: " + strImage); else Log.Info("found image for caller"); - strImage = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, strCallerId); + return strImage; } else { Log.Info("found NO image for caller"); - strImage = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, "_noImage"); + return MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, "_noImage"); } } + } - if (_showMsnOnHeading) - strHeading = GUILocalizeStrings.Get(1023) + " on " + strMSN; // ???? Incoming call on + bool IsMsnEnabled(string msn) + { + if (!_filterMSNs) + { + Log.Info("MSN filter is disabled."); + return true; + } + + if (_msnList.Contains(msn)) + { + Log.Info("MSN is on list."); + return true; + } else - strHeading = GUILocalizeStrings.Get(1023); // 1023 Incoming call + { + Log.Info("MSN is not on list. Notify won't be shown."); + return false; + } + } + bool IsCallerEnabled(Caller caller) + { + if (!_usePhonebook) + { + Log.Info("Phonebook is disabled. Notify will be shown."); + return true; + } + else if (caller.Show) return true; + else return false; + } + + void ShowNotify(string strHeading, string strImage, string strText) + { + if (FritzBoxWatch.notifyCount >= FritzBoxWatch.maxNotifies) return; + //show dialog if (g_Player.Playing && !g_Player.Paused && _stopMedia) g_Player.Pause(); @@ -515,52 +502,35 @@ dlgNotify.ClearAll(); dlgNotify.SetHeading(strHeading); dlgNotify.SetImage(strImage); - dlgNotify.SetText(strCallerId); + dlgNotify.SetText(strText); dlgNotify.TimeOut = _timeout; + tempNotify = dlgNotify; dlgNotify.DoModal(GUIWindowManager.ActiveWindow); if (g_Player.Playing && g_Player.Paused && _stopMedia && _resumeMedia) g_Player.Pause(); - } - #region Helper Methods - - public bool IsFritzBoxConnected(string fritzBoxAddress, string fritzBoxPort) - { - TcpClient TcpClient; - - try + tempNotify = null; + if (actionList.Count > 0) { - TcpClient = new TcpClient(fritzBoxAddress, Int32.Parse(fritzBoxPort)); + CallAction tmpAction = actionList[0]; + actionList.RemoveAt(0); + OnCallAction(tmpAction); } - catch (Exception) - { - return false; - } - - TcpClient.Close(); - return true; } - private bool IsMsnEnabled(string msn) + public void LogAction(CallAction action) { - if (!_filterMSNs) + Log.Info("CallAction Info:"); + Log.Info(" CallType: {0}", action.type.ToString()); + Log.Info(" Date: {0}", action.time.ToShortDateString()); + Log.Info(" Time: {0}", action.time.ToShortTimeString()); + if (_extensiveLogging) { - Log.Info("MSN filter is disabled."); - return true; + Log.Info(" Caller: {0}", action.caller.ID); + Log.Info(" MSN: {0}", action.msn); } - - if (_msnList.Contains(msn)) - { - Log.Info("MSN is on list."); - return true; - } - else - { - Log.Info("MSN is not on list. Notify won't be shown."); - return false; - } } #endregion @@ -600,15 +570,16 @@ public void Start() { Log.Info("FRITZ!Box Plugin {0} starting.", _version); - - FritzBoxWatch = new FritzBoxWatch(); LoadSettings(); - FritzBoxWatch.Start(); - FritzBoxWatch.FritzBoxAction += new FritzBoxWatch.EventHandler(OnFritzBoxEvent); - Utils.OnStartExternal += new Utils.UtilEventHandler(OnStartExternal); Utils.OnStopExternal += new Utils.UtilEventHandler(OnStopExternal); + + FritzBoxWatch.FritzBoxAction += new FritzBoxWatch.EventHandler(OnCallAction); + Thread FBWatchThread = new Thread(new ThreadStart(FritzBoxWatch.WatchThread)); + FBWatchThread.Priority = ThreadPriority.BelowNormal; + FBWatchThread.Name = "FRITZ!Box Monitoring"; + FBWatchThread.Start(); } /// <summary> Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.csproj =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2007-06-23 16:19:44 UTC (rev 609) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2007-06-24 07:22:08 UTC (rev 610) @@ -70,6 +70,7 @@ </ItemGroup> <ItemGroup> <Compile Include="Caller.cs" /> + <Compile Include="CallAction.cs" /> <Compile Include="FritzBoxSetupFrom.cs"> <SubType>Form</SubType> </Compile> @@ -86,7 +87,6 @@ </ItemGroup> <ItemGroup> <EmbeddedResource Include="Properties\Resources.resx"> - <SubType>Designer</SubType> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs 2007-06-23 16:19:44 UTC (rev 609) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.Designer.cs 2007-06-24 07:22:08 UTC (rev 610) @@ -33,8 +33,9 @@ this.tabGeneral = new System.Windows.Forms.TabPage(); this.checkBoxExtensiveLogging = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.mpGroupBox1 = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.numericUpDownPort = new System.Windows.Forms.NumericUpDown(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.buttonTest = new MediaPortal.UserInterface.Controls.MPButton(); - this.textBoxPort = new MediaPortal.UserInterface.Controls.MPTextBox(); this.textBoxAddress = new MediaPortal.UserInterface.Controls.MPTextBox(); this.labelPort = new MediaPortal.UserInterface.Controls.MPLabel(); this.labelAddress = new MediaPortal.UserInterface.Controls.MPLabel(); @@ -46,6 +47,9 @@ this.checkBoxShowUnknownCaller = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.checkBoxUsePhonebook = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.groupBoxNotify = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.checkBoxCloseOnConnectionClosed = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.lblMaxNotifies = new MediaPortal.UserInterface.Controls.MPLabel(); + this.numericUpDownMaxNotifies = new MediaPortal.UserInterface.Controls.MPNumericUpDown(); this.checkBoxShowMsnOnHeading = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.buttonMSNsRemove = new MediaPortal.UserInterface.Controls.MPButton(); this.checkBoxFilterMSNs = new MediaPortal.UserInterface.Controls.MPCheckBox(); @@ -57,6 +61,7 @@ this.checkBoxResumeMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.checkBoxStopMedia = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.tabPhonebook = new System.Windows.Forms.TabPage(); + this.pictureBoxCaller = new System.Windows.Forms.PictureBox(); this.buttonCallerChange = new MediaPortal.UserInterface.Controls.MPButton(); this.checkBoxCallerShow = new MediaPortal.UserInterface.Controls.MPCheckBox(); this.textBoxCallerName = new MediaPortal.UserInterface.Controls.MPTextBox(); @@ -72,23 +77,20 @@ this.buttonSave = new MediaPortal.UserInterface.Controls.MPButton(); this.buttonCancel = new MediaPortal.UserInterface.Controls.MPButton(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.pictureBoxCaller = new System.Windows.Forms.PictureBox(); - this.upDownMaxNotifies = new MediaPortal.UserInterface.Controls.MPNumericUpDown(); - this.lblMaxNotifies = new MediaPortal.UserInterface.Controls.MPLabel(); this.tabControlFritzBoxSettings.SuspendLayout(); this.tabGeneral.SuspendLayout(); this.mpGroupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPort)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.tabIncoming.SuspendLayout(); this.groupBoxPhonebook.SuspendLayout(); this.groupBoxNotify.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxNotifies)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).BeginInit(); this.groupBoxMedia.SuspendLayout(); this.tabPhonebook.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.upDownMaxNotifies)).BeginInit(); this.SuspendLayout(); // // tabControlFritzBoxSettings @@ -102,7 +104,7 @@ this.tabControlFritzBoxSettings.Location = new System.Drawing.Point(11, 12); this.tabControlFritzBoxSettings.Name = "tabControlFritzBoxSettings"; this.tabControlFritzBoxSettings.SelectedIndex = 0; - this.tabControlFritzBoxSettings.Size = new System.Drawing.Size(531, 337); + this.tabControlFritzBoxSettings.Size = new System.Drawing.Size(581, 383); this.tabControlFritzBoxSettings.TabIndex = 14; // // tabGeneral @@ -112,7 +114,7 @@ this.tabGeneral.Location = new System.Drawing.Point(4, 22); this.tabGeneral.Name = "tabGeneral"; this.tabGeneral.Padding = new System.Windows.Forms.Padding(3); - this.tabGeneral.Size = new System.Drawing.Size(523, 311); + this.tabGeneral.Size = new System.Drawing.Size(573, 357); this.tabGeneral.TabIndex = 0; this.tabGeneral.Text = "General"; this.tabGeneral.UseVisualStyleBackColor = true; @@ -132,9 +134,9 @@ // this.mpGroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.mpGroupBox1.Controls.Add(this.numericUpDownPort); this.mpGroupBox1.Controls.Add(this.pictureBox1); this.mpGroupBox1.Controls.Add(this.buttonTest); - this.mpGroupBox1.Controls.Add(this.textBoxPort); this.mpGroupBox1.Controls.Add(this.textBoxAddress); this.mpGroupBox1.Controls.Add(this.labelPort); this.mpGroupBox1.Controls.Add(this.labelAddress); @@ -142,15 +144,43 @@ this.mpGroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.mpGroupBox1.Location = new System.Drawing.Point(6, 6); this.mpGroupBox1.Name = "mpGroupBox1"; - this.mpGroupBox1.Size = new System.Drawing.Size(511, 125); + this.mpGroupBox1.Size = new System.Drawing.Size(561, 125); this.mpGroupBox1.TabIndex = 0; this.mpGroupBox1.TabStop = false; this.mpGroupBox1.Text = "connection"; // + // numericUpDownPort + // + this.numericUpDownPort.Location = new System.Drawing.Point(308, 47); + this.numericUpDownPort.Maximum = new decimal(new int[] { + 999999, + 0, + 0, + 0}); + this.numericUpDownPort.Name = "numericUpDownPort"; + this.numericUpDownPort.Size = new System.Drawing.Size(116, 21); + this.numericUpDownPort.TabIndex = 9; + this.numericUpDownPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDownPort.Value = new decimal(new int[] { + 1012, + 0, + 0, + 0}); + // + // pictureBox1 + // + this.pictureBox1.Image = global::FritzBox.Properties.Resources.FritzBox; + this.pictureBox1.Location = new System.Drawing.Point(6, 20); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(97, 99); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // // buttonTest // this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonTest.Location = new System.Drawing.Point(430, 20); + this.buttonTest.Location = new System.Drawing.Point(480, 20); this.buttonTest.Name = "buttonTest"; this.buttonTest.Size = new System.Drawing.Size(75, 21); this.buttonTest.TabIndex = 2; @@ -158,16 +188,6 @@ this.buttonTest.UseVisualStyleBackColor = true; this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); // - // textBoxPort - // - this.textBoxPort.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxPort.BorderColor = System.Drawing.Color.Empty; - this.textBoxPort.Location = new System.Drawing.Point(165, 47); - this.textBoxPort.Name = "textBoxPort"; - this.textBoxPort.Size = new System.Drawing.Size(259, 21); - this.textBoxPort.TabIndex = 1; - // // textBoxAddress // this.textBoxAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -175,7 +195,7 @@ this.textBoxAddress.BorderColor = System.Drawing.Color.Empty; this.textBoxAddress.Location = new System.Drawing.Point(165, 20); this.textBoxAddress.Name = "textBoxAddress"; - this.textBoxAddress.Size = new System.Drawing.Size(259, 21); + this.textBoxAddress.Size = new System.Drawing.Size(309, 21); this.textBoxAddress.TabIndex = 0; // // labelPort @@ -203,7 +223,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.labelHelp.Location = new System.Drawing.Point(165, 73); this.labelHelp.Name = "labelHelp"; - this.labelHelp.Size = new System.Drawing.Size(340, 49); + this.labelHelp.Size = new System.Drawing.Size(390, 49); this.labelHelp.TabIndex = 6; // // tabIncoming @@ -214,7 +234,7 @@ this.tabIncoming.Location = new System.Drawing.Point(4, 22); this.tabIncoming.Name = "tabIncoming"; this.tabIncoming.Padding = new System.Windows.Forms.Padding(3); - this.tabIncoming.Size = new System.Drawing.Size(523, 311); + this.tabIncoming.Size = new System.Drawing.Size(573, 357); this.tabIncoming.TabIndex = 1; this.tabIncoming.Text = "Incoming Call"; this.tabIncoming.UseVisualStyleBackColor = true; @@ -230,7 +250,7 @@ this.groupBoxPhonebook.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.groupBoxPhonebook.Location = new System.Drawing.Point(6, 208); this.groupBoxPhonebook.Name = "groupBoxPhonebook"; - this.groupBoxPhonebook.Size = new System.Drawing.Size(511, 95); + this.groupBoxPhonebook.Size = new System.Drawing.Size(561, 95); this.groupBoxPhonebook.TabIndex = 2; this.groupBoxPhonebook.TabStop = false; this.groupBoxPhonebook.Text = "phonebook settings"; @@ -238,7 +258,7 @@ // mpImportFBMonitor // this.mpImportFBMonitor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.mpImportFBMonitor.Location = new System.Drawing.Point(355, 20); + this.mpImportFBMonitor.Location = new System.Drawing.Point(405, 20); this.mpImportFBMonitor.Name = "mpImportFBMonitor"; this.mpImportFBMonitor.Size = new System.Drawing.Size(150, 23); this.mpImportFBMonitor.TabIndex = 3; @@ -284,8 +304,9 @@ // this.groupBoxNotify.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxNotify.Controls.Add(this.checkBoxCloseOnConnectionClosed); this.groupBoxNotify.Controls.Add(this.lblMaxNotifies); - this.groupBoxNotify.Controls.Add(this.upDownMaxNotifies); + this.groupBoxNotify.Controls.Add(this.numericUpDownMaxNotifies); this.groupBoxNotify.Controls.Add(this.checkBoxShowMsnOnHeading); this.groupBoxNotify.Controls.Add(this.buttonMSNsRemove); this.groupBoxNotify.Controls.Add(this.checkBoxFilterMSNs); @@ -296,16 +317,60 @@ this.groupBoxNotify.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.groupBoxNotify.Location = new System.Drawing.Point(6, 6); this.groupBoxNotify.Name = "groupBoxNotify"; - this.groupBoxNotify.Size = new System.Drawing.Size(511, 122); + this.groupBoxNotify.Size = new System.Drawing.Size(561, 122); this.groupBoxNotify.TabIndex = 0; this.groupBoxNotify.TabStop = false; this.groupBoxNotify.Text = "notify settings"; // + // checkBoxCloseOnConnectionClosed + // + this.checkBoxCloseOnConnectionClosed.AutoSize = true; + this.checkBoxCloseOnConnectionClosed.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBoxCloseOnConnectionClosed.Location = new System.Drawing.Point(6, 43); + this.checkBoxCloseOnConnectionClosed.Name = "checkBoxCloseOnConnectionClosed"; + this.checkBoxCloseOnConnectionClosed.Size = new System.Drawing.Size(199, 17); + this.checkBoxCloseOnConnectionClosed.TabIndex = 9; + this.checkBoxCloseOnConnectionClosed.Text = "auto-close after connection is closed"; + this.checkBoxCloseOnConnectionClosed.UseVisualStyleBackColor = true; + this.checkBoxCloseOnConnectionClosed.CheckedChanged += new System.EventHandler(this.checkBoxCloseOnConnectionClosed_CheckedChanged); + // + // lblMaxNotifies + // + this.lblMaxNotifies.AutoSize = true; + this.lblMaxNotifies.Location = new System.Drawing.Point(21, 68); + this.lblMaxNotifies.Name = "lblMaxNotifies"; + this.lblMaxNotifies.Size = new System.Drawing.Size(94, 13); + this.lblMaxNotifies.TabIndex = 8; + this.lblMaxNotifies.Text = "maximum Notifies:"; + // + // numericUpDownMaxNotifies + // + this.numericUpDownMaxNotifies.Location = new System.Drawing.Point(206, 66); + this.numericUpDownMaxNotifies.Maximum = new decimal(new int[] { + 20, + 0, + 0, + 0}); + this.numericUpDownMaxNotifies.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownMaxNotifies.Name = "numericUpDownMaxNotifies"; + this.numericUpDownMaxNotifies.Size = new System.Drawing.Size(53, 21); + this.numericUpDownMaxNotifies.TabIndex = 7; + this.numericUpDownMaxNotifies.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDownMaxNotifies.Value = new decimal(new int[] { + 20, + 0, + 0, + 0}); + // // checkBoxShowMsnOnHeading // this.checkBoxShowMsnOnHeading.AutoSize = true; this.checkBoxShowMsnOnHeading.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.checkBoxShowMsnOnHeading.Location = new System.Drawing.Point(6, 99); + this.checkBoxShowMsnOnHeading.Location = new System.Drawing.Point(6, 93); this.checkBoxShowMsnOnHeading.Name = "checkBoxShowMsnOnHeading"; this.checkBoxShowMsnOnHeading.Size = new System.Drawing.Size(161, 17); this.checkBoxShowMsnOnHeading.TabIndex = 6; @@ -315,7 +380,7 @@ // buttonMSNsRemove // this.buttonMSNsRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonMSNsRemove.Location = new System.Drawing.Point(275, 72); + this.buttonMSNsRemove.Location = new System.Drawing.Point(492, 95); this.buttonMSNsRemove.Name = "buttonMSNsRemove"; this.buttonMSNsRemove.Size = new System.Drawing.Size(63, 21); this.buttonMSNsRemove.TabIndex = 5; @@ -327,7 +392,7 @@ // this.checkBoxFilterMSNs.AutoSize = true; this.checkBoxFilterMSNs.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.checkBoxFilterMSNs.Location = new System.Drawing.Point(6, 49); + this.checkBoxFilterMSNs.Location = new System.Drawing.Point(361, 43); this.checkBoxFilterMSNs.Name = "checkBoxFilterMSNs"; this.checkBoxFilterMSNs.Size = new System.Drawing.Size(194, 17); this.checkBoxFilterMSNs.TabIndex = 2; @@ -338,7 +403,7 @@ // buttonMSNsAdd // this.buttonMSNsAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonMSNsAdd.Location = new System.Drawing.Point(206, 72); + this.buttonMSNsAdd.Location = new System.Drawing.Point(423, 95); this.buttonMSNsAdd.Name = "buttonMSNsAdd"; this.buttonMSNsAdd.Size = new System.Drawing.Size(63, 21); this.buttonMSNsAdd.TabIndex = 4; @@ -352,9 +417,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.comboBoxMSNs.BorderColor = System.Drawing.Color.Empty; this.comboBoxMSNs.FormattingEnabled = true; - this.comboBoxMSNs.Location = new System.Drawing.Point(24, 72); + this.comboBoxMSNs.Location = new System.Drawing.Point(329, 68); this.comboBoxMSNs.Name = "comboBoxMSNs"; - this.comboBoxMSNs.Size = new System.Drawing.Size(176, 21); + this.comboBoxMSNs.Size = new System.Drawing.Size(226, 21); this.comboBoxMSNs.Sorted = true; this.comboBoxMSNs.TabIndex = 3; // @@ -398,7 +463,7 @@ this.groupBoxMedia.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.groupBoxMedia.Location = new System.Drawing.Point(6, 134); this.groupBoxMedia.Name = "groupBoxMedia"; - this.groupBoxMedia.Size = new System.Drawing.Size(511, 68); + this.groupBoxMedia.Size = new System.Drawing.Size(561, 68); this.groupBoxMedia.TabIndex = 1; this.groupBoxMedia.TabStop = false; this.groupBoxMedia.Text = "media settings"; @@ -440,11 +505,21 @@ this.tabPhonebook.Location = new System.Drawing.Point(4, 22); this.tabPhonebook.Name = "tabPhonebook"; this.tabPhonebook.Padding = new System.Windows.Forms.Padding(3); - this.tabPhonebook.Size = new System.Drawing.Size(523, 311); + this.tabPhonebook.Size = new System.Drawing.Size(573, 357); this.tabPhonebook.TabIndex = 2; this.tabPhonebook.Text = "Phonebook"; this.tabPhonebook.UseVisualStyleBackColor = true; // + // pictureBoxCaller + // + this.pictureBoxCaller.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBoxCaller.Location = new System.Drawing.Point(417, 38); + this.pictureBoxCaller.Name = "pictureBoxCaller"; + this.pictureBoxCaller.Size = new System.Drawing.Size(100, 122); + this.pictureBoxCaller.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBoxCaller.TabIndex = 13; + this.pictureBoxCaller.TabStop = false; + // // buttonCallerChange // this.buttonCallerChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -567,7 +642,7 @@ // labelVersion // this.labelVersion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.labelVersion.Location = new System.Drawing.Point(295, 356); + this.labelVersion.Location = new System.Drawing.Point(345, 402); this.labelVersion.Name = "labelVersion"; this.labelVersion.Size = new System.Drawing.Size(85, 25); this.labelVersion.TabIndex = 17; @@ -576,7 +651,7 @@ // buttonSave // this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonSave.Location = new System.Drawing.Point(386, 356); + this.buttonSave.Location = new System.Drawing.Point(436, 402); this.buttonSave.Name = "buttonSave"; this.buttonSave.Size = new System.Drawing.Size(75, 25); this.buttonSave.TabIndex = 15; @@ -587,7 +662,7 @@ // buttonCancel // this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonCancel.Location = new System.Drawing.Point(467, 356); + this.buttonCancel.Location = new System.Drawing.Point(517, 402); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 25); this.buttonCancel.TabIndex = 16; @@ -595,63 +670,11 @@ this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // - // pictureBox1 - // - this.pictureBox1.Image = global::FritzBox.Properties.Resources.FritzBox; - this.pictureBox1.Location = new System.Drawing.Point(6, 20); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(97, 99); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 2; - this.pictureBox1.TabStop = false; - // - // pictureBoxCaller - // - this.pictureBoxCaller.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBoxCaller.Location = new System.Drawing.Point(417, 38); - this.pictureBoxCaller.Name = "pictureBoxCaller"; - this.pictureBoxCaller.Size = new System.Drawing.Size(100, 122); - this.pictureBoxCaller.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBoxCaller.TabIndex = 13; - this.pictureBoxCaller.TabStop = false; - // - // upDownMaxNotifies - // - this.upDownMaxNotifies.Location = new System.Drawing.Point(465, 20); - this.upDownMaxNotifies.Maximum = new decimal(new int[] { - 20, - 0, - 0, - 0}); - this.upDownMaxNotifies.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.upDownMaxNotifies.Name = "upDownMaxNotifies"; - this.upDownMaxNotifies.Size = new System.Drawing.Size(40, 21); - this.upDownMaxNotifies.TabIndex = 7; - this.upDownMaxNotifies.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.upDownMaxNotifies.Value = new decimal(new int[] { - 20, - 0, - 0, - 0}); - // - // lblMaxNotifies - // - this.lblMaxNotifies.AutoSize = true; - this.lblMaxNotifies.Location = new System.Drawing.Point(365, 22); - this.lblMaxNotifies.Name = "lblMaxNotifies"; - this.lblMaxNotifies.Size = new System.Drawing.Size(94, 13); - this.lblMaxNotifies.TabIndex = 8; - this.lblMaxNotifies.Text = "maximum Notifies:"; - // // FritzBoxSetupFrom // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(552, 393); + this.ClientSize = new System.Drawing.Size(602, 439); this.Controls.Add(this.tabControlFritzBoxSettings); this.Controls.Add(this.labelVersion); this.Controls.Add(this.buttonSave); @@ -668,20 +691,21 @@ this.tabGeneral.PerformLayout(); this.mpGroupBox1.ResumeLayout(false); this.mpGroupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPort)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.tabIncoming.ResumeLayout(false); this.groupBoxPhonebook.ResumeLayout(false); this.groupBoxPhonebook.PerformLayout(); this.groupBoxNotify.ResumeLayout(false); this.groupBoxNotify.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxNotifies)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).EndInit(); this.groupBoxMedia.ResumeLayout(false); this.groupBoxMedia.PerformLayout(); this.tabPhonebook.ResumeLayout(false); this.tabPhonebook.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCaller)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.upDownMaxNotifies)).EndInit(); this.ResumeLayout(false); } @@ -694,7 +718,6 @@ private MediaPortal.UserInterface.Controls.MPGroupBox mpGroupBox1; private System.Windows.Forms.PictureBox pictureBox1; private MediaPortal.UserInterface.Controls.MPButton buttonTest; - private MediaPortal.UserInterface.Controls.MPTextBox textBoxPort; private MediaPortal.UserInterface.Controls.MPTextBox textBoxAddress; private MediaPortal.UserInterface.Controls.MPLabel labelPort; private MediaPortal.UserInterface.Controls.MPLabel labelAddress; @@ -733,7 +756,9 @@ private MediaPortal.UserInterface.Controls.MPButton buttonSave; private MediaPortal.UserInterface.Controls.MPButton buttonCancel; private System.Windows.Forms.OpenFileDialog openFileDialog; - private MediaPortal.UserInterface.Controls.MPNumericUpDown upDownMaxNotifies; + private MediaPortal.UserInterface.Controls.MPNumericUpDown numericUpDownMaxNotifies; private MediaPortal.UserInterface.Controls.MPLabel lblMaxNotifies; + private System.Windows.Forms.NumericUpDown numericUpDownPort; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBoxCloseOnConnectionClosed; } } \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-23 16:19:44 UTC (rev 609) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-24 07:22:08 UTC (rev 610) @@ -38,14 +38,18 @@ checkBoxExtensiveLogging.Checked = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); + Log.Info("1111111111111"); textBoxAddress.Text = xmlreader.GetValueAsString("fritzbox", "address", "fritz.box"); - textBoxPort.Text = xmlreader.GetValueAsString("fritzbox", "port", "1012"); + numericUpDownPort.Value = xmlreader.GetValueAsInt("fritzbox", "port", 1012); + Log.Info("22222222222222"); // notify settings - upDownMaxNotifies.Value = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); + numericUpDownMaxNotifies.Value = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); checkBoxCloseOnTimout.Checked = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); numericUpDownTimeout.Value = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); + checkBoxCloseOnConnectionClosed.Checked = xmlreader.GetValueAsBool("fritzbox", "closeOnConnectionClosed", true); + Log.Info("3333333333333333"); numericUpDownTimeout.Enabled = checkBoxCloseOnTimout.Checked; checkBoxFilterMSNs.Checked = xmlreader.GetValueAsBool("fritzbox", "filterMSNs", false); @@ -57,6 +61,7 @@ if (strMSN != "") comboBoxMSNs.Items.AddRange(strMSN.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries)); + Log.Info("444444444444444444"); checkBoxShowMsnOnHeading.Checked = xmlreader.GetValueAsBool("fritzbox", "showMsnOnHeading", false); // media settings @@ -86,12 +91,13 @@ xmlwriter.SetValueAsBool("fritzbox", "extensiveLogging", checkBoxExtensiveLogging.Checked); xmlwriter.SetValue("fritzbox", "address", textBoxAddress.Text); - xmlwriter.SetValue("fritzbox", "port", textBoxPort.Text); + xmlwriter.SetValue("fritzbox", "port", numericUpDownPort.Value); // notify settings - xmlwriter.SetValue("fritzbox", "maxNotifies", upDownMaxNotifies.Value); + xmlwriter.SetValue("fritzbox", "maxNotifies", numericUpDownMaxNotifies.Value); xmlwriter.SetValueAsBool("fritzbox", "closeOnTimeout", checkBoxCloseOnTimout.Checked); xmlwriter.SetValue("fritzbox", "timeout", numericUpDownTimeout.Value); + xmlwriter.SetValueAsBool("fritzbox", "closeOnConnectionClosed", checkBoxCloseOnConnectionClosed.Checked); xmlwriter.SetValueAsBool("fritzbox", "filterMSNs", checkBoxFilterMSNs.Checked); string strMSN = ""; @@ -149,7 +155,7 @@ { labelHelp.Text = "Please wait..."; Application.DoEvents(); - myClient = new TcpClient(textBoxAddress.Text, Int32.Parse(textBoxPort.Text)); + myClient = new TcpClient(textBoxAddress.Text, int.Parse(numericUpDownPort.Value.ToString())); } catch (Exception) { @@ -362,5 +368,10 @@ { SaveDataGridView(); } + + private void checkBoxCloseOnConnectionClosed_CheckedChanged(object sender, EventArgs e) + { + numericUpDownMaxNotifies.Enabled = !checkBoxCloseOnConnectionClosed.Checked; + } } } \ No newline at end of file Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs 2007-06-23 16:19:44 UTC (rev 609) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs 2007-06-24 07:22:08 UTC (rev 610) @@ -37,39 +37,27 @@ using System.Threading; using MediaPortal.GUI.Library; +using MediaPortal.Configuration; namespace FritzBox { - /// <summary> - /// FritzBoxWatch class - /// </summary> - public class FritzBoxWatch + /// <summary> + /// FritzBoxWatch class + /// </summary> + class FritzBoxWatch { - public delegate void EventHandler(string strLine); - static public event EventHandler FritzBoxAction = null; + public delegate void EventHandler(CallAction callAction); + public static event EventHandler FritzBoxAction = null; - bool stopThread = false; - + public static bool stopThread = false; public static string fritzBoxAddress; // address for the connected fritzbox - public static string fritzBoxPort; // port for the connected fritzbox - + public static int fritzBoxPort; // port for the connected fritzbox public static int maxNotifies = 20; public static int notifyCount = 0; - - public void Start() - { - Thread watchThread = new Thread(new ThreadStart(WatchThread)); - watchThread.Priority = ThreadPriority.BelowNormal; - watchThread.Name = "FRITZ!Box Monitoring"; - watchThread.Start(); - } - public void Stop() - { - stopThread = true; - } + static CallAction currentCallAction; - private void WatchThread() + public static void WatchThread() { try { @@ -82,7 +70,7 @@ // To close the port you can call: #96*4* // create a new connection to the FritzBox and listen to the TCP port - tcpClient = new TcpClient(fritzBoxAddress, Int32.Parse(fritzBoxPort)); + tcpClient = new TcpClient(fritzBoxAddress, fritzBoxPort); tcpClient.ReceiveBufferSize = 1; NetworkStream networkStream = tcpClient.GetStream(); @@ -98,11 +86,11 @@ } if (cChar == '\n') { - if (notifyCount < maxNotifies) - { - FritzBoxAction(strLine); - notifyCount++; - } + CallAction callAction = ParseAction(strLine); + currentCallAction = callAction; + Thread actionThread = new Thread(new ThreadStart(DoAction)); + actionThread.Name = "FRITZ!Box Monitoring"; + actionThread.Start(); strLine = ""; cChar = '\0'; } @@ -116,5 +104,84 @@ return; } } + + static CallAction ParseAction(string dataStream) + { + string[] strList; // splitted data + + dataStream = dataStream.Replace("\n", ""); + if (FritzBox._extensiveLogging) + Log.Info("received data: {0}", dataStream); + strList = dataStream.Split(';'); + + // data-stream can be in following format: + // incoming calls: DateTime;RING;ConnectionID;CallerID;MSN;??POTS??; + // outgoing calls: DateTime;CALL;ConnectionID;??Nebenstelle??;MSN;CallerID;??POTS??; + // connection started: DateTime;CONNECT;ConnectionID;??Nebenstelle??;CallerID; + // connection closed: DateTime;DISCONNECT;ConnectionID;ConnectedTime; + + // DateTime format: + // 12.12.06 12:12:12 + // dd.MM.yy hh:mm:ss + + CallAction callAction = new CallAction(); + + // time when action happens + callAction.time = DateTime.Parse(strList[0]); + + // set the type of the callAction + switch (strList[1]) + { + case "RING": + callAction.type = CallAction.CallType.Incoming; + // sets the callerID + callAction.caller.ID = strList[3]; + callAction.msn = strList[4]; + break; + case "CALL": + callAction.type = CallAction.CallType.Outgoing; + // sets the callerID + callAction.caller.ID = strList[5]; + callAction.msn = strList[4]; + break; + case "CONNECT": + callAction.type = CallAction.CallType.ConnectionStarted; + // sets the callerID + callAction.caller.ID = strList[4]; + break; + case "DISCONNECT": + callAction.type = CallAction.CallType.ConnectionClosed; + break; + } + + return callAction; + } + + static void DoAction() + { + FritzBoxAction(currentCallAction); + } + + public static void Stop() + { + stopThread = true; + } + + public static bool Test() + { + TcpClient TcpClient; + + try + { + TcpClient = new TcpClient(fritzBoxAddress, fritzBoxPort); + } + catch (Exception) + { + return false; + } + + TcpClient.Close(); + return true; + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-24 08:03:49
|
Revision: 613 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=613&view=rev Author: chef_koch Date: 2007-06-24 01:03:48 -0700 (Sun, 24 Jun 2007) Log Message: ----------- fixed small issues Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-24 07:29:01 UTC (rev 612) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-24 08:03:48 UTC (rev 613) @@ -319,6 +319,7 @@ switch (callAction.type) { case CallAction.CallType.Incoming: + callAction.caller = GetCallerFromPhonebook(callAction.caller); OnIncomingCall(callAction); break; case CallAction.CallType.Outgoing: @@ -433,7 +434,7 @@ return MediaPortal.Util.Utils.GetCoverArt(Thumbs.Yac, "_unknown"); else { - string strImage = MediaPortal.Util.Utils.GetCoverArtName(Thumbs.Yac, caller.ID); + string strImage = MediaPortal.Util.Utils.GetCoverArtName(Thumbs.Yac, caller.Name); // search image for caller if (_extensiveLogging) Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-24 07:29:01 UTC (rev 612) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2007-06-24 08:03:48 UTC (rev 613) @@ -38,18 +38,15 @@ checkBoxExtensiveLogging.Checked = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); - Log.Info("1111111111111"); textBoxAddress.Text = xmlreader.GetValueAsString("fritzbox", "address", "fritz.box"); numericUpDownPort.Value = xmlreader.GetValueAsInt("fritzbox", "port", 1012); - Log.Info("22222222222222"); // notify settings numericUpDownMaxNotifies.Value = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); checkBoxCloseOnTimout.Checked = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); numericUpDownTimeout.Value = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); checkBoxCloseOnConnectionClosed.Checked = xmlreader.GetValueAsBool("fritzbox", "closeOnConnectionClosed", true); - Log.Info("3333333333333333"); numericUpDownTimeout.Enabled = checkBoxCloseOnTimout.Checked; checkBoxFilterMSNs.Checked = xmlreader.GetValueAsBool("fritzbox", "filterMSNs", false); @@ -61,7 +58,6 @@ if (strMSN != "") comboBoxMSNs.Items.AddRange(strMSN.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries)); - Log.Info("444444444444444444"); checkBoxShowMsnOnHeading.Checked = xmlreader.GetValueAsBool("fritzbox", "showMsnOnHeading", false); // media settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-02-16 11:21:12
|
Revision: 1368 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1368&view=rev Author: chef_koch Date: 2008-02-16 03:21:06 -0800 (Sat, 16 Feb 2008) Log Message: ----------- many code changes - phoneBook is now it's own class - improved the Listening method, which is called now ReceiveThread Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/FritzBox.csproj trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs Added Paths: ----------- trunk/plugins/FritzBox/FritzBox/PhoneBook.cs Removed Paths: ------------- trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2008-02-15 23:57:37 UTC (rev 1367) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2008-02-16 11:21:06 UTC (rev 1368) @@ -37,278 +37,156 @@ using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Util; +using System.Text; namespace FritzBox { - /* - * Things to do: - * - add more comments to code - * - split code more in methods/classes - */ [PluginIcons("FritzBox.FritzBox.png", "FritzBox.FritzBoxDisabled.png")] public class FritzBox : ISetupForm, IPlugin { + #region Private Fields + + /// <summary> + /// networkstream to receive data, sent by fritzbox + /// </summary> + private NetworkStream networkStream; + + /// <summary> + /// address for the connected fritzbox + /// </summary> + private string fritzBoxAddress; + + /// <summary> + /// port for the connected fritzbox + /// </summary> + private int fritzBoxPort; + + /// <summary> + /// indicates whether listing is enabled or not + /// </summary> + private bool stopThread; + + #endregion + #region Variables - public const string _version = "0.2.2.8"; + public const string _version = "0.2.2.9"; public static int _lastVersion = 0; - public static bool _extensiveLogging = false; + static bool _extensiveLogging = false; - private bool _fritzBoxDisabled = false; - List<CallAction> actionList = new List<CallAction>(); object tempNotify = null; // notify settings - private int _timeout = -1; // autoclose the dialog after the timeout expired - private bool _closeOnTimeout = false; - private bool _closeOnConnectionClosed = false; + int _timeout = -1; // autoclose the dialog after the timeout expired + bool _closeOnTimeout = false; + bool _closeOnConnectionClosed = false; - public static bool _filterMSNs = false; - public static List<String> _msnList = new List<String>(); + bool _filterMSNs = false; + List<String> _msnList = new List<String>(); - public static bool _showMsnOnHeading = false; + bool _showMsnOnHeading = false; + + private bool _usePhonebook = true; + private PhoneBook phoneBook; + int maxNotifies = 20; + int notifyCount = 0; + // media settings - private bool _stopMedia = true; // stop media when an event happend - private bool _resumeMedia = true; // resume media when notify is closed + bool _stopMedia = true; // stop media when an event happend + bool _resumeMedia = true; // resume media when notify is closed - private bool _showNotify = true; - private List<CallAction> notifyQueue = new List<CallAction>(); + bool _showNotify = true; + List<CallAction> notifyQueue = new List<CallAction>(); - // phonebook settings - public static bool _usePhonebook = true; - public static bool _showUnknownCaller = true; - public static bool _saveUnknownCaller = true; - - public static List<Caller> phonebook = new List<Caller>(); - #endregion - #region Constructors/Destructors + #region Constructors and Destructors + /// <summary> + /// constructor + /// </summary> public FritzBox() { + ReceivedData += new ReceivedDataEventHandler(FritzBox_ReceivedData); } + /// <summary> + /// Destructor. + /// </summary> + ~FritzBox() { } + #endregion - #region Settings + #region Public Events and Delegates - private void LoadSettings() - { - char[] charSeparators = new char[] { ';' }; + public delegate void ReceivedDataEventHandler(object sender, EventArgs e); + public event ReceivedDataEventHandler ReceivedData; - if (_extensiveLogging) - Log.Info("FRITZ!Box: LoadSettings"); + #endregion - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - _lastVersion = xmlreader.GetValueAsInt("fritzbox", "lastVersion", 0); + #region Private Functions/Methods - FritzBoxWatch.fritzBoxAddress = xmlreader.GetValueAsString("fritzbox", "address", "fritz.box"); - FritzBoxWatch.fritzBoxPort = xmlreader.GetValueAsInt("fritzbox", "port", 1012); - - _extensiveLogging = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); - - // notify settings - FritzBoxWatch.maxNotifies = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); - _closeOnTimeout = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); - _timeout = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); - _closeOnConnectionClosed = xmlreader.GetValueAsBool("fritzbox", "closeOnConnectionClosed", true); - - if ((!_closeOnTimeout) || (_timeout == 0)) - _timeout = -1; - - _filterMSNs = xmlreader.GetValueAsBool("fritzbox", "filterMSNs", false); - string strMSN = xmlreader.GetValueAsString("fritzbox", "MSN", ""); - _msnList.AddRange(strMSN.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries)); - - if (_extensiveLogging) - Log.Debug("FRITZ!Box: MSNs loaded: {0}", strMSN); - - _showMsnOnHeading = xmlreader.GetValueAsBool("fritzbox", "showMsnOnHeading", false); - - // media settings - _stopMedia = xmlreader.GetValueAsBool("fritzbox", "stopMedia", true); - _resumeMedia = xmlreader.GetValueAsBool("fritzbox", "resumeMedia", true); - - // phonebook settings - _usePhonebook = xmlreader.GetValueAsBool("fritzbox", "usePhonebook", true); - _showUnknownCaller = xmlreader.GetValueAsBool("fritzbox", "showUnknownCaller", true); - _saveUnknownCaller = xmlreader.GetValueAsBool("fritzbox", "saveUnknownCaller", true); - - if (_extensiveLogging) - { - Log.Info("FRITZ!Box: closeOnTimeout = {0}", _closeOnTimeout.ToString()); - Log.Info("FRITZ!Box: timeout = {0}", _timeout.ToString()); - Log.Info("FRITZ!Box: showMsnOnHeading = {0}", _showMsnOnHeading.ToString()); - //Log.Info("FRITZ!Box: maxNotifies = {0}", FritzBoxWatch.maxNotifies.ToString()); - - Log.Info("FRITZ!Box: stopMedia = {0}", _stopMedia.ToString()); - Log.Info("FRITZ!Box: resumeMedia = {0}", _resumeMedia.ToString()); - - Log.Info("FRITZ!Box: usePhonebook = {0}", _usePhonebook.ToString()); - Log.Info("FRITZ!Box: showUnknownCaller = {0}", _showUnknownCaller.ToString()); - Log.Info("FRITZ!Box: saveUnknownCaller = {0}", _saveUnknownCaller.ToString()); - } - } - - LoadPhonebook(); - } - - private void SaveSettings() + private void ReceiveThread() { - if (_extensiveLogging) - Log.Info("FRITZ!Box: SaveSettings"); - - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + while (!stopThread) { - xmlwriter.SetValue("fritzbox", "lastVersion", _version.Replace(".", string.Empty)); + System.Threading.Thread.Sleep(100); + if (this.networkStream.DataAvailable) + if (ReceivedData != null) + ReceivedData(this, new EventArgs()); } - - SavePhonebook(); } - #endregion - - #region Phonebook - - public static void LoadPhonebook() + void FritzBox_ReceivedData(object sender, EventArgs e) { - if ((_lastVersion < 0220) && (!File.Exists(Config.GetFile(Config.Dir.Config, "fritzbox.xml")))) - { - UpdateTo0220(); - return; - } + byte[] myReadBuffer = new byte[1024]; + StringBuilder myCompleteMessage = new StringBuilder(); + int numberOfBytesRead = 0; - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "fritzbox.xml"))) + // Incoming message may be larger than the buffer size. + do { - int countCaller = xmlreader.GetValueAsInt("phonebook", "count", 0); + numberOfBytesRead = networkStream.Read(myReadBuffer, 0, myReadBuffer.Length); - for (int i = 0; i < countCaller; i++) - { - Caller caller = new Caller(); - - caller.ID = xmlreader.GetValueAsString("phonebook", string.Format("callerID{0}", i.ToString()), ""); - caller.Name = xmlreader.GetValueAsString("phonebook", string.Format("name{0}", i.ToString()), ""); - caller.Show = xmlreader.GetValueAsBool("phonebook", string.Format("show{0}", i.ToString()), false); - - phonebook.Add(caller); - - if (_extensiveLogging) - Log.Debug("FRITZ!Box: caller loaded: {0} {1} {2}", caller.ID, caller.Name, caller.Show); - } + myCompleteMessage.AppendFormat("{0}", Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead)); } + while (networkStream.DataAvailable); + if (_extensiveLogging) - Log.Debug("FRITZ!Box: imported {0} callers", phonebook.Count.ToString()); + Log.Info("received data: {0}", myCompleteMessage.ToString()); + CallAction callAction = ParseAction(myCompleteMessage.ToString()); + if (_extensiveLogging) + callAction.WriteToLog(); + + OnCallAction(callAction); } - public static void SavePhonebook() + void OnStartExternal(Process proc, bool waitForExit) { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "fritzbox.xml"))) + if (waitForExit) { - xmlwriter.SetValue("phonebook", "count", phonebook.Count); - - for (int i = 0; i < phonebook.Count; i++) - { - Caller caller = phonebook[i]; - - xmlwriter.SetValue("phonebook", string.Format("callerID{0}", i.ToString()), caller.ID); - xmlwriter.SetValue("phonebook", string.Format("name{0}", i.ToString()), caller.Name); - xmlwriter.SetValueAsBool("phonebook", string.Format("show{0}", i.ToString()), caller.Show); - } + _showNotify = false; } - } - - public static void UpdateTo0220() - { - char[] charSeparators = new char[] { ';' }; - - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + else { - string[] strLCallerId = xmlreader.GetValueAsString("fritzbox", "phonebookCallerId", "").Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); - string[] strLName = xmlreader.GetValueAsString("fritzbox", "phonebookName", "").Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); - string[] strLShow = xmlreader.GetValueAsString("fritzbox", "phonebookShow", "").Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); - - for (int i = 0; i <= strLCallerId.GetUpperBound(0); i++) - { - Caller caller = new Caller(strLCallerId[i], strLName[i], bool.Parse(strLShow[i])); - phonebook.Add(caller); - - if (_extensiveLogging) - Log.Debug("FRITZ!Box: caller loaded: {0} {1} {2}", caller.ID, caller.Name, caller.Show); - } + _showNotify = true; } } - - public static int ImportFritzBoxMonitor(string filepath) + void OnStopExternal(Process proc, bool waitForExit) { - try - { - int count = 0; + _showNotify = true; - // Create an instance of StreamReader to read from a file. - // The using statement also closes the StreamReader. - using (StreamReader sr = new StreamReader(filepath)) - { - string line; - // Read and display lines from the file until the end of - // the file is reached. - while ((line = sr.ReadLine()) != null) - { - if ( (count == 0) && line.Contains("sep=;") ) - continue; - if ( (count == 0) && line.Contains("Telefonnummer")) - continue; + //for (int i = 0; i < notifyQueue.Count; i++) + // OnFritzBoxEvent(notifyQueue[i]); - string[] ar = line.Split(char.Parse(";")); - - ar[0] = ar[0].TrimStart('!'); - ar[1] = ar[1].TrimStart('!'); - - Caller caller = new Caller(); - - caller.ID = ar[2]; - caller.Name = string.Format("{0} {1}", ar[0], ar[1]); - caller.Name = caller.Name.Trim(); - caller.Show = true; - - if (CallerExists(caller)) continue; - - phonebook.Add(caller); - count++; - } - } - - return count; - } - catch (Exception e) - { - // Let the user know what went wrong. - Log.Error("The file could not be read: {0}", e.Message); - return 0; - } + notifyQueue.Clear(); } - public static bool CallerExists(Caller caller) - { - for (int i = 0; i < phonebook.Count; i++) - { - if (phonebook[i].ID == caller.ID) - return true; - } - return false; - } - #endregion - - #region FritzBoxActions - - public void OnCallAction(CallAction callAction) + void OnCallAction(CallAction callAction) { - LogAction(callAction); - if (!_showNotify) { Log.Info("External process is running. Notify is queued and will be shown later."); @@ -319,7 +197,7 @@ switch (callAction.type) { case CallAction.CallType.Incoming: - callAction.caller = GetCallerFromPhonebook(callAction.caller); + callAction.caller = phoneBook.GetCaller(callAction.caller); OnIncomingCall(callAction); break; case CallAction.CallType.Outgoing: @@ -347,7 +225,7 @@ if (tempNotify != null) { Log.Info("yet another dialog is active. action is sent to queue."); - if (actionList.Count < FritzBoxWatch.maxNotifies - 1) + if (actionList.Count < maxNotifies - 1) actionList.Add(callAction); return; } @@ -356,7 +234,7 @@ string strHeading = String.Empty; string strImage = String.Empty; string strText = String.Empty; - + // Set Heading for NotifyDialog if (_showMsnOnHeading) strHeading = GUILocalizeStrings.Get(1023) + " on " + callAction.msn; // ???? Incoming call on @@ -365,7 +243,7 @@ // Set Image for NotifyDialog strImage = GetCallerImage(callAction.caller); - + // Set MessageText for NotifyDialog if (callAction.caller.ID == "") strText = GUILocalizeStrings.Get(2014); // 2014 = unknown @@ -375,7 +253,7 @@ strText = callAction.caller.Name; //config settings for dialog FINISHED - + //if msn is disabled, stop here if (!IsMsnEnabled(callAction.msn)) return; @@ -387,47 +265,143 @@ #endregion - #region Helper Methods + #region Settings - Caller GetCallerFromPhonebook(Caller caller) + private void LoadSettings() { - if (caller.ID == "") return caller; + char[] charSeparators = new char[] { ';' }; - if (phonebook.Count == 0) + if (_extensiveLogging) + Log.Info("FRITZ!Box: LoadSettings"); + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - Log.Info("Phonebook is empty. Caller is added to the phonebook."); - phonebook.Add(caller); - } - else - { - bool foundCaller = false; - for (int i = 0; i < phonebook.Count; i++) + _lastVersion = xmlreader.GetValueAsInt("fritzbox", "lastVersion", 0); + + fritzBoxAddress = xmlreader.GetValueAsString("fritzbox", "address", "fritz.box"); + fritzBoxPort = xmlreader.GetValueAsInt("fritzbox", "port", 1012); + + _extensiveLogging = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); + + // notify settings + maxNotifies = xmlreader.GetValueAsInt("fritzbox", "maxNotifies", 20); + _closeOnTimeout = xmlreader.GetValueAsBool("fritzbox", "closeOnTimeout", false); + _timeout = xmlreader.GetValueAsInt("fritzbox", "timeout", 10); + _closeOnConnectionClosed = xmlreader.GetValueAsBool("fritzbox", "closeOnConnectionClosed", true); + + if ((!_closeOnTimeout) || (_timeout == 0)) + _timeout = -1; + + _filterMSNs = xmlreader.GetValueAsBool("fritzbox", "filterMSNs", false); + string strMSN = xmlreader.GetValueAsString("fritzbox", "MSN", ""); + _msnList.AddRange(strMSN.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries)); + + if (_extensiveLogging) + Log.Debug("FRITZ!Box: MSNs loaded: {0}", strMSN); + + _showMsnOnHeading = xmlreader.GetValueAsBool("fritzbox", "showMsnOnHeading", false); + + // media settings + _stopMedia = xmlreader.GetValueAsBool("fritzbox", "stopMedia", true); + _resumeMedia = xmlreader.GetValueAsBool("fritzbox", "resumeMedia", true); + + // phonebook settings + _usePhonebook = xmlreader.GetValueAsBool("fritzbox", "usePhonebook", true); + if (_usePhonebook) { - Caller tempCaller = phonebook[i]; - if (tempCaller.ID == caller.ID) - { - Log.Info("Caller is identified by phonebook as {0}.", tempCaller.Name); - caller = tempCaller; - foundCaller = true; - } - if (foundCaller) break; + phoneBook = new PhoneBook(); + phoneBook.LoadSettings(); } - if (!foundCaller) + if (_extensiveLogging) { - if (_showUnknownCaller) - caller.Show = true; - else - caller.Show = false; + Log.Info("FRITZ!Box: closeOnTimeout = {0}", _closeOnTimeout.ToString()); + Log.Info("FRITZ!Box: timeout = {0}", _timeout.ToString()); + Log.Info("FRITZ!Box: showMsnOnHeading = {0}", _showMsnOnHeading.ToString()); + //Log.Info("FRITZ!Box: maxNotifies = {0}", FritzBoxWatch.maxNotifies.ToString()); - if (FritzBox._saveUnknownCaller) - phonebook.Add(caller); + Log.Info("FRITZ!Box: stopMedia = {0}", _stopMedia.ToString()); + Log.Info("FRITZ!Box: resumeMedia = {0}", _resumeMedia.ToString()); + + Log.Info("FRITZ!Box: usePhonebook = {0}", _usePhonebook.ToString()); + if (_usePhonebook) + { + Log.Info("FRITZ!Box: showUnknownCaller = {0}", phoneBook.ShowUnknownCaller.ToString()); + Log.Info("FRITZ!Box: saveUnknownCaller = {0}", phoneBook.SaveUnknownCaller.ToString()); + } } } + } - return caller; + private void SaveSettings() + { + if (_extensiveLogging) + Log.Info("FRITZ!Box: SaveSettings"); + + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValue("fritzbox", "lastVersion", _version.Replace(".", string.Empty)); + } + + phoneBook.SaveSettings(); } + #endregion + + #region Helper Methods + + CallAction ParseAction(string dataStream) + { + string[] strList; // splitted data + + dataStream = dataStream.Replace("\n", ""); + if (FritzBox._extensiveLogging) + Log.Info("received data: {0}", dataStream); + strList = dataStream.Split(';'); + + // data-stream can be in following format: + // incoming calls: DateTime;RING;ConnectionID;CallerID;MSN;??POTS??; + // outgoing calls: DateTime;CALL;ConnectionID;??Nebenstelle??;MSN;CallerID;??POTS??; + // connection started: DateTime;CONNECT;ConnectionID;??Nebenstelle??;CallerID; + // connection closed: DateTime;DISCONNECT;ConnectionID;ConnectedTime; + + // DateTime format: + // 12.12.06 12:12:12 + // dd.MM.yy hh:mm:ss + + CallAction callAction = new CallAction(); + + // time when action happens + callAction.time = DateTime.Parse(strList[0]); + + // set the type of the callAction + switch (strList[1]) + { + case "RING": + callAction.type = CallAction.CallType.Incoming; + // sets the callerID + callAction.caller.ID = strList[3]; + callAction.msn = strList[4]; + break; + case "CALL": + callAction.type = CallAction.CallType.Outgoing; + // sets the callerID + callAction.caller.ID = strList[5]; + callAction.msn = strList[4]; + break; + case "CONNECT": + callAction.type = CallAction.CallType.ConnectionStarted; + // sets the callerID + callAction.caller.ID = strList[4]; + break; + case "DISCONNECT": + callAction.type = CallAction.CallType.ConnectionClosed; + break; + } + + return callAction; + } + string GetCallerImage(Caller caller) { if (caller.ID == "") @@ -490,7 +464,7 @@ void ShowNotify(string strHeading, string strImage, string strText) { - if (FritzBoxWatch.notifyCount >= FritzBoxWatch.maxNotifies) return; + if (notifyCount >= maxNotifies) return; //show dialog if (g_Player.Playing && !g_Player.Paused && _stopMedia) @@ -521,42 +495,21 @@ } } - public void LogAction(CallAction action) + bool TestConnection() { - Log.Info("CallAction Info:"); - Log.Info(" CallType: {0}", action.type.ToString()); - Log.Info(" Date: {0}", action.time.ToShortDateString()); - Log.Info(" Time: {0}", action.time.ToShortTimeString()); - if (_extensiveLogging) - { - Log.Info(" Caller: {0}", action.caller.ID); - Log.Info(" MSN: {0}", action.msn); - } - } + TcpClient TcpClient; - #endregion - - #region ExternalProcess Actions - - public void OnStartExternal(Process proc, bool waitForExit) - { - if (waitForExit) + try { - _showNotify = false; + TcpClient = new TcpClient(fritzBoxAddress, fritzBoxPort); } - else + catch (Exception) { - _showNotify = true; + return false; } - } - public void OnStopExternal(Process proc, bool waitForExit) - { - _showNotify = true; - //for (int i = 0; i < notifyQueue.Count; i++) - // OnFritzBoxEvent(notifyQueue[i]); - - notifyQueue.Clear(); + TcpClient.Close(); + return true; } #endregion @@ -574,13 +527,24 @@ LoadSettings(); Utils.OnStartExternal += new Utils.UtilEventHandler(OnStartExternal); - Utils.OnStopExternal += new Utils.UtilEventHandler(OnStopExternal); - - FritzBoxWatch.FritzBoxAction += new FritzBoxWatch.EventHandler(OnCallAction); - Thread FBWatchThread = new Thread(new ThreadStart(FritzBoxWatch.WatchThread)); - FBWatchThread.Priority = ThreadPriority.BelowNormal; - FBWatchThread.Name = "FRITZ!Box Monitoring"; - FBWatchThread.Start(); + Utils.OnStopExternal += new Utils.UtilEventHandler(OnStopExternal); + + TcpClient tcpClient; + // To get the calling informations, the port 1012 on the FRITZBox have to be opened. + // You can open the port with you phone by calling: #96*5* + // To close the port you can call: #96*4* + + // create a new connection to the FritzBox and listen to the TCP port + tcpClient = new TcpClient(fritzBoxAddress, fritzBoxPort); + + tcpClient.ReceiveBufferSize = 1; + networkStream = tcpClient.GetStream(); + + + Thread FBReceiveThread = new Thread(new ThreadStart(ReceiveThread)); + FBReceiveThread.Priority = ThreadPriority.BelowNormal; + FBReceiveThread.Name = "FRITZ!Box Monitoring"; + FBReceiveThread.Start(); } /// <summary> @@ -588,9 +552,11 @@ /// </summary> public void Stop() { - if (!_fritzBoxDisabled) - FritzBoxWatch.Stop(); + stopThread = true; + Utils.OnStartExternal -= new Utils.UtilEventHandler(OnStartExternal); + Utils.OnStopExternal -= new Utils.UtilEventHandler(OnStopExternal); + SaveSettings(); } Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.csproj =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2008-02-15 23:57:37 UTC (rev 1367) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.csproj 2008-02-16 11:21:06 UTC (rev 1368) @@ -78,7 +78,7 @@ <DependentUpon>FritzBoxSetupFrom.cs</DependentUpon> </Compile> <Compile Include="FritzBox.cs" /> - <Compile Include="FritzBoxWatch.cs" /> + <Compile Include="PhoneBook.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> Modified: trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2008-02-15 23:57:37 UTC (rev 1367) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxSetupFrom.cs 2008-02-16 11:21:06 UTC (rev 1368) @@ -19,6 +19,8 @@ { public partial class FritzBoxSetupFrom : Form { + PhoneBook phoneBook; + public FritzBoxSetupFrom() { InitializeComponent(); @@ -66,14 +68,15 @@ // phonebook settings checkBoxUsePhonebook.Checked = xmlreader.GetValueAsBool("fritzbox", "usePhonebook", true); - checkBoxShowUnknownCaller.Checked = xmlreader.GetValueAsBool("fritzbox", "showUnknownCaller", true); - checkBoxSaveUnknownCaller.Checked = xmlreader.GetValueAsBool("fritzbox", "saveUnknownCaller", true); + phoneBook = new PhoneBook(); + phoneBook.LoadSettings(); + checkBoxShowUnknownCaller.Checked = phoneBook.ShowUnknownCaller; + checkBoxSaveUnknownCaller.Checked = phoneBook.SaveUnknownCaller; checkBoxShowUnknownCaller.Enabled = checkBoxUsePhonebook.Checked; checkBoxSaveUnknownCaller.Enabled = checkBoxUsePhonebook.Checked; } - FritzBox.LoadPhonebook(); RefreshDataGridView(); } @@ -111,12 +114,12 @@ // phonebook settings xmlwriter.SetValueAsBool("fritzbox", "usePhonebook", checkBoxUsePhonebook.Checked); - xmlwriter.SetValueAsBool("fritzbox", "showUnknownCaller", checkBoxShowUnknownCaller.Checked); - xmlwriter.SetValueAsBool("fritzbox", "saveUnknownCaller", checkBoxSaveUnknownCaller.Checked); + phoneBook.ShowUnknownCaller = checkBoxShowUnknownCaller.Checked; + phoneBook.SaveUnknownCaller = checkBoxSaveUnknownCaller.Checked; } SaveDataGridView(); - FritzBox.SavePhonebook(); + phoneBook.SaveSettings(); } @@ -327,7 +330,7 @@ { if (openFileDialog.ShowDialog() == DialogResult.OK) { - int count = FritzBox.ImportFritzBoxMonitor(openFileDialog.FileName); + int count = phoneBook.ImportFritzBoxMonitor(openFileDialog.FileName); RefreshDataGridView(); MessageBox.Show("Import done!\nAdded " + count.ToString() + " new CallerIDs to phonebook."); @@ -338,15 +341,15 @@ { dataGridView.Rows.Clear(); - for (int i = 0; i < FritzBox.phonebook.Count; i++) + for (int i = 0; i < phoneBook.Contacts.Count; i++) { - dataGridView.Rows.Add(FritzBox.phonebook[i].ID, FritzBox.phonebook[i].Name, FritzBox.phonebook[i].Show); + dataGridView.Rows.Add(phoneBook.Contacts[i].ID, phoneBook.Contacts[i].Name, phoneBook.Contacts[i].Show); } } private void SaveDataGridView() { - FritzBox.phonebook.Clear(); + phoneBook.Contacts.Clear(); for (int i = 0; i < dataGridView.RowCount - 1; i++) { @@ -356,7 +359,7 @@ caller.Name = dataGridView.Rows[i].Cells[1].Value.ToString(); caller.Show = bool.Parse(dataGridView.Rows[i].Cells[2].Value.ToString()); - FritzBox.phonebook.Add(caller); + phoneBook.Contacts.Add(caller); } } Deleted: trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs 2008-02-15 23:57:37 UTC (rev 1367) +++ trunk/plugins/FritzBox/FritzBox/FritzBoxWatch.cs 2008-02-16 11:21:06 UTC (rev 1368) @@ -1,187 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 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.Windows.Forms; -using System.Collections; -using System.Drawing.Design; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.IO; -using System.ComponentModel; -using System.Security.Cryptography; -using System.Windows.Forms.Design; -using System.Threading; - -using MediaPortal.GUI.Library; -using MediaPortal.Configuration; - -namespace FritzBox -{ - /// <summary> - /// FritzBoxWatch class - /// </summary> - class FritzBoxWatch - { - public delegate void EventHandler(CallAction callAction); - public static event EventHandler FritzBoxAction = null; - - public static bool stopThread = false; - public static string fritzBoxAddress; // address for the connected fritzbox - public static int fritzBoxPort; // port for the connected fritzbox - public static int maxNotifies = 20; - public static int notifyCount = 0; - - static CallAction currentCallAction; - - public static void WatchThread() - { - try - { - TcpClient tcpClient; - char cChar = '\0'; // latest received byte of NetworkStream - string strLine = ""; // received data - - // To get the calling informations, the port 1012 on the FRITZBox have to be opened. - // You can open the port with you phone by calling: #96*5* - // To close the port you can call: #96*4* - - // create a new connection to the FritzBox and listen to the TCP port - tcpClient = new TcpClient(fritzBoxAddress, fritzBoxPort); - - tcpClient.ReceiveBufferSize = 1; - NetworkStream networkStream = tcpClient.GetStream(); - networkStream.ReadTimeout = 1000; - - while (!stopThread) - { - if (networkStream.DataAvailable) - { - cChar = (char)networkStream.ReadByte(); - strLine += cChar; - - } - if (cChar == '\n') - { - CallAction callAction = ParseAction(strLine); - currentCallAction = callAction; - Thread actionThread = new Thread(new ThreadStart(DoAction)); - actionThread.Name = "FRITZ!Box Monitoring"; - actionThread.Start(); - strLine = ""; - cChar = '\0'; - } - Thread.Sleep(1); - } - - } - catch (Exception ex) - { - Log.Error("error: {0}", ex); - return; - } - } - - static CallAction ParseAction(string dataStream) - { - string[] strList; // splitted data - - dataStream = dataStream.Replace("\n", ""); - if (FritzBox._extensiveLogging) - Log.Info("received data: {0}", dataStream); - strList = dataStream.Split(';'); - - // data-stream can be in following format: - // incoming calls: DateTime;RING;ConnectionID;CallerID;MSN;??POTS??; - // outgoing calls: DateTime;CALL;ConnectionID;??Nebenstelle??;MSN;CallerID;??POTS??; - // connection started: DateTime;CONNECT;ConnectionID;??Nebenstelle??;CallerID; - // connection closed: DateTime;DISCONNECT;ConnectionID;ConnectedTime; - - // DateTime format: - // 12.12.06 12:12:12 - // dd.MM.yy hh:mm:ss - - CallAction callAction = new CallAction(); - - // time when action happens - callAction.time = DateTime.Parse(strList[0]); - - // set the type of the callAction - switch (strList[1]) - { - case "RING": - callAction.type = CallAction.CallType.Incoming; - // sets the callerID - callAction.caller.ID = strList[3]; - callAction.msn = strList[4]; - break; - case "CALL": - callAction.type = CallAction.CallType.Outgoing; - // sets the callerID - callAction.caller.ID = strList[5]; - callAction.msn = strList[4]; - break; - case "CONNECT": - callAction.type = CallAction.CallType.ConnectionStarted; - // sets the callerID - callAction.caller.ID = strList[4]; - break; - case "DISCONNECT": - callAction.type = CallAction.CallType.ConnectionClosed; - break; - } - - return callAction; - } - - static void DoAction() - { - FritzBoxAction(currentCallAction); - } - - public static void Stop() - { - stopThread = true; - } - - public static bool Test() - { - TcpClient TcpClient; - - try - { - TcpClient = new TcpClient(fritzBoxAddress, fritzBoxPort); - } - catch (Exception) - { - return false; - } - - TcpClient.Close(); - return true; - } - } -} \ No newline at end of file Added: trunk/plugins/FritzBox/FritzBox/PhoneBook.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/PhoneBook.cs (rev 0) +++ trunk/plugins/FritzBox/FritzBox/PhoneBook.cs 2008-02-16 11:21:06 UTC (rev 1368) @@ -0,0 +1,269 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 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.Text; + + +using MediaPortal.Configuration; +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Util; +using System.Text; +using System.IO; + +namespace FritzBox +{ + public class PhoneBook + { + #region variables + + List<Caller> _contacts; + + // phonebook settings + bool _showUnknownCaller; + bool _saveUnknownCaller; + + bool _extensiveLogging; + + #endregion + + #region public properties + + public bool ShowUnknownCaller + { + get { return _showUnknownCaller; } + set { _showUnknownCaller = value; } + } + + public bool SaveUnknownCaller + { + get { return _saveUnknownCaller; } + set { _saveUnknownCaller = value; } + } + + public List<Caller> Contacts + { + get { return _contacts; } + set { _contacts = value; } + } + + #endregion + + #region private methods + + void UpdateTo0220() + { + char[] charSeparators = new char[] { ';' }; + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + string[] strLCallerId = xmlreader.GetValueAsString("fritzbox", "phonebookCallerId", "").Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); + string[] strLName = xmlreader.GetValueAsString("fritzbox", "phonebookName", "").Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); + string[] strLShow = xmlreader.GetValueAsString("fritzbox", "phonebookShow", "").Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); + + for (int i = 0; i <= strLCallerId.GetUpperBound(0); i++) + { + Caller caller = new Caller(strLCallerId[i], strLName[i], bool.Parse(strLShow[i])); + _contacts.Add(caller); + + if (_extensiveLogging) + Log.Debug("FRITZ!Box: caller loaded: {0} {1} {2}", caller.ID, caller.Name, caller.Show); + } + } + } + + #endregion + + #region public methods + + public void LoadSettings() + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + _extensiveLogging = xmlreader.GetValueAsBool("fritzbox", "extensiveLogging", false); + + _showUnknownCaller = xmlreader.GetValueAsBool("fritzbox", "showUnknownCaller", true); + _saveUnknownCaller = xmlreader.GetValueAsBool("fritzbox", "saveUnknownCaller", true); + } + + + _contacts = new List<Caller>(); + + if ((FritzBox._lastVersion < 0220) && (!File.Exists(Config.GetFile(Config.Dir.Config, "fritzbox.xml")))) + { + UpdateTo0220(); + return; + } + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "fritzbox.xml"))) + { + int countCaller = xmlreader.GetValueAsInt("phonebook", "count", 0); + + for (int i = 0; i < countCaller; i++) + { + Caller caller = new Caller(); + + caller.ID = xmlreader.GetValueAsString("phonebook", string.Format("callerID{0}", i.ToString()), ""); + caller.Name = xmlreader.GetValueAsString("phonebook", string.Format("name{0}", i.ToString()), ""); + caller.Show = xmlreader.GetValueAsBool("phonebook", string.Format("show{0}", i.ToString()), false); + + _contacts.Add(caller); + + if (_extensiveLogging) + Log.Debug("FRITZ!Box: caller loaded: {0} {1} {2}", caller.ID, caller.Name, caller.Show); + } + } + if (_extensiveLogging) + Log.Debug("FRITZ!Box: imported {0} callers", _contacts.Count.ToString()); + } + + public void SaveSettings() + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlreader.SetValueAsBool("fritzbox", "showUnknownCaller", _showUnknownCaller); + xmlreader.SetValueAsBool("fritzbox", "saveUnknownCaller", _saveUnknownCaller); + } + + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "fritzbox.xml"))) + { + xmlwriter.SetValue("phonebook", "count", _contacts.Count); + + for (int i = 0; i < _contacts.Count; i++) + { + Caller caller = _contacts[i]; + + xmlwriter.SetValue("phonebook", string.Format("callerID{0}", i.ToString()), caller.ID); + xmlwriter.SetValue("phonebook", string.Format("name{0}", i.ToString()), caller.Name); + xmlwriter.SetValueAsBool("phonebook", string.Format("show{0}", i.ToString()), caller.Show); + } + } + } + + + public int ImportFritzBoxMonitor(string filepath) + { + try + { + int count = 0; + + // Create an instance of StreamReader to read from a file. + // The using statement also closes the StreamReader. + using (StreamReader sr = new StreamReader(filepath)) + { + string line; + // Read and display lines from the file until the end of + // the file is reached. + while ((line = sr.ReadLine()) != null) + { + if ((count == 0) && line.Contains("sep=;")) + continue; + if ((count == 0) && line.Contains("Telefonnummer")) + continue; + + string[] ar = line.Split(char.Parse(";")); + + ar[0] = ar[0].TrimStart('!'); + ar[1] = ar[1].TrimStart('!'); + + Caller caller = new Caller(); + + caller.ID = ar[2]; + caller.Name = string.Format("{0} {1}", ar[0], ar[1]); + caller.Name = caller.Name.Trim(); + caller.Show = true; + + if (CallerExists(caller)) continue; + + _contacts.Add(caller); + count++; + } + } + + return count; + } + catch (Exception e) + { + // Let the user know what went wrong. + Log.Error("The file could not be read: {0}", e.Message); + return 0; + } + } + + public bool CallerExists(Caller caller) + { + for (int i = 0; i < _contacts.Count; i++) + { + if (_contacts[i].ID == caller.ID) + return true; + } + return false; + } + + public Caller GetCaller(Caller caller) + { + if (caller.ID == "") return caller; + + if (_contacts.Count == 0) + { + Log.Info("Phonebook is empty. Caller is added to the phonebook."); + _contacts.Add(caller); + } + else + { + bool foundCaller = false; + for (int i = 0; i < _contacts.Count; i++) + { + Caller tempCaller = _contacts[i]; + if (tempCaller.ID == caller.ID) + { + Log.Info("Caller is identified by phonebook as {0}.", tempCaller.Name); + caller = tempCaller; + foundCaller = true; + } + if (foundCaller) break; + } + + if (!foundCaller) + { + if (_showUnknownCaller) + caller.Show = true; + else + caller.Show = false; + + if (_saveUnknownCaller) + _contacts.Add(caller); + } + } + + return caller; + } + + #endregion + } +} Modified: trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs 2008-02-15 23:57:37 UTC (rev 1367) +++ trunk/plugins/FritzBox/FritzBox/Properties/Resources.Designer.cs 2008-02-16 11:21:06 UTC (rev 1368) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:2.0.50727.1318 +// Laufzeitversion:2.0.50727.1433 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-02-16 15:46:20
|
Revision: 1371 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1371&view=rev Author: chef_koch Date: 2008-02-16 07:46:18 -0800 (Sat, 16 Feb 2008) Log Message: ----------- minor changes Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs trunk/plugins/FritzBox/FritzBox/PhoneBook.cs Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2008-02-16 13:08:01 UTC (rev 1370) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2008-02-16 15:46:18 UTC (rev 1371) @@ -352,13 +352,6 @@ CallAction ParseAction(string dataStream) { - string[] strList; // splitted data - - dataStream = dataStream.Replace("\n", ""); - if (FritzBox._extensiveLogging) - Log.Info("received data: {0}", dataStream); - strList = dataStream.Split(';'); - // data-stream can be in following format: // incoming calls: DateTime;RING;ConnectionID;CallerID;MSN;??POTS??; // outgoing calls: DateTime;CALL;ConnectionID;??Nebenstelle??;MSN;CallerID;??POTS??; @@ -369,6 +362,7 @@ // 12.12.06 12:12:12 // dd.MM.yy hh:mm:ss + string[] strList = dataStream.Trim().Split(';'); CallAction callAction = new CallAction(); // time when action happens @@ -554,6 +548,7 @@ { stopThread = true; + ReceivedData -= new ReceivedDataEventHandler(FritzBox_ReceivedData); Utils.OnStartExternal -= new Utils.UtilEventHandler(OnStartExternal); Utils.OnStopExternal -= new Utils.UtilEventHandler(OnStopExternal); Modified: trunk/plugins/FritzBox/FritzBox/PhoneBook.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/PhoneBook.cs 2008-02-16 13:08:01 UTC (rev 1370) +++ trunk/plugins/FritzBox/FritzBox/PhoneBook.cs 2008-02-16 15:46:18 UTC (rev 1371) @@ -27,13 +27,8 @@ using System.Collections.Generic; using System.Text; - using MediaPortal.Configuration; -using MediaPortal.Dialogs; using MediaPortal.GUI.Library; -using MediaPortal.Player; -using MediaPortal.Util; -using System.Text; using System.IO; namespace FritzBox This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |