From: <du...@us...> - 2007-04-09 16:36:27
|
Revision: 299 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=299&view=rev Author: dukus Date: 2007-04-09 09:35:53 -0700 (Mon, 09 Apr 2007) Log Message: ----------- Working action interpreter Modified Paths: -------------- trunk/plugins/mpinstaler/MPInstaler/MPIutils.cs trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs trunk/plugins/mpinstaler/MPInstaler/wizard/controlp.cs trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs Modified: trunk/plugins/mpinstaler/MPInstaler/MPIutils.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/MPIutils.cs 2007-04-09 03:03:35 UTC (rev 298) +++ trunk/plugins/mpinstaler/MPInstaler/MPIutils.cs 2007-04-09 16:35:53 UTC (rev 299) @@ -1,7 +1,14 @@ using System; +using System.IO; using System.Diagnostics; using System.Collections.Generic; using System.Text; +using System.Drawing; +using System.ComponentModel; +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; +using System.Reflection; +using System.Windows.Forms; namespace MPInstaler { @@ -10,7 +17,65 @@ public MPIutils() { } - + + static public void LoadPlugins(string pluginFile) + { + if (!File.Exists(pluginFile)) + { + MessageBox.Show("File not found "+pluginFile); + return; + } + try + { + Assembly pluginAssembly = Assembly.LoadFrom(pluginFile); + + if (pluginAssembly != null) + { + Type[] exportedTypes = pluginAssembly.GetExportedTypes(); + + foreach (Type type in exportedTypes) + { + if (type.IsAbstract) + { + continue; + } + if (type.GetInterface("MediaPortal.GUI.Library.ISetupForm") != null) + { + try + { + // + // Create instance of the current type + // + object pluginObject = Activator.CreateInstance(type); + ISetupForm pluginForm = pluginObject as ISetupForm; + + if (pluginForm != null) + { + if (pluginForm.HasSetup()) + pluginForm.ShowPlugin(); + //ItemTag tag = new ItemTag(); + //tag.SetupForm = pluginForm; + //tag.DLLName = pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1); + //tag.windowId = pluginForm.GetWindowId(); + //loadedPlugins.Add(tag); + } + } + catch (Exception setupFormException) + { + MessageBox.Show(string.Format("Exception in plugin SetupForm loading : {0} ", setupFormException.Message)); + + } + } + } + } + } + catch (Exception unknownException) + { + MessageBox.Show("Exception in plugin loading :{0}", unknownException.Message); + } + } + + static public void StartApp(string file) { Process app = new Process(); Modified: trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs 2007-04-09 03:03:35 UTC (rev 298) +++ trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs 2007-04-09 16:35:53 UTC (rev 299) @@ -396,6 +396,20 @@ return fs; } + public MPIFileList FindFile(string file) + { + MPIFileList fs = new MPIFileList(); + for (int i = 0; i < FileList.Count; i++) + { + if ((((MPIFileList)FileList[i]).FileNameShort == file)) + { + fs = (MPIFileList)FileList[i]; + break; + } + } + return fs; + } + public string GetZipEntry(MPIFileList flst) { string ret = string.Empty; @@ -707,7 +721,7 @@ else return false; } - public void ExecuteAction() + public void ExecuteAction(MPinstalerStruct xmp) { switch (Place) { @@ -715,9 +729,12 @@ switch (Id) { case 0: + MPIutils.StartApp(Config.GetFile(Config.Dir.Base,Command)); break; case 1: + MPIFileList fs = xmp.FindFile(Command); + MPIutils.LoadPlugins(MPinstalerStruct.GetDirEntry(fs)); break; } break; Modified: trunk/plugins/mpinstaler/MPInstaler/wizard/controlp.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/wizard/controlp.cs 2007-04-09 03:03:35 UTC (rev 298) +++ trunk/plugins/mpinstaler/MPInstaler/wizard/controlp.cs 2007-04-09 16:35:53 UTC (rev 299) @@ -24,7 +24,7 @@ public controlp() { InitializeComponent(); - //pictureBox1.Load("http://webmaster.extra.hu/banner/extra134x77.gif"); + } private void button2_Click(object sender, EventArgs e) @@ -69,18 +69,18 @@ SetGroups(0, lv); } - private void InitGroups( ListView myListView) + private void InitGroups(ListView myListView) { groupTables = new Hashtable[myListView.Columns.Count]; for (int column = 0; column < myListView.Columns.Count; column++) { // Create a hash table containing all the groups // needed for a single column. - groupTables[column] = CreateGroupsTable(column,myListView); + groupTables[column] = CreateGroupsTable(column, myListView); } // Start with the groups created for the Title column. - SetGroups(0,myListView); + SetGroups(0, myListView); } private void SetGroups(int column, ListView myListView) @@ -190,7 +190,7 @@ { button1.Enabled = false; button3.Enabled = false; - button4.Enabled = false; + button4.Enabled = false; } } @@ -210,7 +210,7 @@ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string temp_file = Path.GetFullPath(Environment.GetEnvironmentVariable("TEMP")) + @"\" + "MPExtensionFileList.xml"; - if (MPInstallHelper.Download(comboBox1.Text + "/" + "MPExtensionFileList.xml",temp_file)) + if (MPInstallHelper.Download(comboBox1.Text + "/" + "MPExtensionFileList.xml", temp_file)) { if (File.Exists(temp_file)) { @@ -232,7 +232,7 @@ { string file_name = listView2.SelectedItems[0].SubItems[3].Text; string temp_file = Path.GetFullPath(Environment.GetEnvironmentVariable("TEMP")) + @"\" + file_name; - download_form dw = new download_form(comboBox1.Text+"/"+file_name,temp_file); + download_form dw = new download_form(comboBox1.Text + "/" + file_name, temp_file); dw.Text = listView2.SelectedItems[0].SubItems[3].Text; dw.ShowDialog(); if (File.Exists(temp_file)) @@ -284,7 +284,7 @@ groupColumn = e.Column; // Set the groups to those created for the clicked column. - SetGroups(e.Column,listView1); + SetGroups(e.Column, listView1); } @@ -358,7 +358,7 @@ file_name = pk1.FileName; temp_file = Path.GetFullPath(Environment.GetEnvironmentVariable("TEMP")) + @"\" + file_name; download_form dw1 = new download_form(pk1._intalerStruct.UpdateURL + "/" + file_name, temp_file); - dw1.Text = pk1._intalerStruct.UpdateURL+"/"+pk1.FileName+"/"+pk1._intalerStruct.Version; + dw1.Text = pk1._intalerStruct.UpdateURL + "/" + pk1.FileName + "/" + pk1._intalerStruct.Version; dw1.ShowDialog(); if (File.Exists(temp_file)) { @@ -398,57 +398,7 @@ } } } - - private void LoadPlugins(string pluginFile) - { - try - { - Assembly pluginAssembly = Assembly.LoadFrom(pluginFile); - if (pluginAssembly != null) - { - Type[] exportedTypes = pluginAssembly.GetExportedTypes(); - - foreach (Type type in exportedTypes) - { - if (type.IsAbstract) - { - continue; - } - if (type.GetInterface("MediaPortal.GUI.Library.ISetupForm") != null) - { - try - { - // - // Create instance of the current type - // - object pluginObject = Activator.CreateInstance(type); - ISetupForm pluginForm = pluginObject as ISetupForm; - - if (pluginForm != null) - { - //ItemTag tag = new ItemTag(); - //tag.SetupForm = pluginForm; - //tag.DLLName = pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1); - //tag.windowId = pluginForm.GetWindowId(); - //loadedPlugins.Add(tag); - } - } - catch (Exception setupFormException) - { - MessageBox.Show("Exception in plugin SetupForm loading :{0}", setupFormException.Message); - - } - } - } - } - } - catch (Exception unknownException) - { - MessageBox.Show("Exception in plugin loading :{0}", unknownException.Message); - } - } - } public class ListViewGroupSorter : IComparer Modified: trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs 2007-04-09 03:03:35 UTC (rev 298) +++ trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs 2007-04-09 16:35:53 UTC (rev 299) @@ -252,8 +252,10 @@ { int i=skinlister.Items.IndexOf(ac.ToString()); if (skinlister.GetSelected(i)) - ac.ExecuteAction(); + ac.ExecuteAction(package._intalerStruct); } + + this.Close(); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |