From: <ove...@us...> - 2007-03-27 15:57:15
|
Revision: 238 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=238&view=rev Author: overture Date: 2007-03-27 08:57:10 -0700 (Tue, 27 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IPTVPlugin/AddNewPlugin.cs trunk/plugins/IPTVPlugin/IPTVPlugin.csproj trunk/plugins/IPTVPlugin/IPTVSetup.cs trunk/plugins/IPTVPlugin/IPTVsetup.resx trunk/plugins/IPTVPlugin/SetupManager.cs trunk/plugins/IPTVPlugin/SnapperInterface.cs Added Paths: ----------- trunk/plugins/IPTVPlugin/AddNewPlugins.resx trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs trunk/plugins/IPTVPlugin/GUIWindowEnum.cs Modified: trunk/plugins/IPTVPlugin/AddNewPlugin.cs =================================================================== --- trunk/plugins/IPTVPlugin/AddNewPlugin.cs 2007-03-27 11:13:31 UTC (rev 237) +++ trunk/plugins/IPTVPlugin/AddNewPlugin.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -10,16 +10,12 @@ /// <summary> /// Summary description for PluginsAddNew. /// </summary> - public class PluginsAddNew : System.Windows.Forms.Form + public class AddNewPlugins : System.Windows.Forms.Form { private System.Windows.Forms.OpenFileDialog openFileDialog1; private CheckedListBox chklstBox; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.GroupBox grpDetails; - private System.Windows.Forms.TextBox txtDesc; - private System.Windows.Forms.Label lblDescription; - private System.Windows.Forms.CheckBox chkBstate; private System.Windows.Forms.GroupBox grpDLLFile; private System.Windows.Forms.TextBox txtFilePath; private System.Windows.Forms.Button btnBrowse; @@ -27,12 +23,12 @@ #region Constructors - public PluginsAddNew() + public AddNewPlugins() { InitializeComponent(); } - public PluginsAddNew(CheckedListBox chkLstBox) + public AddNewPlugins(CheckedListBox chkLstBox) { InitializeComponent(); this.chklstBox = chkLstBox; @@ -68,14 +64,9 @@ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.btnOK = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); - this.grpDetails = new System.Windows.Forms.GroupBox(); - this.txtDesc = new System.Windows.Forms.TextBox(); - this.lblDescription = new System.Windows.Forms.Label(); - this.chkBstate = new System.Windows.Forms.CheckBox(); this.grpDLLFile = new System.Windows.Forms.GroupBox(); this.txtFilePath = new System.Windows.Forms.TextBox(); this.btnBrowse = new System.Windows.Forms.Button(); - this.grpDetails.SuspendLayout(); this.grpDLLFile.SuspendLayout(); this.SuspendLayout(); // @@ -83,74 +74,31 @@ // this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.btnOK.Location = new System.Drawing.Point(336, 216); + this.btnOK.Location = new System.Drawing.Point(333, 88); this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 3; this.btnOK.Text = "OK"; + this.btnOK.UseCompatibleTextRendering = true; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.btnCancel.Location = new System.Drawing.Point(248, 216); + this.btnCancel.Location = new System.Drawing.Point(252, 88); this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 2; this.btnCancel.Text = "Cancel"; + this.btnCancel.UseCompatibleTextRendering = true; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // - // grpDetails - // - this.grpDetails.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.grpDetails.Controls.Add(this.txtDesc); - this.grpDetails.Controls.Add(this.lblDescription); - this.grpDetails.Controls.Add(this.chkBstate); - this.grpDetails.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.grpDetails.Location = new System.Drawing.Point(8, 80); - this.grpDetails.Name = "grpDetails"; - this.grpDetails.Size = new System.Drawing.Size(400, 128); - this.grpDetails.TabIndex = 1; - this.grpDetails.TabStop = false; - this.grpDetails.Text = "Details"; - - // - // txtDesc - // - this.txtDesc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtDesc.Location = new System.Drawing.Point(104, 68); - this.txtDesc.Name = "txtDesc"; - this.txtDesc.Size = new System.Drawing.Size(280, 20); - this.txtDesc.TabIndex = 2; - this.txtDesc.Text = ""; - // - // lblDescription - // - this.lblDescription.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.lblDescription.Location = new System.Drawing.Point(16, 64); - this.lblDescription.Name = "lblDescription"; - this.lblDescription.Size = new System.Drawing.Size(64, 23); - this.lblDescription.TabIndex = 1; - this.lblDescription.Text = "Description"; - this.lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - - // - // chkBstate - // - this.chkBstate.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.chkBstate.Location = new System.Drawing.Point(16, 24); - this.chkBstate.Name = "chkBstate"; - this.chkBstate.TabIndex = 0; - this.chkBstate.Text = "State (On/Off)"; - - // // grpDLLFile // this.grpDLLFile.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))); + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.grpDLLFile.Controls.Add(this.txtFilePath); this.grpDLLFile.Controls.Add(this.btnBrowse); this.grpDLLFile.FlatStyle = System.Windows.Forms.FlatStyle.System; @@ -160,42 +108,41 @@ this.grpDLLFile.TabIndex = 0; this.grpDLLFile.TabStop = false; this.grpDLLFile.Text = "File"; - + this.grpDLLFile.UseCompatibleTextRendering = true; // // txtFilePath // this.txtFilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + | System.Windows.Forms.AnchorStyles.Right))); this.txtFilePath.Location = new System.Drawing.Point(104, 24); this.txtFilePath.Name = "txtFilePath"; this.txtFilePath.Size = new System.Drawing.Size(280, 20); this.txtFilePath.TabIndex = 1; - this.txtFilePath.Text = ""; // // btnBrowse // this.btnBrowse.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnBrowse.Location = new System.Drawing.Point(16, 24); this.btnBrowse.Name = "btnBrowse"; + this.btnBrowse.Size = new System.Drawing.Size(75, 23); this.btnBrowse.TabIndex = 0; this.btnBrowse.Text = "Browse"; + this.btnBrowse.UseCompatibleTextRendering = true; this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); // - // PluginsAddNew + // AddNewPlugins // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(416, 242); + this.ClientSize = new System.Drawing.Size(416, 113); this.Controls.Add(this.btnOK); this.Controls.Add(this.btnCancel); - this.Controls.Add(this.grpDetails); this.Controls.Add(this.grpDLLFile); - this.Name = "PluginsAddNew"; + this.Name = "AddNewPlugins"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "PluginsAddNew"; - this.grpDetails.ResumeLayout(false); this.grpDLLFile.ResumeLayout(false); + this.grpDLLFile.PerformLayout(); this.ResumeLayout(false); - } #endregion @@ -215,11 +162,11 @@ SetupManager setupManager = new SetupManager(); setupManager.LoadXMLDoc(); - bool ans = setupManager.TestNewItem(this.txtFilePath.Text,this.txtDesc.Text,this.chkBstate.Checked); + bool ans = setupManager.TestNewItem(this.txtFilePath.Text); if(ans) { - setupManager.InsertNewItem(this.txtFilePath.Text,this.txtDesc.Text,this.chkBstate.Checked); - this.chklstBox.Items.Add(this.txtDesc.Text,this.chkBstate.Checked); + string sPluginName = setupManager.InsertNewItem(this.txtFilePath.Text); + this.chklstBox.Items.Add(sPluginName,true); } this.Close(); } Added: trunk/plugins/IPTVPlugin/AddNewPlugins.resx =================================================================== --- trunk/plugins/IPTVPlugin/AddNewPlugins.resx (rev 0) +++ trunk/plugins/IPTVPlugin/AddNewPlugins.resx 2007-03-27 15:57:10 UTC (rev 238) @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file Added: trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs =================================================================== --- trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs (rev 0) +++ trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -0,0 +1,57 @@ +using System; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using myIPTV; +using System.Windows.Forms; + +namespace IPTVPlugin +{ + /// <summary> + /// Main IPTV GUI + /// </summary> + public class GUIHomeIPTV : GUIWindow + { + + [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(99)] protected GUIVideoControl videoWindow=null; + [SkinControlAttribute(8)] protected GUIToggleButtonControl btnTvOnOff=null; + + public GUIHomeIPTV() + { + GetID=(int)GUIWindowIPTV.Home; + } + + public override int GetID + { + get { return (int)GUIWindowIPTV.Home; } + set { base.GetID = value; } + } + + public override bool Init() + { + return Load(GUIGraphicsContext.Skin+@"\MyIPTVhome.xml"); + } + + protected override void OnPageLoad() + { + this.btnViewAs.Label = "Channel Guide"; + this.btnTvOnOff.Label = "IPTV On/Off"; + base.OnPageLoad(); + } + + protected override void OnClicked(int controlId, GUIControl control,Action.ActionType actionType) + { + if(control==btnViewAs) + { + GUIWindowManager.ActivateWindow((int)GUIWindowIPTV.CategoryList); + return; + } + base.OnClicked(controlId, control, actionType); + } + + public override void OnAction(Action action) + { + base.OnAction(action); + } + } +} Added: trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs =================================================================== --- trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs (rev 0) +++ trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -0,0 +1,102 @@ +using System; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using myIPTV; +using System.Windows.Forms; + +namespace IPTVPlugin +{ + /// <summary> + /// Description of GUIListCategoriesIPTV. + /// </summary> + public class GUIListCategoriesIPTV : GUIWindow + { + [SkinControlAttribute(10)] protected GUIListControl listControl = null; + [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null; + private SetupManager setupManager; + private string[,] sChannelArray; + private string sViewType; + + public GUIListCategoriesIPTV() + { + GetID=(int)GUIWindowIPTV.CategoryList; + setupManager = new SetupManager(); + this.setupManager.LoadXMLDoc(); + } + + public override int GetID + { + get { return (int)GUIWindowIPTV.CategoryList; } + set { base.GetID = value; } + } + + public override bool Init() + { + bool ans = Load(GUIGraphicsContext.Skin+@"\MyIPTVCategoryList.xml"); + return ans; + } + + internal string ViewType + { + get + { + return this.sViewType; + } + set + { + this.sViewType = value; + } + } + + protected override void OnPageLoad() + { + this.btnViewAs.Label = "View : Genre"; // Default + sChannelArray = this.setupManager.GetChannelArray(); + this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Genre); + this.listControl.Focus = true; + base.OnPageLoad(); + } + + protected override void OnClicked(int controlId, GUIControl control,Action.ActionType actionType) + { + if(control==listControl) + { +// GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED,(int)GUIWindowIPTV.CategoryList,0,10,0,0,null); +// msg.Label = listControl.SelectedListItem.Label; +// msg.SenderControlId = 10; + GUIWindowManager.ActivateWindow((int)GUIWindowIPTV.ChannelList); +// OnMessage(msg); + + return; +// MessageBox.Show(listControl.SelectedListItem.Label); +// string sSelectedText = listControl.SelectedListItem.Label; +// return; + } + else if(control==btnViewAs) + { + switch(btnViewAs.Label) + { + case "View : Genre": + this.sViewType = "Language"; + this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Language); + break; + case "View : Language": + this.sViewType = "Country"; + this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Country); + break; + case "View : Country": + this.sViewType = "Genre"; + this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Genre); + break; + } + btnViewAs.Label = "View : " + this.sViewType; + } + base.OnClicked(controlId, control, actionType); + } + + public override void OnAction(Action action) + { + base.OnAction(action); + } + } +} Added: trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs =================================================================== --- trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs (rev 0) +++ trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -0,0 +1,62 @@ +using System; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using myIPTV; +using System.Windows.Forms; + + +namespace IPTVPlugin +{ + /// <summary> + /// Description of IPTVListChannelsGUI. + /// </summary> + public class GUIListChannelsIPTV : GUIWindow + { + [SkinControlAttribute(11)] protected GUIListControl listControl = null; + + public GUIListChannelsIPTV() + { + GetID=(int)GUIWindowIPTV.ChannelList; + } + + public override int GetID + { + get + { + return (int)GUIWindowIPTV.ChannelList; + } + set { base.GetID = value; } + } + + public override bool Init() + { + bool ans = Load(GUIGraphicsContext.Skin+@"\MyIPTVChannelList.xml"); + return ans; + } + + protected override void OnPageLoad() + { + MessageBox.Show(GUIGraphicsContext.Skin+@"\MyIPTVChannelList.xml"); + GUIListItem item = new GUIListItem(); + item.Label = "Blada Blada"; + listControl.Add(item); + listControl.Focus = true; + base.OnPageLoad(); + } + + protected override void OnClicked(int controlId, GUIControl control,Action.ActionType actionType) + { + base.OnClicked(controlId, control, actionType); + } + + public override bool OnMessage(GUIMessage msg) + { + if(msg.SenderControlId==10) + { + MessageBox.Show(msg.Label); + base.OnMessage(msg); + } + return false; + } + } +} Added: trunk/plugins/IPTVPlugin/GUIWindowEnum.cs =================================================================== --- trunk/plugins/IPTVPlugin/GUIWindowEnum.cs (rev 0) +++ trunk/plugins/IPTVPlugin/GUIWindowEnum.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -0,0 +1,11 @@ +using System; + +namespace IPTVPlugin +{ + public enum GUIWindowIPTV + { + Home = 6598, // CODE: GUIHomeIPTV.cs - SKIN: MyIPTVhome.xml + ChannelList = 6599, // CODE: GUIListChannelsIPTV.cs - SKIN: MyIPTVChannelList.xml + CategoryList = 6600, // CODE: GUIListCategoriesIPTV.cs - SKIN: MyIPTVCategoryList.xml + } +} Modified: trunk/plugins/IPTVPlugin/IPTVPlugin.csproj =================================================================== --- trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-27 11:13:31 UTC (rev 237) +++ trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-27 15:57:10 UTC (rev 238) @@ -29,6 +29,14 @@ <Reference Include="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <Reference Include="System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <Reference Include="Dialogs"> + <HintPath>..\..\..\..\..\MediaPortal\mediaportal\Dialogs\bin\Release\Dialogs.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> + <Reference Include="Core"> + <HintPath>..\..\..\..\..\MediaPortal\mediaportal\Core\bin\Debug\Core.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="SnapperInterface.cs" /> @@ -40,6 +48,13 @@ </EmbeddedResource> <Compile Include="SetupManager.cs" /> <Compile Include="AddNewPlugin.cs" /> + <Compile Include="GUIHomeIPTV.cs" /> + <Compile Include="GUIListChannelsIPTV.cs" /> + <Compile Include="GUIWindowEnum.cs" /> + <EmbeddedResource Include="AddNewPlugins.resx"> + <DependentUpon>AddNewPlugin.cs</DependentUpon> + </EmbeddedResource> + <Compile Include="GUIListCategoriesIPTV.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> </Project> \ No newline at end of file Modified: trunk/plugins/IPTVPlugin/IPTVSetup.cs =================================================================== --- trunk/plugins/IPTVPlugin/IPTVSetup.cs 2007-03-27 11:13:31 UTC (rev 237) +++ trunk/plugins/IPTVPlugin/IPTVSetup.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -11,10 +11,14 @@ /// </summary> public class IPTVsetup : System.Windows.Forms.Form, ISetupForm { - private System.ComponentModel.Container components = null; + private System.ComponentModel.IContainer components; + private string sPath; public IPTVsetup() { + string sFilePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; + sPath = sFilePath.Substring(0,sFilePath.LastIndexOf(@"\")); + InitializeComponent(); } @@ -41,6 +45,7 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.grpBoxConnectInfo = new System.Windows.Forms.GroupBox(); this.chkBoxUseDefaultProxy = new System.Windows.Forms.CheckBox(); this.txtProxyPort = new System.Windows.Forms.TextBox(); @@ -55,17 +60,20 @@ this.btnCancel = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.lblAuthor = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.btnAddNewPlug = new System.Windows.Forms.Button(); this.btnRemove = new System.Windows.Forms.Button(); this.checkedListBox1 = new System.Windows.Forms.CheckedListBox(); - this.label1 = new System.Windows.Forms.Label(); - this.lblAuthor = new System.Windows.Forms.Label(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.configurationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.grpBoxConnectInfo.SuspendLayout(); this.tabControl1.SuspendLayout(); + this.tabPage2.SuspendLayout(); this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // // grpBoxConnectInfo @@ -213,17 +221,6 @@ this.tabControl1.Size = new System.Drawing.Size(660, 357); this.tabControl1.TabIndex = 4; // - // tabPage1 - // - this.tabPage1.Controls.Add(this.grpBoxConnectInfo); - this.tabPage1.Location = new System.Drawing.Point(4, 23); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(652, 330); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Proxy Settings"; - this.tabPage1.UseVisualStyleBackColor = true; - // // tabPage2 // this.tabPage2.Controls.Add(this.lblAuthor); @@ -239,6 +236,27 @@ this.tabPage2.Text = "IPTV Mini Plugins"; this.tabPage2.UseVisualStyleBackColor = true; // + // lblAuthor + // + this.lblAuthor.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblAuthor.Location = new System.Drawing.Point(99, 7); + this.lblAuthor.Name = "lblAuthor"; + this.lblAuthor.Size = new System.Drawing.Size(100, 23); + this.lblAuthor.TabIndex = 4; + this.lblAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblAuthor.UseCompatibleTextRendering = true; + // + // label1 + // + this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.label1.Location = new System.Drawing.Point(18, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(100, 23); + this.label1.TabIndex = 3; + this.label1.Text = "Author:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label1.UseCompatibleTextRendering = true; + // // btnAddNewPlug // this.btnAddNewPlug.Location = new System.Drawing.Point(526, 301); @@ -270,28 +288,32 @@ this.checkedListBox1.TabIndex = 0; this.checkedListBox1.UseCompatibleTextRendering = true; this.checkedListBox1.SelectedIndexChanged += new System.EventHandler(this.CheckedListBox1SelectedIndexChanged); + this.checkedListBox1.Click += new System.EventHandler(this.CheckedListBox1Click); // - // label1 + // tabPage1 // - this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.label1.Location = new System.Drawing.Point(18, 7); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(100, 23); - this.label1.TabIndex = 3; - this.label1.Text = "Author:"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.label1.UseCompatibleTextRendering = true; + this.tabPage1.Controls.Add(this.grpBoxConnectInfo); + this.tabPage1.Location = new System.Drawing.Point(4, 23); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(652, 330); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Proxy Settings"; + this.tabPage1.UseVisualStyleBackColor = true; // - // lblAuthor + // contextMenuStrip1 // - this.lblAuthor.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblAuthor.Location = new System.Drawing.Point(99, 7); - this.lblAuthor.Name = "lblAuthor"; - this.lblAuthor.Size = new System.Drawing.Size(100, 23); - this.lblAuthor.TabIndex = 4; - this.lblAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.lblAuthor.UseCompatibleTextRendering = true; + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.configurationToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(139, 26); // + // configurationToolStripMenuItem + // + this.configurationToolStripMenuItem.Name = "configurationToolStripMenuItem"; + this.configurationToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.configurationToolStripMenuItem.Text = "Configuration"; + // // IPTVsetup // this.ClientSize = new System.Drawing.Size(686, 410); @@ -305,10 +327,13 @@ this.grpBoxConnectInfo.ResumeLayout(false); this.grpBoxConnectInfo.PerformLayout(); this.tabControl1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); this.tabPage1.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); + this.contextMenuStrip1.ResumeLayout(false); this.ResumeLayout(false); } + private System.Windows.Forms.ToolStripMenuItem configurationToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lblAuthor; private System.Windows.Forms.Button btnRemove; @@ -375,7 +400,7 @@ setupManager.LoadPluginItems(this.checkedListBox1); XmlDocument xmld = new XmlDocument(); - xmld.Load("iptvsettings.xml"); + xmld.Load(sPath+@"\iptvsettings.xml"); // Load Proxy Details from XML file chkBoxUseProxy.Checked = Convert.ToBoolean(xmld.SelectSingleNode("/settings/proxydetails/useproxy").InnerText); @@ -396,7 +421,7 @@ XmlNode ntxtProxyPortNode; XmlDocument xmld = new XmlDocument(); - xmld.Load("iptvsettings.xml"); + xmld.Load(sPath+@"\iptvsettings.xml"); nchkBoxUseProxyNode = xmld.SelectSingleNode("/settings/proxydetails/useproxy"); nchkBoxUseDefaultProxyNode = xmld.SelectSingleNode("/settings/proxydetails/usedefaultproxy"); @@ -412,7 +437,11 @@ ntxtProxyIPAddressNode.InnerText = txtProxyIPAddress.Text; ntxtProxyPortNode.InnerText = txtProxyPort.Text; - xmld.Save("iptvsettings.xml"); + xmld.Save(sPath+@"\iptvsettings.xml"); + +// SetupManager setupManager = new SetupManager(); +// setupManager.SavePluginItems(this.checkedListBox1); + this.Close(); } @@ -420,7 +449,29 @@ { this.Close(); } + + void BtnRemoveClick(object sender, System.EventArgs e) + { + SetupManager setupManager = new SetupManager(); + setupManager.LoadXMLDoc(); + setupManager.RemoveItem(checkedListBox1.Text); + checkedListBox1.Items.Clear(); + setupManager.GetPluginDetails(); + setupManager.LoadPluginItems(checkedListBox1); + } + + void BtnAddNewPlugClick(object sender, System.EventArgs e) + { + AddNewPlugins newplug = new AddNewPlugins(checkedListBox1); + newplug.ShowDialog(); + newplug.Dispose(); + } + + void CheckedListBox1SelectedIndexChanged(object sender, System.EventArgs e) + { + } + #region ISetupForm Members public bool CanEnable() @@ -440,7 +491,7 @@ public int GetWindowId() { - return 5699; + return 6598; } public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) @@ -454,7 +505,7 @@ public string Author() { - return "overture/juan pablo"; + return "overture"; } public string PluginName() @@ -475,27 +526,11 @@ } #endregion + - - void BtnRemoveClick(object sender, System.EventArgs e) + void CheckedListBox1Click(object sender, System.EventArgs e) { - SetupManager setupManager = new SetupManager(); - setupManager.LoadXMLDoc(); - setupManager.RemoveItem(checkedListBox1.Text); - checkedListBox1.Items.Clear(); - setupManager.GetPluginDetails(); - setupManager.LoadPluginItems(checkedListBox1); + contextMenuStrip1.Show(); } - - void BtnAddNewPlugClick(object sender, System.EventArgs e) - { - PluginsAddNew newplug = new PluginsAddNew(checkedListBox1); - newplug.ShowDialog(); - newplug.Dispose(); - } - - void CheckedListBox1SelectedIndexChanged(object sender, System.EventArgs e) - { - } } } Modified: trunk/plugins/IPTVPlugin/IPTVsetup.resx =================================================================== --- trunk/plugins/IPTVPlugin/IPTVsetup.resx 2007-03-27 11:13:31 UTC (rev 237) +++ trunk/plugins/IPTVPlugin/IPTVsetup.resx 2007-03-27 15:57:10 UTC (rev 238) @@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root> \ No newline at end of file Modified: trunk/plugins/IPTVPlugin/SetupManager.cs =================================================================== --- trunk/plugins/IPTVPlugin/SetupManager.cs 2007-03-27 11:13:31 UTC (rev 237) +++ trunk/plugins/IPTVPlugin/SetupManager.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -4,9 +4,20 @@ using System.Drawing; using ReflectionManager; using SnapperInterface; +using MediaPortal.GUI.Library; namespace myIPTV { + internal enum ChannelInfo + { + Name = 0, + Description = 1, + Genre = 2, + Language = 3, + Country = 4, + StreamURL = 5, + } + /// <summary> /// Performs working tasks for this assembly. /// </summary> @@ -17,6 +28,8 @@ private string[] sState; private XmlDocument xmld; private string sTypeName; + private string sPath; + #region Default Constructor @@ -25,10 +38,43 @@ /// </summary> public SetupManager() { + string sFilePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; + sPath = sFilePath.Substring(0,sFilePath.LastIndexOf(@"\")); } #endregion + + #region Private Methods + private bool Contains(string[] list, string comparedValue) + { + foreach(string listValue in list) + { + if (listValue == comparedValue) + { + return true; + } + } + return false; + } + private string[] removeDuplicates(string[] inputList) + { + string[] finalList = new string[200]; + int i = 0; + foreach (string currValue in inputList) + { + if(currValue==null) { break; } + if (!Contains(finalList, currValue)) + { + finalList[i] = currValue; + i++; + } + } + return finalList; + } + + #endregion + #region Internal Methods /// <summary> @@ -39,7 +85,7 @@ this.xmld = new XmlDocument(); try { - this.xmld.Load("IPTVMiniPluginDLLs.xml"); + this.xmld.Load(sPath+@"\IPTVMiniPluginDLLs.xml"); } catch(Exception ex) { @@ -71,7 +117,31 @@ } } + internal void DisplayInitialScreen(GUIListControl listBox, string[,] sAllChannels, ChannelInfo channelInfo) + { + string[] sAllItems = new string[4000]; + string[] sRes; + listBox.Clear(); + + for(int r=0;r<4000;r++) + { + string sItem = sAllChannels[r,Convert.ToInt32(channelInfo)]; + if(sItem==null) { break; } + sAllItems[r] = sItem; + } + + sRes = removeDuplicates(sAllItems); + foreach(string s in sRes) + { + if(s==null) { break; } + GUIListItem item = new GUIListItem(); + item.Label = s; + listBox.Add(item); + } + listBox.Focus = true; + } + internal void GetPluginDetails() { XmlNodeList nodeList = null; @@ -152,36 +222,47 @@ } nodeStatus.Value = sNewState; - this.xmld.Save("IPTVMiniPluginDLLs.xml"); + this.xmld.Save(sPath+@"\IPTVMiniPluginDLLs.xml"); itemIndex++; } } - internal void InsertNewItem(string sFilePath,string sDesc,bool sState) + internal string InsertNewItem(string sFilePath) { XmlNode root = null; - root = this.xmld.SelectSingleNode("/interface"); + string sPluginName = null; + + //Load Assembs. + ReflectionControl dir = new ReflectionControl(); + bool ans = dir.LoadExternalModule(sFilePath); + if(ans) + { + dir.GetCustomAttributes(out sTypeName); + object o = dir.GetInstanceOfType(sTypeName); + IMiniIPTVPlugin iplug = o as IMiniIPTVPlugin; + sPluginName = iplug.PluginName(); + + root = this.xmld.SelectSingleNode("/interface"); - //Create new nodes - XmlElement eleType = this.xmld.CreateElement("type"); - XmlElement eleDLL = this.xmld.CreateElement("dll"); - eleDLL.InnerText = sFilePath; + //Create new nodes + XmlElement eleType = this.xmld.CreateElement("type"); + XmlElement eleDLL = this.xmld.CreateElement("dll"); + eleDLL.InnerText = sFilePath; - XmlAttribute attState = this.xmld.CreateAttribute("state"); - if(sState) - { attState.InnerText = "On";} - else if(!sState) - { attState.InnerText = "Off";} - eleDLL.SetAttributeNode(attState); + XmlAttribute attState = this.xmld.CreateAttribute("state"); + attState.InnerText = "On"; // Default + eleDLL.SetAttributeNode(attState); - XmlAttribute attName = this.xmld.CreateAttribute("name"); - attName.InnerText = sDesc; - eleDLL.SetAttributeNode(attName); + XmlAttribute attName = this.xmld.CreateAttribute("name"); + attName.InnerText = sPluginName; + eleDLL.SetAttributeNode(attName); - root.AppendChild(eleType); - eleType.InsertBefore(eleDLL,eleType.FirstChild); + root.AppendChild(eleType); + eleType.InsertBefore(eleDLL,eleType.FirstChild); - this.xmld.Save("IPTVMiniPluginDLLs.xml"); + this.xmld.Save(sPath+@"\IPTVMiniPluginDLLs.xml"); + } + return sPluginName; } internal void RemoveItem(string sSelected) @@ -193,7 +274,7 @@ node = this.xmld.SelectSingleNode("/interface"); childnode = node.SelectSingleNode("type[dll/@name='" + sSelected + "']"); node.RemoveChild(childnode); - this.xmld.Save("IPTVMiniPluginDLLs.xml"); + this.xmld.Save(sPath+@"\IPTVMiniPluginDLLs.xml"); } } @@ -201,9 +282,11 @@ { XmlNodeList nodeList = this.xmld.SelectNodes("/interface/type"); string[,] sAllChannelDetails; - sAllChannelDetails = new string[4000,6]; // [Rows,Columns] - int iLastArrayIndex = 0; // Default Start Index - + sAllChannelDetails = new string[4000,5]; // [Rows,Columns] +// int iLastArrayIndex = 0; // Default Start Index + int iRow; + int iColumn; + foreach(XmlNode n in nodeList) { XmlNode nodeState = n.SelectSingleNode("dll/@state"); @@ -217,9 +300,45 @@ dir.GetCustomAttributes(out sTypeName); object o = dir.GetInstanceOfType(sTypeName); IMiniIPTVPlugin iplug = o as IMiniIPTVPlugin; - string[,] sChannelDetails = iplug.IPTVChannel(); - sChannelDetails.CopyTo(sAllChannelDetails, iLastArrayIndex); - iLastArrayIndex = sChannelDetails.Length; + string[,] sChannelDetails = null; + try{ + sChannelDetails = iplug.IPTVChannel(); + } + catch(Exception ex) + { + MessageBox.Show(ex.Message); + } + int iFreshRow = 0; + for(iRow=0;iRow<4000;iRow++) + { + int iFreshCol = 0; + try + { + if(sChannelDetails[iFreshRow,iFreshCol] == null) + { + break; + } + } + catch + { + break; + } + for(iColumn=0;iColumn<5;iColumn++) + { + try + { + sAllChannelDetails[iRow,iColumn] = sChannelDetails[iFreshRow,iFreshCol]; + } + catch(Exception ex) + { + MessageBox.Show("["+iRow+", "+iColumn+"]: "+ex.Message); + } + iFreshCol++; + } + iFreshRow++; + } +// sChannelDetails.CopyTo(sAllChannelDetails, iLastArrayIndex); +// iLastArrayIndex = sChannelDetails.Length; } else { @@ -229,6 +348,7 @@ return sAllChannelDetails; } + internal string GetAuthor(string sDLL) { string sAuthor = "unknown"; // Default Author @@ -248,10 +368,10 @@ return sAuthor; } - internal bool TestNewItem(string sFilePath,string sDesc,bool sState) + internal bool TestNewItem(string sFilePath) { bool ans = false; - if(sFilePath!="" && sDesc!="") + if(sFilePath!="") { //Load Assem. ReflectionControl dir = new ReflectionControl(); Modified: trunk/plugins/IPTVPlugin/SnapperInterface.cs =================================================================== --- trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 11:13:31 UTC (rev 237) +++ trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 15:57:10 UTC (rev 238) @@ -10,39 +10,18 @@ public interface IMiniIPTVPlugin { /// <summary> - /// Should return CHANNEL INFO in a multi-dim array - returned in this order:- - /// [x,1] Channel Name - /// [x,2] Channel Description - /// [x,3] Genre - /// [x,4] Language - /// [x,5] Country - /// [x,6] Channel Stream URL - /// [x,7] Channel EPG - /// NOTE: where 'x' above = the ROW index of the multi-dim array. - /// NOTE: you must return Null when any of the above info is not available. + /// Should return a multi-dimensional array return in this order (string channelname, string channelDescription, string genre, string language, string country, string streamURL) /// </summary> - /// <returns>A multi-dimensional string array</returns> + /// <returns>A multi-dimensional array</returns> string[,] IPTVChannel(); - /// <summary> - /// Should return the name of the IPTV mini plugin AUTHOR. - /// </summary> - /// <returns>string with authors name</returns> string Author(); - /// <summary> - /// Should return a DESCRIPTION for the IPTV mini plugin. - /// </summary> - /// <returns>string with authors name</returns> - string Description(); - /// <summary> - /// Should return the current VERSION of the plugin. - /// </summary> - /// <returns>decimal with version number</returns> - decimal Version(); + string PluginName(); + Form IPTVPluginSetup(); } #endregion - #region Plugin Attribute + #region MiniIPTVPlugin Attribute /// <summary> /// MiniIPTVPluginAttribute will be used by classes which This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |