From: <nor...@us...> - 2007-09-29 15:26:28
|
Revision: 963 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=963&view=rev Author: northern_sky Date: 2007-09-29 08:26:22 -0700 (Sat, 29 Sep 2007) Log Message: ----------- minor changes Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -95,7 +95,7 @@ { progressTextBox.Text = importStartedText; isImportRunning = true; - CurApp.Refresh(false); + CurApp.ReImport(false); } finally { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -316,7 +316,7 @@ FilelinkItem filelink = (FilelinkItem)listViewItem.Tag; if (filelink != null) { - filelink.Delete(); + filelink.DeleteFileItem(); } } else @@ -324,7 +324,7 @@ FileItem file = (FileItem)listViewItem.Tag; if (file != null) { - file.Delete(); + file.DeleteFileItem(); } } } @@ -603,17 +603,21 @@ { importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.OnlyImportValidImages)), true); } - if (applicationItem.ImportMameMahjong) + + + if (applicationItem is ApplicationItemMame) { - importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportMahjongGames)), true); + if (((ApplicationItemMame)applicationItem).ImportMamePlaychoice10) + { + importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportPlaychoiceGames)), true); + } - } - if (applicationItem.ImportMamePlaychoice10) - { - importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportPlaychoiceGames)), true); - } - if (applicationItem is ApplicationItemMame) - { + if (((ApplicationItemMame)applicationItem).ImportMameMahjong) + { + importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportMahjongGames)), true); + + } + if (((ApplicationItemMame)applicationItem).ImportOriginalsOnly) { importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.OnlyImportOriginals)), true); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -1014,7 +1014,7 @@ if (currentApplicationItem != null) { currentApplicationItem.ImportFinishedEvent += new ApplicationItem.ImportFinishedEventHandler(currentApplicationItem_ImportFinishedEvent); - currentApplicationItem.Refresh(true); + currentApplicationItem.ReImport(true); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -57,7 +57,7 @@ fileItem = (FileItem) applicationItem.ItemList[i]; if (!File.Exists(fileItem.Filename)) { - fileItem.Delete(); + fileItem.DeleteFileItem(); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -51,19 +51,19 @@ { public abstract class ApplicationItem { - protected ImportBase importBase = null; + protected ImportBase importBase = null; #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(object sender ,FileReadEventArgs e) ; - public event RefreshInfoEventHandler RefreshInfoEvent = null; + public delegate void RefreshInfoEventHandler(object sender, FileReadEventArgs e); + public event RefreshInfoEventHandler RefreshInfoEvent = null; - public delegate void ImportFinishedEventHandler(object sender,EventArgs e); + public delegate void ImportFinishedEventHandler(object sender, EventArgs e); public event ImportFinishedEventHandler ImportFinishedEvent; public delegate void ImportDelegate(); @@ -77,37 +77,27 @@ { RefreshInfoEvent(this, e); } - + } public virtual void OnImportFinished(object sender, EventArgs e) { if (ImportFinishedEvent != null) { - ImportFinishedEvent(this,e); + ImportFinishedEvent(this, e); } } protected void ImportEnded(IAsyncResult result) { filesAreLoaded = false; - if (progressDialog != null) - { - progressDialog.Close(); - } - - - OnImportFinished(this, null); FixFileLinks(); - if (progressDialog != null) { progressDialog.Close(); progressDialog.ShowWaitCursor = false; - } - - + OnImportFinished(this, null); } #endregion Events/Delegates @@ -135,7 +125,6 @@ private List<ImportOption> importOptionList;//a list of options for the filesview private List<FileSettingOption> fileSettingList;//a list of which setting to use for filesview - bool enabled; int appPosition; string currentView = ""; @@ -143,8 +132,6 @@ public List<object> ItemList = new List<object>();//fileitems or links public bool filesAreLoaded = false; // load on demand.... public bool linksAreLoaded = false; // load on demand.... - bool importMamePlaychoice10 = false; - bool importMameMahjong = false; public string mameCatVerIniPath = ""; public string mameHistoryDatPath = ""; bool refreshGUIAllowed = false; @@ -155,7 +142,6 @@ string imageDirectories; // in one string for sqlite db field private string[] imageDirsSplitted; // imageDirectories splitted - string fileDirectory; string validExtensions; bool importValidImagesOnly; @@ -275,16 +261,6 @@ set { currentView = value; } } - public bool ImportMamePlaychoice10 - { - get { return importMamePlaychoice10; } - set { importMamePlaychoice10 = value; } - } - public bool ImportMameMahjong - { - get { return importMameMahjong; } - set { importMameMahjong = value; } - } // more Properties, maybe need some renaming or anything else public string FileDirectory @@ -292,14 +268,14 @@ get { return fileDirectory; } set { fileDirectory = value; } } - + public string ImageDirectory { get { return imageDirectories; } set { imageDirectories = value; - + //also do the split imageDirsSplitted = imageDirectories.Split(';'); for (int i = 0; i < imageDirsSplitted.Length; i++) @@ -355,7 +331,7 @@ public ApplicationItem() { - // .. init member variables ... + // .. init member variables ... appID = -1; fatherID = -1; title = ""; @@ -391,7 +367,7 @@ { progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); progressDialog.SetHeading(headerText); - progressDialog.SetLine(0,headerText); + progressDialog.SetLine(0, headerText); progressDialog.SetLine(1, ""); progressDialog.SetLine(2, ""); progressDialog.StartModal(GetID); @@ -403,28 +379,17 @@ //mpgui if (progressDialog != null) { - progressDialog.ShowProgressBar(true); progressDialog.ShowWaitCursor = true; progressDialog.SetLine(2, String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage)); // "last imported file {0}" progressDialog.SetPercentage(progressBarCtr); progressDialog.Progress(); - - } - else - { - - - - - } - // SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); } - + protected void DoPreLaunch() { if (waitForExit && (preLaunch != "")) @@ -491,22 +456,17 @@ protected virtual void Import(bool mpGUIMode) { - + importBase.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(Import_ReadNewFileEvent); importDelegate = new ImportDelegate(importBase.StartImport); importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); - + } #endregion protected methods #region Public Methods - public virtual string CurrentFilePath() - { - return this.FileDirectory; - } - public void Assign(ApplicationItem sourceApp) { this.Enabled = sourceApp.Enabled; @@ -533,30 +493,6 @@ this.PlatformId = sourceApp.PlatformId; } - public FileItem PrevFile(FileItem curFile) - { - if (ItemList == null) return null; - if (ItemList.Count == 0) return null; - - int index = this.ItemList.IndexOf(curFile); - index = index - 1; - if (index < 0) - index = ItemList.Count - 1; - return (FileItem)ItemList[index]; - } - - public FileItem NextFile(FileItem curFile) - { - if (ItemList == null) return null; - if (ItemList.Count == 0) return null; - - int index = this.ItemList.IndexOf(curFile); - index = index + 1; - if (index > ItemList.Count - 1) - index = 0; - return (FileItem)ItemList[index]; - } - /// <summary> /// look for FileItem and launch it using the found object /// </summary> @@ -579,7 +515,7 @@ // use the APPLICATION launcher and add current file information if (this.Executable != "") - { + { // executable of the application procStart.FileName = this.Executable; @@ -715,9 +651,10 @@ return false; } - public virtual void Refresh(bool mpGuiMode) + public virtual void ReImport(bool mpGuiMode) { - // descendant classes do that! + DeleteFiles(); + Import(mpGuiMode); } public void LoadFromXmlProfile(XmlNode node) @@ -906,7 +843,7 @@ } } - private void Update() + private void UpdateApplicationItem() { if (ApplicationItemId == -1) return; @@ -1042,7 +979,7 @@ if (appID == -1) Insert(); else - Update(); + UpdateApplicationItem(); } protected virtual void FixFileLinks() @@ -1113,7 +1050,7 @@ if (fileItem == null) return; bool foundThumb = false; - + while (!foundThumb) { thumbFolderIndex++; @@ -1240,6 +1177,6 @@ #endregion - + } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -76,11 +76,8 @@ return true; } - public override void Refresh(bool mpGuiMode) - { - Import(mpGuiMode); - } + protected override void Import(bool mpGUIMode) { if (mpGUIMode) @@ -88,7 +85,6 @@ ShowProgressDialog("Importing from folders.."); } - ValidExtensions = ValidExtensions.Replace(" ", ""); importBase = new DirectoryImport(this); base.Import(mpGUIMode); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -34,7 +34,7 @@ /// <summary> /// Factory like object that creates the matchin Application descendant class /// depending on the itemType parameter - /// Descendant classes differ in LOADING and REFRESHING filelists + /// </summary> public class ItemFactory { @@ -165,8 +165,7 @@ { FilterItem filterItem = new FilterItem( ); filterItem.Title = row["title"].ToString() ; - // newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); - //newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); ; + return filterItem; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -60,25 +60,15 @@ if ((ApplicationItemSource == "") || (!File.Exists(ApplicationItemSource))) return; - if (mpGUIMode) { ShowProgressDialog("Importing from gameBase.."); } importBase = new GamebaseImport(this); - base.Import(mpGUIMode); - } - - - public override void Refresh(bool bGUIMode) - { - DeleteFiles(); - Import(bGUIMode); - } #endregion ApplicationItem Overloads } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -50,10 +50,23 @@ #region Variables bool importOriginalsOnly = true; + bool importMamePlaychoice10 = false; + bool importMameMahjong = false; - #endregion Variables + public bool ImportMamePlaychoice10 + { + get { return importMamePlaychoice10; } + set { importMamePlaychoice10 = value; } + } + public bool ImportMameMahjong + { + get { return importMameMahjong; } + set { importMameMahjong = value; } + } + + public ApplicationItemMame() { @@ -94,19 +107,6 @@ #region ApplicationItem Overloads - public override string CurrentFilePath() - { - return this.FileDirectory; - } - - - - public override void Refresh(bool bGUIMode) - { - DeleteFiles(); - Import(bGUIMode); - } - protected override void Import(bool mpGUIMode) { @@ -118,7 +118,6 @@ base.Import(mpGUIMode); } - #endregion ApplicationItem Overloads } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -331,17 +331,7 @@ categoryData = value; } } - /* public bool IsFolder - { - get - { - return isFolder; - } - set - { - isFolder = value; - } - }*/ + public string GameInfoURL { get { return gameInfoURL; } @@ -386,33 +376,8 @@ return nRes; } - // - // no need for these methods anymore - // + - //public string ExtractImageExtension() - //{ - // string strRes = ""; - // string[] parts = this.Imagefile.Split( '.' ); - // if ( parts.Length >= 2 ) - // { - // // there was an extension - // strRes = '.' + parts[parts.Length - 1]; - // } - // return strRes; - //} - - //public string ExtractImageFileNoPath() - //{ - // string strRes = ""; - // string[] parts = this.Imagefile.Split( '\\' ); - // if ( parts.Length >= 1 ) - // { - // strRes = parts[parts.Length - 1]; - // } - // return strRes; - //} - public void SetProperties() { /* string strThumb = MediaPortal.Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, Title);*/ @@ -440,7 +405,7 @@ GUIPropertyManager.SetProperty("#iswatched", strValue);*/ } - private void Insert() + private void InsertFileItem() { SQLiteParameter[] parameterArray = new SQLiteParameter[15]; @@ -517,7 +482,7 @@ - private void Update() + private void UpdateFileItem() { try @@ -604,15 +569,15 @@ { if ( fileID == -1 ) { - Insert(); + InsertFileItem(); } else { - Update(); + UpdateFileItem(); } } - public virtual void Delete() + public virtual void DeleteFileItem() { if ( this.FileID >= 0 ) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -65,7 +65,7 @@ { if (Exists()) { - Update(); + } else { @@ -73,7 +73,7 @@ } } - public override void Delete() + public override void DeleteFileItem() { try @@ -131,11 +131,5 @@ Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } } - - private void Update() - { - // nothing to update (yet) - //...... as all tblFileLinkItem fields are primary key fields... - } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |