|
From: <ove...@us...> - 2007-02-28 21:12:06
|
Revision: 147
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=147&view=rev
Author: overture
Date: 2007-02-28 13:05:55 -0800 (Wed, 28 Feb 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/plugins/IPTVPlugin/
trunk/plugins/IPTVPlugin/AddNewPlugin.cs
trunk/plugins/IPTVPlugin/AssemblyInfo.cs
trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
trunk/plugins/IPTVPlugin/IPTVPlugin.sln
trunk/plugins/IPTVPlugin/IPTVSetup.cs
trunk/plugins/IPTVPlugin/IPTVsetup.resx
trunk/plugins/IPTVPlugin/ReflectionManager.cs
trunk/plugins/IPTVPlugin/SetupManager.cs
trunk/plugins/IPTVPlugin/SnapperInterface.cs
Added: trunk/plugins/IPTVPlugin/AddNewPlugin.cs
===================================================================
--- trunk/plugins/IPTVPlugin/AddNewPlugin.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/AddNewPlugin.cs 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,234 @@
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+
+namespace myIPTV
+{
+ /// <summary>
+ /// Summary description for PluginsAddNew.
+ /// </summary>
+ public class PluginsAddNew : 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;
+ private System.ComponentModel.Container components = null;
+
+ #region Constructors
+
+ public PluginsAddNew()
+ {
+ InitializeComponent();
+ }
+
+ public PluginsAddNew(CheckedListBox chkLstBox)
+ {
+ InitializeComponent();
+ this.chklstBox = chkLstBox;
+ }
+
+ #endregion
+
+ #region Dispose
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #endregion
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ 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();
+ //
+ // btnOK
+ //
+ 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.Name = "btnOK";
+ this.btnOK.TabIndex = 3;
+ this.btnOK.Text = "OK";
+ 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.Name = "btnCancel";
+ this.btnCancel.TabIndex = 2;
+ this.btnCancel.Text = "Cancel";
+ 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)));
+ this.grpDLLFile.Controls.Add(this.txtFilePath);
+ this.grpDLLFile.Controls.Add(this.btnBrowse);
+ this.grpDLLFile.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.grpDLLFile.Location = new System.Drawing.Point(8, 8);
+ this.grpDLLFile.Name = "grpDLLFile";
+ this.grpDLLFile.Size = new System.Drawing.Size(400, 64);
+ this.grpDLLFile.TabIndex = 0;
+ this.grpDLLFile.TabStop = false;
+ this.grpDLLFile.Text = "File";
+
+ //
+ // txtFilePath
+ //
+ this.txtFilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | 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.TabIndex = 0;
+ this.btnBrowse.Text = "Browse";
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // PluginsAddNew
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(416, 242);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.grpDetails);
+ this.Controls.Add(this.grpDLLFile);
+ this.Name = "PluginsAddNew";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "PluginsAddNew";
+ this.grpDetails.ResumeLayout(false);
+ this.grpDLLFile.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ #region Event
+
+ private void btnBrowse_Click(object sender, System.EventArgs e)
+ {
+ openFileDialog1.Filter = "Plugin files (*.dll)|*.dll|All files (*.*)|*.*";
+ if(DialogResult.OK==openFileDialog1.ShowDialog())
+ {
+ txtFilePath.Text = openFileDialog1.FileName;
+ }
+ }
+
+ private void btnOK_Click(object sender, System.EventArgs e)
+ {
+ SetupManager setupManager = new SetupManager();
+ setupManager.LoadXMLDoc();
+
+ bool ans = setupManager.TestNewItem(this.txtFilePath.Text,this.txtDesc.Text,this.chkBstate.Checked);
+ if(ans)
+ {
+ setupManager.InsertNewItem(this.txtFilePath.Text,this.txtDesc.Text,this.chkBstate.Checked);
+ this.chklstBox.Items.Add(this.txtDesc.Text,this.chkBstate.Checked);
+ }
+ this.Close();
+ }
+
+ private void btnCancel_Click(object sender, System.EventArgs e)
+ {
+ this.Close();
+ }
+
+ #endregion
+ }
+}
Added: trunk/plugins/IPTVPlugin/AssemblyInfo.cs
===================================================================
--- trunk/plugins/IPTVPlugin/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/AssemblyInfo.cs 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("MediaPortal IPTV Plugin")]
+[assembly: AssemblyDescription("IPTV Plugin Host Application for mini IPTV plugins")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
+
Added: trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVPlugin.csproj (rev 0)
+++ trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,49 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <RootNamespace>IPTVPlugin</RootNamespace>
+ <AssemblyName>IPTVPlugin</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{14CD8D0D-30E2-44FB-8E49-078D1578668D}</ProjectGuid>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+ <OutputPath>bin\Debug\</OutputPath>
+ <Optimize>False</Optimize>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>Full</DebugType>
+ <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <Optimize>True</Optimize>
+ <DefineConstants>TRACE</DefineConstants>
+ <DebugSymbols>False</DebugSymbols>
+ <DebugType>None</DebugType>
+ <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <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="Core">
+ <HintPath>..\..\..\..\..\MediaPortal\mediaportal\Core\bin\Release\Core.dll</HintPath>
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SnapperInterface.cs" />
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="ReflectionManager.cs" />
+ <Compile Include="IPTVSetup.cs" />
+ <EmbeddedResource Include="IPTVsetup.resx">
+ <DependentUpon>IPTVSetup.cs</DependentUpon>
+ </EmbeddedResource>
+ <Compile Include="SetupManager.cs" />
+ <Compile Include="AddNewPlugin.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
+</Project>
\ No newline at end of file
Added: trunk/plugins/IPTVPlugin/IPTVPlugin.sln
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVPlugin.sln (rev 0)
+++ trunk/plugins/IPTVPlugin/IPTVPlugin.sln 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,16 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# SharpDevelop 2.0.0.922
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPTVPlugin", "IPTVPlugin.csproj", "{14CD8D0D-30E2-44FB-8E49-078D1578668D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {14CD8D0D-30E2-44FB-8E49-078D1578668D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {14CD8D0D-30E2-44FB-8E49-078D1578668D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {14CD8D0D-30E2-44FB-8E49-078D1578668D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {14CD8D0D-30E2-44FB-8E49-078D1578668D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+EndGlobal
Added: trunk/plugins/IPTVPlugin/IPTVSetup.cs
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVSetup.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/IPTVSetup.cs 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,501 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Xml;
+using MediaPortal.GUI.Library;
+
+namespace myIPTV
+{
+ /// <summary>
+ /// Description of MyIPTVsetup.
+ /// </summary>
+ public class IPTVsetup : System.Windows.Forms.Form, ISetupForm
+ {
+ private System.ComponentModel.Container components = null;
+
+ public IPTVsetup()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Forms Designer generated code
+ /// <summary>
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.grpBoxConnectInfo = new System.Windows.Forms.GroupBox();
+ this.chkBoxUseDefaultProxy = new System.Windows.Forms.CheckBox();
+ this.txtProxyPort = new System.Windows.Forms.TextBox();
+ this.label7 = new System.Windows.Forms.Label();
+ this.txtProxyIPAddress = new System.Windows.Forms.TextBox();
+ this.label6 = new System.Windows.Forms.Label();
+ this.txtProxyPass = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.chkBoxUseProxy = new System.Windows.Forms.CheckBox();
+ this.txtProxyUser = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+ 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.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.grpBoxConnectInfo.SuspendLayout();
+ this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // grpBoxConnectInfo
+ //
+ this.grpBoxConnectInfo.Controls.Add(this.chkBoxUseDefaultProxy);
+ this.grpBoxConnectInfo.Controls.Add(this.txtProxyPort);
+ this.grpBoxConnectInfo.Controls.Add(this.label7);
+ this.grpBoxConnectInfo.Controls.Add(this.txtProxyIPAddress);
+ this.grpBoxConnectInfo.Controls.Add(this.label6);
+ this.grpBoxConnectInfo.Controls.Add(this.txtProxyPass);
+ this.grpBoxConnectInfo.Controls.Add(this.label5);
+ this.grpBoxConnectInfo.Controls.Add(this.chkBoxUseProxy);
+ this.grpBoxConnectInfo.Controls.Add(this.txtProxyUser);
+ this.grpBoxConnectInfo.Controls.Add(this.label4);
+ this.grpBoxConnectInfo.Location = new System.Drawing.Point(6, 35);
+ this.grpBoxConnectInfo.Name = "grpBoxConnectInfo";
+ this.grpBoxConnectInfo.Size = new System.Drawing.Size(640, 246);
+ this.grpBoxConnectInfo.TabIndex = 1;
+ this.grpBoxConnectInfo.TabStop = false;
+ this.grpBoxConnectInfo.Text = "Internet Connection Information";
+ this.grpBoxConnectInfo.UseCompatibleTextRendering = true;
+ //
+ // chkBoxUseDefaultProxy
+ //
+ this.chkBoxUseDefaultProxy.Enabled = false;
+ this.chkBoxUseDefaultProxy.Location = new System.Drawing.Point(67, 99);
+ this.chkBoxUseDefaultProxy.Name = "chkBoxUseDefaultProxy";
+ this.chkBoxUseDefaultProxy.Size = new System.Drawing.Size(242, 24);
+ this.chkBoxUseDefaultProxy.TabIndex = 9;
+ this.chkBoxUseDefaultProxy.Text = "Use Default Proxy Authentication?";
+ this.chkBoxUseDefaultProxy.UseCompatibleTextRendering = true;
+ this.chkBoxUseDefaultProxy.CheckedChanged += new System.EventHandler(this.ChkBoxUseDefaultProxyCheckedChanged);
+ //
+ // txtProxyPort
+ //
+ this.txtProxyPort.Enabled = false;
+ this.txtProxyPort.Location = new System.Drawing.Point(488, 155);
+ this.txtProxyPort.Name = "txtProxyPort";
+ this.txtProxyPort.Size = new System.Drawing.Size(49, 20);
+ this.txtProxyPort.TabIndex = 8;
+ //
+ // label7
+ //
+ this.label7.Location = new System.Drawing.Point(382, 155);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(100, 23);
+ this.label7.TabIndex = 7;
+ this.label7.Text = "Port";
+ this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label7.UseCompatibleTextRendering = true;
+ //
+ // txtProxyIPAddress
+ //
+ this.txtProxyIPAddress.Enabled = false;
+ this.txtProxyIPAddress.Location = new System.Drawing.Point(488, 129);
+ this.txtProxyIPAddress.Name = "txtProxyIPAddress";
+ this.txtProxyIPAddress.Size = new System.Drawing.Size(100, 20);
+ this.txtProxyIPAddress.TabIndex = 6;
+ //
+ // label6
+ //
+ this.label6.Location = new System.Drawing.Point(382, 129);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(100, 23);
+ this.label6.TabIndex = 5;
+ this.label6.Text = "IP Address";
+ this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label6.UseCompatibleTextRendering = true;
+ //
+ // txtProxyPass
+ //
+ this.txtProxyPass.Enabled = false;
+ this.txtProxyPass.Location = new System.Drawing.Point(173, 155);
+ this.txtProxyPass.Name = "txtProxyPass";
+ this.txtProxyPass.Size = new System.Drawing.Size(100, 20);
+ this.txtProxyPass.TabIndex = 4;
+ //
+ // label5
+ //
+ this.label5.Location = new System.Drawing.Point(67, 155);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(100, 23);
+ this.label5.TabIndex = 3;
+ this.label5.Text = "Password";
+ this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label5.UseCompatibleTextRendering = true;
+ //
+ // chkBoxUseProxy
+ //
+ this.chkBoxUseProxy.Location = new System.Drawing.Point(33, 28);
+ this.chkBoxUseProxy.Name = "chkBoxUseProxy";
+ this.chkBoxUseProxy.Size = new System.Drawing.Size(136, 24);
+ this.chkBoxUseProxy.TabIndex = 2;
+ this.chkBoxUseProxy.Text = "Use a Proxy Server?";
+ this.chkBoxUseProxy.UseCompatibleTextRendering = true;
+ this.chkBoxUseProxy.CheckedChanged += new System.EventHandler(this.ChkBoxUseProxyCheckedChanged);
+ //
+ // txtProxyUser
+ //
+ this.txtProxyUser.Enabled = false;
+ this.txtProxyUser.Location = new System.Drawing.Point(173, 129);
+ this.txtProxyUser.Name = "txtProxyUser";
+ this.txtProxyUser.Size = new System.Drawing.Size(100, 20);
+ this.txtProxyUser.TabIndex = 1;
+ //
+ // label4
+ //
+ this.label4.Location = new System.Drawing.Point(67, 129);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(100, 23);
+ this.label4.TabIndex = 0;
+ this.label4.Text = "Username";
+ this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label4.UseCompatibleTextRendering = true;
+ //
+ // btnCancel
+ //
+ this.btnCancel.Location = new System.Drawing.Point(597, 384);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 2;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ this.btnCancel.UseCompatibleTextRendering = true;
+ this.btnCancel.Click += new System.EventHandler(this.BtnCancelClick);
+ //
+ // btnOK
+ //
+ this.btnOK.Location = new System.Drawing.Point(516, 384);
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
+ this.btnOK.TabIndex = 3;
+ this.btnOK.Text = "OK";
+ this.btnOK.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ this.btnOK.UseCompatibleTextRendering = true;
+ this.btnOK.Click += new System.EventHandler(this.BtnOKClick);
+ //
+ // tabControl1
+ //
+ this.tabControl1.Controls.Add(this.tabPage2);
+ this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Location = new System.Drawing.Point(12, 12);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ 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);
+ this.tabPage2.Controls.Add(this.label1);
+ this.tabPage2.Controls.Add(this.btnAddNewPlug);
+ this.tabPage2.Controls.Add(this.btnRemove);
+ this.tabPage2.Controls.Add(this.checkedListBox1);
+ this.tabPage2.Location = new System.Drawing.Point(4, 23);
+ this.tabPage2.Name = "tabPage2";
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage2.Size = new System.Drawing.Size(652, 330);
+ this.tabPage2.TabIndex = 1;
+ this.tabPage2.Text = "IPTV Mini Plugins";
+ this.tabPage2.UseVisualStyleBackColor = true;
+ //
+ // btnAddNewPlug
+ //
+ this.btnAddNewPlug.Location = new System.Drawing.Point(526, 301);
+ this.btnAddNewPlug.Name = "btnAddNewPlug";
+ this.btnAddNewPlug.Size = new System.Drawing.Size(107, 23);
+ this.btnAddNewPlug.TabIndex = 2;
+ this.btnAddNewPlug.Text = "Add New Plugin";
+ this.btnAddNewPlug.UseCompatibleTextRendering = true;
+ this.btnAddNewPlug.UseVisualStyleBackColor = true;
+ this.btnAddNewPlug.Click += new System.EventHandler(this.BtnAddNewPlugClick);
+ //
+ // btnRemove
+ //
+ this.btnRemove.Location = new System.Drawing.Point(18, 301);
+ this.btnRemove.Name = "btnRemove";
+ this.btnRemove.Size = new System.Drawing.Size(110, 23);
+ this.btnRemove.TabIndex = 1;
+ this.btnRemove.Text = "Remove Selected";
+ this.btnRemove.UseCompatibleTextRendering = true;
+ this.btnRemove.UseVisualStyleBackColor = true;
+ this.btnRemove.Click += new System.EventHandler(this.BtnRemoveClick);
+ //
+ // checkedListBox1
+ //
+ this.checkedListBox1.FormattingEnabled = true;
+ this.checkedListBox1.Location = new System.Drawing.Point(18, 36);
+ this.checkedListBox1.Name = "checkedListBox1";
+ this.checkedListBox1.Size = new System.Drawing.Size(615, 259);
+ this.checkedListBox1.TabIndex = 0;
+ this.checkedListBox1.UseCompatibleTextRendering = true;
+ this.checkedListBox1.SelectedIndexChanged += new System.EventHandler(this.CheckedListBox1SelectedIndexChanged);
+ //
+ // 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;
+ //
+ // 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;
+ //
+ // IPTVsetup
+ //
+ this.ClientSize = new System.Drawing.Size(686, 410);
+ this.Controls.Add(this.tabControl1);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.btnCancel);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Name = "IPTVsetup";
+ this.Text = "My IPTV Setup";
+ this.Load += new System.EventHandler(this.MyIPTVsetupLoad);
+ this.grpBoxConnectInfo.ResumeLayout(false);
+ this.grpBoxConnectInfo.PerformLayout();
+ this.tabControl1.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.tabPage2.ResumeLayout(false);
+ this.ResumeLayout(false);
+ }
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label lblAuthor;
+ private System.Windows.Forms.Button btnRemove;
+ private System.Windows.Forms.Button btnAddNewPlug;
+ private System.Windows.Forms.CheckedListBox checkedListBox1;
+ private System.Windows.Forms.TabPage tabPage2;
+ private System.Windows.Forms.TabPage tabPage1;
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox txtProxyUser;
+ private System.Windows.Forms.CheckBox chkBoxUseProxy;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.TextBox txtProxyPass;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TextBox txtProxyIPAddress;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.TextBox txtProxyPort;
+ private System.Windows.Forms.CheckBox chkBoxUseDefaultProxy;
+ private System.Windows.Forms.GroupBox grpBoxConnectInfo;
+ #endregion
+
+ void ChkBoxUseProxyCheckedChanged(object sender, System.EventArgs e)
+ {
+ if(chkBoxUseProxy.Checked==true)
+ {
+ chkBoxUseDefaultProxy.Checked = true;
+ chkBoxUseDefaultProxy.Enabled = true;
+ txtProxyIPAddress.Enabled = true;
+ txtProxyPort.Enabled = true;
+ }
+ else
+ {
+ chkBoxUseDefaultProxy.Checked = false;
+ chkBoxUseDefaultProxy.Enabled = false;
+ txtProxyIPAddress.Enabled = false;
+ txtProxyPort.Enabled = false;
+ txtProxyUser.Enabled = false;
+ txtProxyPass.Enabled = false;
+ }
+
+ }
+
+ void ChkBoxUseDefaultProxyCheckedChanged(object sender, System.EventArgs e)
+ {
+ if(chkBoxUseDefaultProxy.Checked==false)
+ {
+ txtProxyUser.Enabled = true;
+ txtProxyPass.Enabled = true;
+ }
+ else
+ {
+ txtProxyUser.Enabled = false;
+ txtProxyPass.Enabled = false;
+ }
+ }
+
+ void MyIPTVsetupLoad(object sender, System.EventArgs e)
+ {
+ SetupManager setupManager = new SetupManager();
+ setupManager.LoadXMLDoc();
+ setupManager.GetPluginDetails();
+ setupManager.LoadPluginItems(this.checkedListBox1);
+
+ XmlDocument xmld = new XmlDocument();
+ xmld.Load("iptvsettings.xml");
+
+ // Load Proxy Details from XML file
+ chkBoxUseProxy.Checked = Convert.ToBoolean(xmld.SelectSingleNode("/settings/proxydetails/useproxy").InnerText);
+ chkBoxUseDefaultProxy.Checked = Convert.ToBoolean(xmld.SelectSingleNode("/settings/proxydetails/usedefaultproxy").InnerText);
+ txtProxyUser.Text = xmld.SelectSingleNode("/settings/proxydetails/proxyuser").InnerText;
+ txtProxyPass.Text = xmld.SelectSingleNode("/settings/proxydetails/proxypassword").InnerText;
+ txtProxyIPAddress.Text = xmld.SelectSingleNode("/settings/proxydetails/proxyipaddress").InnerText;
+ txtProxyPort.Text = xmld.SelectSingleNode("/settings/proxydetails/proxyport").InnerText;
+ }
+
+ void BtnOKClick(object sender, System.EventArgs e)
+ {
+ XmlNode nchkBoxUseProxyNode;
+ XmlNode nchkBoxUseDefaultProxyNode;
+ XmlNode ntxtProxyUserNode;
+ XmlNode ntxtProxyPassNode;
+ XmlNode ntxtProxyIPAddressNode;
+ XmlNode ntxtProxyPortNode;
+
+ XmlDocument xmld = new XmlDocument();
+ xmld.Load("iptvsettings.xml");
+
+ nchkBoxUseProxyNode = xmld.SelectSingleNode("/settings/proxydetails/useproxy");
+ nchkBoxUseDefaultProxyNode = xmld.SelectSingleNode("/settings/proxydetails/usedefaultproxy");
+ ntxtProxyUserNode = xmld.SelectSingleNode("/settings/proxydetails/proxyuser");
+ ntxtProxyPassNode = xmld.SelectSingleNode("/settings/proxydetails/proxypassword");
+ ntxtProxyIPAddressNode = xmld.SelectSingleNode("/settings/proxydetails/proxyipaddress");
+ ntxtProxyPortNode = xmld.SelectSingleNode("/settings/proxydetails/proxyport");
+
+ nchkBoxUseProxyNode.InnerText = chkBoxUseProxy.Checked.ToString();
+ nchkBoxUseDefaultProxyNode.InnerText = chkBoxUseDefaultProxy.Checked.ToString();
+ ntxtProxyUserNode.InnerText = txtProxyUser.Text;
+ ntxtProxyPassNode.InnerText = txtProxyPass.Text;
+ ntxtProxyIPAddressNode.InnerText = txtProxyIPAddress.Text;
+ ntxtProxyPortNode.InnerText = txtProxyPort.Text;
+
+ xmld.Save("iptvsettings.xml");
+ this.Close();
+ }
+
+ void BtnCancelClick(object sender, System.EventArgs e)
+ {
+ this.Close();
+ }
+
+ #region ISetupForm Members
+
+ public bool CanEnable()
+ {
+ return true;
+ }
+
+ public string Description()
+ {
+ return "Plugin for viewing Internet TV";
+ }
+
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
+
+ public int GetWindowId()
+ {
+ return 5699;
+ }
+
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText=PluginName();
+ strButtonImage=String.Empty;
+ strButtonImageFocus=String.Empty;
+ strPictureImage=String.Empty;
+ return true;
+ }
+
+ public string Author()
+ {
+ return "overture/juan pablo";
+ }
+
+ public string PluginName()
+ {
+ return "My IPTV";
+ }
+
+ public bool HasSetup()
+ {
+ return true;
+ }
+
+ public void ShowPlugin()
+ {
+ IPTVsetup iptvSetup = new IPTVsetup();
+ iptvSetup.ShowDialog();
+ iptvSetup.Dispose();
+ }
+
+ #endregion
+
+
+ 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)
+ {
+ PluginsAddNew newplug = new PluginsAddNew(checkedListBox1);
+ newplug.ShowDialog();
+ newplug.Dispose();
+ }
+
+ void CheckedListBox1SelectedIndexChanged(object sender, System.EventArgs e)
+ {
+ }
+ }
+}
Added: trunk/plugins/IPTVPlugin/IPTVsetup.resx
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVsetup.resx (rev 0)
+++ trunk/plugins/IPTVPlugin/IPTVsetup.resx 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,120 @@
+<?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>
+</root>
\ No newline at end of file
Added: trunk/plugins/IPTVPlugin/ReflectionManager.cs
===================================================================
--- trunk/plugins/IPTVPlugin/ReflectionManager.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/ReflectionManager.cs 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,161 @@
+using System;
+using System.Reflection;
+using SnapperInterface;
+
+namespace ReflectionManager
+{
+ /// <summary>
+ /// Controls runtime instances of the mini plugins.
+ /// </summary>
+ public class ReflectionControl
+ {
+ private object oInstance;
+ private Assembly theSnapInAsm = null;
+
+ #region Default Constructor
+
+ /// <summary>
+ /// Default Constructor
+ /// </summary>
+ public ReflectionControl()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Property of a given type instance.
+ /// </summary>
+ public object ObjInstance
+ {
+ get { return this.oInstance; }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Used to load an external assembley.
+ /// </summary>
+ /// <param name="path">Path to the assembly.</param>
+ /// <returns>bool</returns>
+ public bool LoadExternalModule(string path)
+ {
+ try
+ {
+ // Dynamically load the selected assembly.
+ this.theSnapInAsm = Assembly.LoadFrom(path);
+ }
+ catch
+ {
+ // If any error at all takes place, just return false.
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Creates an instance of a specified type.
+ /// </summary>
+ /// <param name="sFullName">Name of the type i.e. "Namespace.Class"</param>
+ /// <returns>Instance of the type object.</returns>
+ public object GetInstanceOfType(string sFullName)
+ {
+ // Get all types in assembly.
+ Type[] theTypes = theSnapInAsm.GetTypes();
+ // See if a type implements ...
+ for (int i = 0; i < theTypes.Length; i++)
+ {
+ object[] theAtts = theTypes[i].GetCustomAttributes(false);
+ for(int j = 0;j< theAtts.Length;j++)
+ {
+ if(theAtts[j] is MiniIPTVPluginAttribute)
+ {
+ MiniIPTVPluginAttribute pa = theAtts[j] as MiniIPTVPluginAttribute;
+ // Use late binding to create the type.
+ this.oInstance = theSnapInAsm.CreateInstance(sFullName);
+ }
+ }
+ }
+ return this.oInstance;
+ }
+
+
+ /// <summary>
+ /// Checks if the DLL contains a compatiple type
+ /// </summary>
+ /// <returns>bool true or false</returns>
+ public bool CheckValidType()
+ {
+ bool ans = false;
+ int ctr = 0;
+ // Get all types in assembly.
+ Type[] theTypes = theSnapInAsm.GetTypes();
+
+ // Loop through each type in the assembly
+ for (int i = 0; i < theTypes.Length; i++)
+ {
+ // Get custom attributes for a given type
+ object[] theAtts = theTypes[i].GetCustomAttributes(false);
+
+ // Loop through each attribute supported by the given type.
+ for(int j = 0;j< theAtts.Length;j++)
+ {
+ if(theAtts[j] is MiniIPTVPluginAttribute)
+ {
+ // Increment ctr for each type that supports
+ // the MiniIPTVPluginAttribute.
+ ctr++;
+ }
+ }
+
+ }
+
+ // If the MiniIPTVPluginAttribute is supported in any type
+ // in a given assembly then return true so the DLL
+ // is reported to be plugable.
+ if(ctr>0)
+ {
+ // At least one type supports the MiniIPTVPluginAttribute
+ ans = true;
+ }
+ else
+ {
+ // Zero types support the MiniIPTVPluginAttribute
+ ans = false;
+ }
+
+ return ans;
+ }
+
+ /// <summary>
+ /// Gets the custom attribute(s) of a plugin type.
+ /// </summary>
+ /// <param name="sTypeName">Name of the type i.e. "Namespace.Class"</param>
+ public void GetCustomAttributes(out string sTypeName)
+ {
+ sTypeName = "";
+
+ // Get all types in assembly.
+ Type[] theTypes = theSnapInAsm.GetTypes();
+ // See if a type implements ...
+ for (int i = 0; i < theTypes.Length; i++)
+ {
+ object[] theAtts = theTypes[i].GetCustomAttributes(true);
+ for(int j = 0;j< theAtts.Length;j++)
+ {
+ if(theAtts[j] is MiniIPTVPluginAttribute)
+ {
+ MiniIPTVPluginAttribute pa = theAtts[j] as MiniIPTVPluginAttribute;
+ sTypeName = pa.TypeName;
+ }
+ }
+ }
+ }
+ #endregion
+ }
+}
Added: trunk/plugins/IPTVPlugin/SetupManager.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SetupManager.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/SetupManager.cs 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,279 @@
+using System;
+using System.Xml;
+using System.Windows.Forms;
+using System.Drawing;
+using ReflectionManager;
+using SnapperInterface;
+
+namespace myIPTV
+{
+ /// <summary>
+ /// Performs working tasks for this assembly.
+ /// </summary>
+ public class SetupManager
+ {
+ private string[] sDesc;
+ private string[] sDescP;
+ private string[] sState;
+ private XmlDocument xmld;
+ private string sTypeName;
+
+ #region Default Constructor
+
+ /// <summary>
+ /// Default Constructor
+ /// </summary>
+ public SetupManager()
+ {
+ }
+
+ #endregion
+
+ #region Internal Methods
+
+ /// <summary>
+ /// Load the IPTVMiniPluginDLLs.xml to an XmlDocument
+ /// </summary>
+ internal void LoadXMLDoc()
+ {
+ this.xmld = new XmlDocument();
+ try
+ {
+ this.xmld.Load("IPTVMiniPluginDLLs.xml");
+ }
+ catch(Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+
+ /// <summary>
+ /// Get the require details from the IPTVMiniPluginDLLs.xml file.
+ /// </summary>
+ internal void GetParams()
+ {
+ XmlNodeList nodeList = null;
+ this.sDesc = new string[10];
+ int i=0;
+
+ nodeList = this.xmld.SelectNodes("/interface/type");
+
+ foreach(XmlNode n in nodeList)
+ {
+ XmlNode StatusAtt = n.SelectSingleNode("dll/@state");
+ XmlNode NameAtt = n.SelectSingleNode("dll/@name");
+
+ if(StatusAtt.InnerXml.ToLower()=="on")
+ {
+ this.sDesc[i] = NameAtt.InnerXml;
+ i++;
+ }
+ }
+ }
+
+
+ internal void GetPluginDetails()
+ {
+ XmlNodeList nodeList = null;
+ this.sDescP = new string[10];
+ this.sState = new string[10];
+ int i=0;
+
+ nodeList = this.xmld.SelectNodes("/interface/type");
+
+ foreach(XmlNode n in nodeList)
+ {
+ XmlNode StatusAtt = n.SelectSingleNode("dll/@state");
+ XmlNode NameAtt = n.SelectSingleNode("dll/@name");
+
+ this.sDescP[i] = NameAtt.InnerXml;
+ this.sState[i] = StatusAtt.InnerXml;
+ i++;
+ }
+ }
+
+ /// <summary>
+ /// Load details into the ListBox on the NewItems form.
+ /// </summary>
+ /// <param name="listBox">ListBox from the NewItems form</param>
+ internal void LoadNewItem(ListBox listBox)
+ {
+ foreach(string s in this.sDesc)
+ {
+ if(s!=null)
+ {
+ listBox.Items.Add(s.ToString());
+ }
+ }
+ }
+
+ internal void LoadPluginItems(CheckedListBox chklistBox)
+ {
+ for(int i=0;i<10;i++)
+ {
+ if(this.sDescP[i]!=null)
+ {
+ if(this.sState[i].ToLower()=="on")
+ {
+ chklistBox.Items.Add(this.sDescP[i],CheckState.Checked);
+ }
+ else if(this.sState[i].ToLower()=="off")
+ {
+ chklistBox.Items.Add(this.sDescP[i],CheckState.Unchecked);
+ }
+ else
+ {
+ chklistBox.Items.Add(this.sDescP[i],CheckState.Indeterminate);
+ }
+ }
+ }
+ }
+
+ internal void SavePluginItems(CheckedListBox chklistBox)
+ {
+ int itemIndex = 0;
+ foreach(string item in chklistBox.Items)
+ {
+ this.sDesc = new string[10];
+ string sNewState = null;
+ XmlNode nodeInner = null;
+ XmlNode nodeStatus = null;
+
+ nodeInner = this.xmld.SelectSingleNode("/interface/type/dll[@name='" + item.ToString().Trim() + "']");
+ nodeStatus = this.xmld.SelectSingleNode("/interface/type/dll[@name='" + item.ToString().Trim() + "']/@state");
+
+ if(chklistBox.GetItemCheckState(itemIndex).ToString().ToLower()=="checked")
+ {
+ sNewState = "On";
+ }
+ else if (chklistBox.GetItemCheckState(itemIndex).ToString().ToLower()=="unchecked")
+ {
+ sNewState = "Off";
+ }
+
+ nodeStatus.Value = sNewState;
+ this.xmld.Save("IPTVMiniPluginDLLs.xml");
+ itemIndex++;
+ }
+ }
+
+ internal void InsertNewItem(string sFilePath,string sDesc,bool sState)
+ {
+ XmlNode root = null;
+ root = this.xmld.SelectSingleNode("/interface");
+
+ //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 attName = this.xmld.CreateAttribute("name");
+ attName.InnerText = sDesc;
+ eleDLL.SetAttributeNode(attName);
+
+ root.AppendChild(eleType);
+ eleType.InsertBefore(eleDLL,eleType.FirstChild);
+
+ this.xmld.Save("IPTVMiniPluginDLLs.xml");
+ }
+
+ internal void RemoveItem(string sSelected)
+ {
+ if(sSelected!="")
+ {
+ XmlNode node = null;
+ XmlNode childnode = null;
+ node = this.xmld.SelectSingleNode("/interface");
+ childnode = node.SelectSingleNode("type[dll/@name='" + sSelected + "']");
+ node.RemoveChild(childnode);
+ this.xmld.Save("IPTVMiniPluginDLLs.xml");
+ }
+ }
+
+ internal string[,] GetChannelArray()
+ {
+ XmlNodeList nodeList = this.xmld.SelectNodes("/interface/type");
+ string[,] sAllChannelDetails;
+ sAllChannelDetails = new string[4000,6]; // [Rows,Columns]
+ int iLastArrayIndex = 0; // Default Start Index
+
+ foreach(XmlNode n in nodeList)
+ {
+ XmlNode nodeState = n.SelectSingleNode("dll/@state");
+ XmlNode nodeDLL = n.SelectSingleNode("dll");
+
+ //Load Assembs.
+ ReflectionControl dir = new ReflectionControl();
+ bool ans = dir.LoadExternalModule(nodeDLL.InnerXml);
+ if(ans)
+ {
+ 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;
+ }
+ else
+ {
+ MessageBox.Show("ERROR: DLL Failed to load for '" + nodeDLL.InnerXml + "'.\n\nCheck that the DLL specified in the \n'IPTVMiniPluginDLLs.xml' file is correct.");
+ }
+ }
+ return sAllChannelDetails;
+ }
+
+ internal string GetAuthor(string sDLL)
+ {
+ string sAuthor = "unknown"; // Default Author
+ ReflectionControl dir = new ReflectionControl();
+ bool ans = dir.LoadExternalModule(sDLL);
+ if(ans)
+ {
+ dir.GetCustomAttributes(out sTypeName);
+ object o = dir.GetInstanceOfType(sTypeName);
+ IMiniIPTVPlugin iplug = o as IMiniIPTVPlugin;
+ sAuthor = iplug.Author();
+ }
+ else
+ {
+ MessageBox.Show("ERROR: DLL Failed to load for '" + sDLL + "'.\n\nCheck that the DLL specified in the \n'IPTVMiniPluginDLLs.xml' file is correct.");
+ }
+ return sAuthor;
+ }
+
+ internal bool TestNewItem(string sFilePath,string sDesc,bool sState)
+ {
+ bool ans = false;
+ if(sFilePath!="" && sDesc!="")
+ {
+ //Load Assem.
+ ReflectionControl dir = new ReflectionControl();
+ ans = dir.LoadExternalModule(sFilePath);
+ if(ans)
+ {
+ if(!dir.CheckValidType())
+ {
+ ans = false;
+ MessageBox.Show("ERROR: This DLL is not a valid IPTV Mini Plugin");
+ }
+ }
+ else
+ {
+ MessageBox.Show("ERROR: DLL Failed to load for '" + sDesc + "'.\n\nThis file may not be a valid DLL File.");
+ }
+ dir = null;
+ }
+ return ans;
+ }
+
+ #endregion
+
+ }
+}
Added: trunk/plugins/IPTVPlugin/SnapperInterface.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SnapperInterface.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-02-28 21:05:55 UTC (rev 147)
@@ -0,0 +1,59 @@
+using System;
+using System.Windows.Forms;
+
+namespace SnapperInterface
+{
+ #region IMiniIPTVPlugin Interface
+ /// <summary>
+ /// IMiniIPTVPlugin Interface - for plugging in IPTV providing data.
+ /// </summary>
+ public interface IMiniIPTVPlugin
+ {
+ /// <summary>
+ /// 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 array</returns>
+ string[,] IPTVChannel();
+ string Author();
+ }
+
+ #endregion
+
+ #region Plugin Attribute
+
+ /// <summary>
+ /// MiniIPTVPluginAttribute will be used by classes which
+ /// support the IMiniIPTVPlugin interface...and thus which are
+ /// pluggable into the extendable application.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class)]
+ public class MiniIPTVPluginAttribute : System.Attribute
+ {
+ private string typeName;
+
+ /// <summary>
+ /// TypeName public property.
+ /// </summary>
+ public string TypeName
+ {
+ get { return typeName; }
+ set { typeName = value; }
+ }
+
+ /// <summary>
+ /// Custom consturctor for PluginAttribute.
+ /// </summary>
+ /// <param name="typeName">TypeName is the full type name of the plugin i.e. formatted "Namespace.Class"</param>
+ public MiniIPTVPluginAttribute(string typeName)
+ {
+ this.typeName = typeName;
+ }
+
+ /// <summary>
+ /// Default Constructor
+ /// </summary>
+ public MiniIPTVPluginAttribute() {}
+ }
+
+ #endregion
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|