From: <nor...@us...> - 2007-09-03 19:59:19
|
Revision: 890 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=890&view=rev Author: northern_sky Date: 2007-09-03 12:59:11 -0700 (Mon, 03 Sep 2007) Log Message: ----------- fixed import from gui and progressDialog Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/README.txt Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/FileReadEventArgs.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -353,6 +353,7 @@ } public object ExecuteStmtScalar(string stmt) + { object o = null; try Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -89,7 +89,7 @@ this.progressTextBox.Text = ""; System.Windows.Forms.Application.DoEvents(); // make sure the title caption appears.... - CurApp.OnRefreshInfo += new ApplicationItem.RefreshInfoEventHandler(RefreshInfo); + //----------- CurApp.OnRefreshInfoEvent += new ApplicationItem.RefreshInfoEventHandler(RefreshInfo); //backgroundWorker.ReportProgress(10); try { @@ -99,7 +99,7 @@ } finally { - CurApp.OnRefreshInfo -= new ApplicationItem.RefreshInfoEventHandler(RefreshInfo); + //--------- CurApp.OnRefreshInfoEvent -= new ApplicationItem.RefreshInfoEventHandler(RefreshInfo); this.Text = "Import finished."; progressTextBox.Text = importFinishedText; isImportRunning = false; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -1086,11 +1086,9 @@ { if (currentApplicationItem != null) { + currentApplicationItem.ImportFinishedEvent += new ApplicationItem.ImportFinishedEventHandler(currentApplicationItem_ImportFinishedEvent); currentApplicationItem.Refresh(true); - prevFilepath = currentApplicationItem.DefaultFilepath(); - // todo: reset viewHandler - UpdateButtonStates(); - UpdateListControl(); + } } else if (control == btnViews) @@ -1111,6 +1109,14 @@ } } + void currentApplicationItem_ImportFinishedEvent(object sender, EventArgs e) + { + prevFilepath = currentApplicationItem.DefaultFilepath(); + // todo: reset viewHandler + UpdateButtonStates(); + UpdateListControl(); + } + protected override void OnShowContextMenu() { GUIListItem item = facadeView.SelectedListItem; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-09-03 19:59:11 UTC (rev 890) @@ -144,6 +144,7 @@ <Compile Include="GUIProgramsAltFileInfo.cs" /> <Compile Include="Imports\AllGameScraper.cs" /> <Compile Include="Imports\DirectoryImport.cs" /> + <Compile Include="Imports\FileReadEventArgs.cs" /> <Compile Include="Imports\GamebaseImport.cs" /> <Compile Include="Imports\ImportBase.cs" /> <Compile Include="Imports\MameImport.cs" /> Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -22,15 +22,9 @@ public DirectoryImport(ApplicationItem objApp) { applicationItem = objApp; - OnReadNewFile += new MyEventHandler(applicationItem.ReadNewFile); } - public void DeInit() - { - OnReadNewFile -= new MyEventHandler(applicationItem.ReadNewFile); - } - private void ImportFileItem(FileInfo fileInfo) { FileItem curFile = new FileItem(); @@ -55,48 +49,57 @@ private void DeleteOrphaned() { - string TheFileName; - foreach (FileItem DBfile in applicationItem.ItemList) + + for (int i = 0; i < applicationItem.ItemList.Count; i++) { + FileItem fileItem = null; - TheFileName = DBfile.Filename; + if (applicationItem.ItemList[i] is FileItem) + { + fileItem = (FileItem) applicationItem.ItemList[i]; + if (!File.Exists(fileItem.Filename)) + { + fileItem.Delete(); + } - //if (!DBfile.IsFolder) - //{ - if (!File.Exists(TheFileName)) { DBfile.Delete(); } - //} - //else - //{ - //if (!Directory.Exists(TheFileName)) { DBfile.Delete(); } - - //} - + } } } - private void ImportFile(string dirPath, bool mpGuiMode) + private void ImportFile(string dirPath) { - + double total = 0; FileInfo fileInDir = null; if (Directory.Exists(dirPath)) { DirectoryInfo directoryInfo = new DirectoryInfo(dirPath); FileSystemInfo[] allUnderLyingFiles = directoryInfo.GetFileSystemInfos(); - + total = allUnderLyingFiles.Length; + for (int i = 0; i < allUnderLyingFiles.Length; i++) { + + OnReadNewFileEvent(this, new FileReadEventArgs((int)(100 * (((double) i ) / total)), "Importing from directory " + dirPath)); + if (allUnderLyingFiles[i] is FileInfo) { Boolean FileExists = false; fileInDir = (FileInfo)allUnderLyingFiles[i]; - foreach (FileItem DBfile in applicationItem.ItemList) + for (int j = 0; j < applicationItem.ItemList.Count; j++) { - if (DBfile.Filename == fileInDir.FullName) + FileItem fileItem = null; + + if (applicationItem.ItemList[j] is FileItem) { - FileExists = true; - break;//ugly + fileItem = (FileItem)applicationItem.ItemList[j]; + if(fileItem.Filename == fileInDir.FullName) + { + + FileExists = true; + break;//ugly + } } } if (!FileExists) @@ -108,23 +111,26 @@ else if (allUnderLyingFiles[i] is DirectoryInfo) { DirectoryInfo directory = (DirectoryInfo)allUnderLyingFiles[i]; - ImportFile(directory.FullName, mpGuiMode); + ImportFile(directory.FullName); } } } } - public void StartImport(string[] fileDirPaths, bool mpGuiMode) + public void StartImport() { + string[] fileDirPaths = this.applicationItem.FileDirectory.Split(';'); + using (SQLiteTransaction transaction = dbHandlerInstance.SqlLiteConn.BeginTransaction()) { DeleteOrphaned(); //get all maindirs foreach (string dirPath in fileDirPaths) { - ImportFile(dirPath, mpGuiMode); + ImportFile(dirPath); } transaction.Commit(); + OnReadNewFileEvent(this, new FileReadEventArgs(100, "Import done...................")); } } } Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/FileReadEventArgs.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/FileReadEventArgs.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/FileReadEventArgs.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace GUIProgramsAlt.Imports +{ + public class FileReadEventArgs + { + + public FileReadEventArgs(int ctr, string message) + { + this.ctr = ctr; + this.message = message; + } + public readonly int ctr; + public readonly string message; + } +} Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -47,15 +47,9 @@ public GamebaseImport(ApplicationItem objApp) { applicationItem = objApp; - OnReadNewFile += new MyEventHandler(applicationItem.ReadNewFile); } - public void DeInit() - { - OnReadNewFile -= new MyEventHandler(applicationItem.ReadNewFile); - } - void DBImportGamebaseItem(OleDbDataReader myReader, string romFilename, string imgFilename, int curPos, int maxGames) { @@ -95,10 +89,7 @@ curFile.LastTimeLaunched = DateTime.MinValue; curFile.LaunchCount = 0; curFile.Write(); - //this.OnReadNewFile(curFile.Title, curPos, maxGames); // send event to whom it may concern.... - //this.OnReadNewFile(curFile.Title, (int)(100 * (((double)curPos) / maxGames))); - SendDisplayText(curFile.Title, (int)(100 * (((double)curPos) / maxGames))); - return; + return; } public void StartImport() @@ -198,9 +189,13 @@ { Log.Info("*missing* gamebase game {0}", curRomname); } + OnReadNewFileEvent(this, new FileReadEventArgs((int)(100 * (((double)i) / maxGames)), "Importing " + curRomname)); + } } transaction.Commit(); + OnReadNewFileEvent(this, new FileReadEventArgs(100, "Import done")); + } } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -4,24 +4,33 @@ using System.IO; using GUIProgramsAlt.Items; +using GUIProgramsAlt; + namespace GUIProgramsAlt.Imports { public abstract class ImportBase { // event: read new file - protected delegate void MyEventHandler(string informationMessage, int progressBarCtr); + public delegate void ReadNewFileEventHandler(object sender, FileReadEventArgs e); + public event ReadNewFileEventHandler ReadNewFileEvent = null; - protected event MyEventHandler OnReadNewFile = null; - protected void SendDisplayText(string displayText, int progressBarCtr) + protected void OnReadNewFileEvent(object sender,FileReadEventArgs e) { - if (OnReadNewFile != null) + if (ReadNewFileEvent != null) { - OnReadNewFile(displayText, progressBarCtr); + ReadNewFileEvent(sender,e); } } + public virtual void startImport() + { + + //override + + } + protected string ImportImageFiles(string fileName, string fileTitle,ApplicationItem applicationItem) { string thumb = ""; @@ -71,6 +80,5 @@ } return thumb; } - } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -74,20 +74,14 @@ public MameImport(ApplicationItem applicationItem) { currentApplication = applicationItem; - OnReadNewFile += new MyEventHandler(currentApplication.ReadNewFile); } - public void DeInit() - { - OnReadNewFile -= new MyEventHandler(currentApplication.ReadNewFile); - } - void ReadListFull() { fullRomListDictionary.Clear(); string line = string.Empty; - SendDisplayText("generating mame list (full)", 10); + OnReadNewFileEvent(this,new FileReadEventArgs(10,"generating mame list (full)")); using (Process process = new Process()) { @@ -120,7 +114,7 @@ string line; if (((ApplicationItemMame)currentApplication).ImportOriginalsOnly) { - SendDisplayText("generating mame list (clones)", 20); + OnReadNewFileEvent(this,new FileReadEventArgs(20,"generating mame list (clones)")); using (Process process = new Process()) { @@ -251,18 +245,18 @@ if (conditionChecker.IsOk) { - SendDisplayText("Generating lists...", 0); + OnReadNewFileEvent(this,new FileReadEventArgs(0,"Generating lists...")); ReadListFull(); - SendDisplayText("Generating lists.....", 0); + OnReadNewFileEvent(this,new FileReadEventArgs(0,"Generating lists.....")); ReadListClones(); if (System.IO.File.Exists(catverIniFile)) { - SendDisplayText("Reading catver.ini.......", 0); + OnReadNewFileEvent(this,new FileReadEventArgs(0,"Reading catver.ini.......")); ReadCatverIni(); } if (System.IO.File.Exists(historyDatFile)) { - SendDisplayText("Reading history.dat............", 0); + OnReadNewFileEvent(this,new FileReadEventArgs(0,"Reading history.dat............")); ReadHistoryDat(); } @@ -286,7 +280,7 @@ { if (!CheckPrerequisites()) { - SendDisplayText(conditionChecker.Problems, 0); + OnReadNewFileEvent(this,new FileReadEventArgs(0,conditionChecker.Problems)); Log.Info("MameImporter: import failed! Details: {0}", conditionChecker.Problems); return; } @@ -304,7 +298,7 @@ transaction.Commit(); } - SendDisplayText("Import done...................", 100); + OnReadNewFileEvent(this,new FileReadEventArgs(100,"Import done...................")); } @@ -354,7 +348,7 @@ if ((curFile.Imagefile == "") && (currentApplication.ImportValidImagesOnly)) { - SendDisplayText("", (int)(100 * (((double)count) / total))); + OnReadNewFileEvent(this,new FileReadEventArgs( (int)(100 * (((double)count) / total)),"")); return; } if (this.fullRomListDictionary.ContainsKey(curRomname)) @@ -409,8 +403,8 @@ curFile.Rating = 5; curFile.Write(); - // OnReadNewFile(curFile.Title, count, localRomNames.Length); - SendDisplayText(curFile.Title, (int)(100 * (((double)count) / total))); + // OnReadNewFileEvent(curFile.Title, count, localRomNames.Length); + OnReadNewFileEvent(this,new FileReadEventArgs((int)(100 * (((double)count) / total)),curFile.Title) ); } } @@ -418,7 +412,7 @@ } else { - SendDisplayText("", (int)(100 * (((double)count) / total))); + OnReadNewFileEvent(this,new FileReadEventArgs((int)(100 * (((double)count) / total)),"") ); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -41,6 +41,7 @@ using MediaPortal.Util; using GUIProgramsAlt; +using GUIProgramsAlt.Imports; using GUIProgramsAlt.Database; using GUIProgramsAlt.Items; @@ -52,13 +53,44 @@ { #region Events/Delegates - public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); - public event FilelinkLaunchEventHandler OnLaunchFilelink = null; + // public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + // public event FilelinkLaunchEventHandler OnLaunchFilelink = null; // event: read new file - public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); - public event RefreshInfoEventHandler OnRefreshInfo = null; + public delegate void RefreshInfoEventHandler(object sender ,FileReadEventArgs e) ; + public event RefreshInfoEventHandler OnRefreshInfoEvent = null; + + public delegate void ImportFinishedEventHandler(object sender,EventArgs e); + public event ImportFinishedEventHandler ImportFinishedEvent; + + public delegate void ImportDelegate(); + protected ImportDelegate importDelegate = null; + + public virtual void OnImportFinished(object sender, EventArgs e) + { + if (ImportFinishedEvent != null) + { + ImportFinishedEvent(this,e); + } + } + + protected void ImportEnded(IAsyncResult result) + { + filesAreLoaded = false; + if (progressDialog != null) + { + progressDialog.Close(); + } + OnImportFinished(this, null); + if (progressDialog != null) + { + progressDialog.Close(); + progressDialog.ShowWaitCursor = false; + + } + } + #endregion Events/Delegates #region Variables @@ -302,7 +334,7 @@ public ApplicationItem() { - // .. init member variables ... + // .. init member variables ... appID = -1; fatherID = -1; title = ""; @@ -337,7 +369,6 @@ protected void ShowProgressDialog(string headerText) { progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); - progressDialog.ShowWaitCursor = true; progressDialog.SetHeading(headerText); progressDialog.SetLine(0,headerText); progressDialog.SetLine(1, ""); @@ -346,30 +377,26 @@ progressDialog.Progress(); } - public void ReadNewFile(string informationMessage, int progressBarCtr) + public void SetGUIProgressDialog(string informationMessage, int progressBarCtr) { + if (progressDialog != null) { + + progressDialog.ShowProgressBar(true); + progressDialog.ShowWaitCursor = true; + progressDialog.SetLine(2, String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage)); // "last imported file {0}" - /* if ((curPos > 0) && (maxPos > 0)) - { - int perc = 100 * curPos / maxPos; - guiDialogProgress.SetPercentage(perc); - }*/ + progressDialog.SetPercentage(progressBarCtr); progressDialog.Progress(); + + } - SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); + // SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); } - protected void SendRefreshInfo(string informationMessage, int progressBarCtr) - { - if (OnRefreshInfo != null) - { - OnRefreshInfo(informationMessage, progressBarCtr); - } - } + - protected void DoPreLaunch() { if (waitForExit && (preLaunch != "")) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -87,31 +87,29 @@ { if (mpGUIMode) { - ShowProgressDialog("Import directory"); + ShowProgressDialog("Importing from folders.."); } DirectoryImport directoryImport = null; - try - { - directoryImport = new DirectoryImport(this); - + + if (!File.Exists(this.Executable)) // no "mame.exe" + return; + + ValidExtensions = ValidExtensions.Replace(" ", ""); - string[] fileDirPaths = this.FileDirectory.Split(';'); - directoryImport.StartImport(fileDirPaths, mpGUIMode); + - } - finally - { - if (directoryImport != null) - { - directoryImport.DeInit(); - } + directoryImport = new DirectoryImport(this); + directoryImport.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(directoryImport_ReadNewFileEvent); + importDelegate = new ImportDelegate(directoryImport.StartImport); + importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); - if (mpGUIMode) - { - progressDialog.Close(); - } - } + #endregion ApplicationItem Overloads } + + void directoryImport_ReadNewFileEvent(object sender, FileReadEventArgs e) + { + this.SetGUIProgressDialog(e.message, e.ctr); + } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -62,30 +62,27 @@ GamebaseImport gameBaseImport = null; - // show progress dialog and run the import... if (mpGUIMode) { - ShowProgressDialog("Import gamebase"); + ShowProgressDialog("Importing from gameBase.."); } - try - { - gameBaseImport = new GamebaseImport(this); - gameBaseImport.StartImport(); - } - finally - { - if (gameBaseImport != null) - { - gameBaseImport.DeInit(); - } - if (mpGUIMode) - { - progressDialog.Close(); - } - } + if (!File.Exists(this.Executable)) // no "mame.exe" + return; + + + gameBaseImport = new GamebaseImport(this); + gameBaseImport.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(gameBaseImport_ReadNewFileEvent); + importDelegate = new ImportDelegate(gameBaseImport.StartImport); + importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); + } + void gameBaseImport_ReadNewFileEvent(object sender, FileReadEventArgs e) + { + this.SetGUIProgressDialog(e.message, e.ctr); + } + public override void Refresh(bool bGUIMode) { DeleteFiles(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-03 19:59:11 UTC (rev 890) @@ -30,6 +30,7 @@ using System.Diagnostics; using System.IO; using SQLite.NET; +using System.Threading; using MediaPortal.Dialogs; using MediaPortal.GUI.Library; @@ -54,6 +55,7 @@ public ApplicationItemMame() { + // some nice working mame defaults... Title = "MAME"; Executable = "..Your path to mame.exe goes here..."; @@ -113,26 +115,20 @@ if (mpGUIMode) { - ShowProgressDialog("Import mame"); + ShowProgressDialog("Importing Mameitems.."); } - try - { - mameImport = new MameImport(this); - mameImport.StartImport(); - } - finally - { - if (mameImport != null) - { - mameImport.DeInit(); - } + mameImport = new MameImport(this); + mameImport.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(mameImport_OnReadNewFileEvent); + importDelegate = new ImportDelegate(mameImport.StartImport); + importDelegate.BeginInvoke(new AsyncCallback(ImportEnded),null); - if (mpGUIMode) - { - progressDialog.Close(); - } - } } + + void mameImport_OnReadNewFileEvent(object sender,FileReadEventArgs e) + { + this.SetGUIProgressDialog(e.message, e.ctr); + } + #endregion ApplicationItem Overloads } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/README.txt =================================================================== --- trunk/plugins/myGUIProgramsAlt/README.txt 2007-09-03 15:38:01 UTC (rev 889) +++ trunk/plugins/myGUIProgramsAlt/README.txt 2007-09-03 19:59:11 UTC (rev 890) @@ -5,7 +5,7 @@ chefkoch is doing stuff on this to,Great,it will for sure speed-up development! :--INSTALLATION -Copy contents of metadata-folder to MP root folder ,skin to relevant folder, and the GUIPrograms.dll to MP/windowsplugins to run. +Copy contents of metadata-folder to MP root folder ,skin to relevant folder, and the GUIProgramsAlt.dll to MP/windowsplugins to run. Copy SQLite.Dll to same folder as plugin .. Copy skin to relevant folder. There will possibly be db-changes and xml-changes between versions, so always make sure that you have a clean install between updates. @@ -33,7 +33,7 @@ Testing,bugfixing,codecleanup --Optimize some things if possibly +-Optimize some things if possible -Change graphics for fileinfobackground (it says mymovies...) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |