From: <che...@us...> - 2007-06-28 22:03:17
|
Revision: 652 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=652&view=rev Author: chef_koch Date: 2007-06-28 15:03:15 -0700 (Thu, 28 Jun 2007) Log Message: ----------- added new methods which uses the thumbs folders, but did not Enabled them yet, just to prevent loosing the code ;) if we have setting for that we also can decide which should be used Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-28 21:16:18 UTC (rev 651) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-28 22:03:15 UTC (rev 652) @@ -1180,24 +1180,20 @@ public virtual string GetCurThumb(GUIListItem item) { - if (item.MusicTag == null) - { - return ""; - } + if (item.MusicTag == null) return ""; + if (item.MusicTag is FileItem) { FileItem curFile = item.MusicTag as FileItem; return GetCurThumb(curFile); + //return GetCurThumbFromThumbsDir(curFile); } else if (item.MusicTag is ApplicationItem) { ApplicationItem curApp = item.MusicTag as ApplicationItem; return curApp.Imagefile; } - else - { - return ""; - } + else return ""; } public string GetCurThumb(FileItem fileItem) @@ -1236,6 +1232,36 @@ return curThumb; } + public string GetCurThumbFromThumbsDir(FileItem fileItem) + { + string curThumb = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), + fileItem.Title + ); + + if (curThumb != "") + if (thumbIndex > 0) + { + // try to find another thumb.... + // use the myGames convention: + // every thumb has the postfix "_1", "_2", etc with the same file extension + string cand = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), + fileItem.Title + "_" + thumbIndex.ToString() + ); + + if (cand != "") + curThumb = cand; + else + { + thumbIndex = 0; // restart at the first thumb! + //GetNextThumbFolderIndex(fileItem); + } + } + + return curThumb; + } + public void ResetThumbs() { thumbIndex = 0; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-06-28 21:16:18 UTC (rev 651) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-06-28 22:03:15 UTC (rev 652) @@ -29,6 +29,7 @@ using System.IO; using SQLite.NET; +using MediaPortal.Configuration; using MediaPortal.GUI.Library; using GUIPrograms; @@ -858,6 +859,48 @@ } return strCand; } + + public string GetNewValidImageFileFromThumbsDir(ApplicationItem curApp, string strExtension) + { + if (curApp == null) return ""; + if ((this.Imagefile == "") && (this.Filename == "")) + return ""; + + string strCand = ""; + int iImgIndex = -1; + bool bFound = false; + + string folder = Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + curApp.Title); + if (!Directory.Exists(folder)) + Directory.CreateDirectory(folder); + + while (!bFound) + { + iImgIndex++; + if (iImgIndex == 0) + { + strCand = String.Format("{0}\\{1}{2}", + folder, + Path.GetFileNameWithoutExtension(this.Filename), + strExtension + ); + } + else + { + strCand = String.Format("{0}\\{1}_{2}{3}", + folder, + Path.GetFileNameWithoutExtension(this.Filename), + iImgIndex, + strExtension + ); + } + bFound = !File.Exists(strCand); + } + + return strCand; + } + + public void DeleteImages(ApplicationItem curApp) { if (curApp == null) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs 2007-06-28 21:16:18 UTC (rev 651) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs 2007-06-28 22:03:15 UTC (rev 652) @@ -281,8 +281,8 @@ public void DownloadImages(ApplicationItem curApp, FileItem curFile) { - if (curFile == null) - return; + if (curFile == null) return; + int i = 0; string strFile = ""; @@ -297,6 +297,7 @@ i++; strFile = curFile.GetNewValidImageFile(curApp, Path.GetExtension(imageUrl)); + //strFile = curFile.GetNewValidImageFileFromThumbsDir(curApp, Path.GetExtension(imageUrl)); MediaPortal.Util.Utils.DownLoadImage(imageUrl, strFile); if ((File.Exists(strFile)) && (curFile.Imagefile == "")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-28 22:33:42
|
Revision: 653 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=653&view=rev Author: chef_koch Date: 2007-06-28 15:33:41 -0700 (Thu, 28 Jun 2007) Log Message: ----------- added a bool variable to Database/DatabaseHandler.cs for checking which ThumbPaths should be used Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-28 22:03:15 UTC (rev 652) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-28 22:33:41 UTC (rev 653) @@ -674,8 +674,18 @@ if (guiListItem.MusicTag == null) return; FileItem curFileItem = (FileItem)guiListItem.MusicTag; if (curFileItem == null) return; + + string imgFile = String.Empty; + + if (DatabaseHandler.useMPsThumbDirectory) + imgFile = curFileItem.Imagefile; + else + imgFile = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), + Path.GetFileNameWithoutExtension(curFileItem.Filename) + ); - if (curFileItem.Imagefile != "") + if (imgFile != "") { guiListItem.ThumbnailImage = curFileItem.Imagefile; guiListItem.IconImageBig = curFileItem.Imagefile; @@ -1185,8 +1195,11 @@ if (item.MusicTag is FileItem) { FileItem curFile = item.MusicTag as FileItem; - return GetCurThumb(curFile); - //return GetCurThumbFromThumbsDir(curFile); + + if (DatabaseHandler.useMPsThumbDirectory) + return GetCurThumbFromThumbsDir(curFile); + else + return GetCurThumb(curFile); } else if (item.MusicTag is ApplicationItem) { @@ -1236,7 +1249,7 @@ { string curThumb = MediaPortal.Util.Utils.GetCoverArtName( Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), - fileItem.Title + Path.GetFileNameWithoutExtension(fileItem.Filename) ); if (curThumb != "") @@ -1247,7 +1260,7 @@ // every thumb has the postfix "_1", "_2", etc with the same file extension string cand = MediaPortal.Util.Utils.GetCoverArtName( Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), - fileItem.Title + "_" + thumbIndex.ToString() + Path.GetFileNameWithoutExtension(fileItem.Filename) + "_" + thumbIndex.ToString() ); if (cand != "") Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-06-28 22:03:15 UTC (rev 652) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-06-28 22:33:41 UTC (rev 653) @@ -50,6 +50,8 @@ static private ProgramViewHandler viewHandler = null; private const string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; + public static bool useMPsThumbDirectory = false; + // singleton. Dont allow any instance of this class private DatabaseHandler() { } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs 2007-06-28 22:03:15 UTC (rev 652) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs 2007-06-28 22:33:41 UTC (rev 653) @@ -31,6 +31,9 @@ using GUIPrograms.ApplicationItems; +// just 4 useMPsThumbsDirectory variable +using GUIPrograms.Database; + namespace GUIPrograms.FileItems { /// <summary> @@ -296,8 +299,10 @@ // imageUrl contains a full URL with one picture to download i++; - strFile = curFile.GetNewValidImageFile(curApp, Path.GetExtension(imageUrl)); - //strFile = curFile.GetNewValidImageFileFromThumbsDir(curApp, Path.GetExtension(imageUrl)); + if (DatabaseHandler.useMPsThumbDirectory) + strFile = curFile.GetNewValidImageFileFromThumbsDir(curApp, Path.GetExtension(imageUrl)); + else + strFile = curFile.GetNewValidImageFile(curApp, Path.GetExtension(imageUrl)); MediaPortal.Util.Utils.DownLoadImage(imageUrl, strFile); if ((File.Exists(strFile)) && (curFile.Imagefile == "")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-01 13:47:39
|
Revision: 659 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=659&view=rev Author: northern_sky Date: 2007-07-01 06:47:34 -0700 (Sun, 01 Jul 2007) Log Message: ----------- DB: moved System,Manufacturer, Genre to own enttis. Added basic support for config of these, NOTE: tested around, but still some more work to do + remove redunant code. Slowed down gamebase import and mame, as we also import genres,manufacturer etc to lexicon tables. Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-01 07:49:46 UTC (rev 658) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-01 13:47:34 UTC (rev 659) @@ -851,7 +851,7 @@ // won't work in multiuser environment :) SQLiteResultSet results; int res = 0; - results = sqlDB.Execute("SELECT MAX(APPID) FROM tblApplicationItem"); + results = sqlDB.Execute("SELECT MAX(applicationId) FROM tblApplicationItem"); SQLiteResultSet.Row arr = results.Rows[0]; if (arr.fields[0] != null) { @@ -878,8 +878,8 @@ INSERT INTO tblApplicationItem ( - appid, - fatherID, + applicationId, + fatherNodeId, title, filename, arguments, @@ -973,7 +973,7 @@ importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + @"', iposition = " + Position + @", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + @"', - fatherID = '" + FatherID + @"', + fatherNodeId = '" + FatherID + @"', enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + @"', GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) +@"', contentID = '" + ContentID + @"', @@ -982,7 +982,7 @@ preLaunch = '" + ProgramUtils.Encode(PreLaunch) + @"', postLaunch = '" + ProgramUtils.Encode(PostLaunch) + @"' - WHERE appID = " + AppID); + WHERE applicationId = " + AppID); sqlDB.Execute(sql); } catch (SQLiteException ex) @@ -1001,7 +1001,7 @@ { DeleteFiles(); DeleteFileLinks(); - sqlDB.Execute(String.Format("delete from tblApplicationItem where appid = {0}", AppID)); + sqlDB.Execute(String.Format("delete from tblApplicationItem where applicationId = {0}", AppID)); } catch (SQLiteException ex) { @@ -1017,7 +1017,7 @@ try { - sqlDB.Execute(String.Format("delete from tblFileItem where appid = {0}", AppID)); + sqlDB.Execute(String.Format("delete from tblFileItem where applicationId = {0}", AppID)); } catch (SQLiteException ex) { @@ -1032,7 +1032,7 @@ try { - sqlDB.Execute(String.Format("delete from tblFilterItem where appid = {0} or grouperappid = {0}", AppID)); + sqlDB.Execute(String.Format("delete from tblFilterItem where applicationId = {0} or grouperappid = {0}", AppID)); } catch (SQLiteException ex) { @@ -1086,10 +1086,10 @@ // are out of sync... fix this here! // query with data to fix - string sqlSelectDataToFix = String.Format("select fi.appid, fi.fileid as oldfileid, f.fileid as newfileid, fi.filename as filename from tblFilterItem fi, tblFileItem f where fi.appID = f.appid and fi.filename = f.filename and fi.appID = {0}", AppID); + string sqlSelectDataToFix = String.Format("select fi.applicationId, fi.fileid as oldfileid, f.fileid as newfileid, fi.filename as filename from tblFilterItem fi, tblFileItem f where fi.applicationId = f.applicationId and fi.filename = f.filename and fi.applicationId = {0}", AppID); // update command to fix one single link - string sqlFixOneLink = "update tblFilterItem set fileID = {0}, tag = 0 where appID = {1} and filename = '{2}'"; + string sqlFixOneLink = "update tblFilterItem set fileID = {0}, tag = 0 where applicationId = {1} and filename = '{2}'"; SQLiteResultSet rows2fix; @@ -1097,7 +1097,7 @@ try { // 1) initialize TAG - sqlDB.Execute(String.Format("update tblFilterItem set tag = 1234 where appid = {0}", AppID)); + sqlDB.Execute(String.Format("update tblFilterItem set tag = 1234 where applicationId = {0}", AppID)); // 2) fix all fileids of the newly imported files rows2fix = sqlDB.Execute(sqlSelectDataToFix); @@ -1112,7 +1112,7 @@ } // 3) delete untouched links ( they were not imported anymore ) - sqlDB.Execute(String.Format("delete from tblFilterItem where appid = {0} and tag = 1234", AppID)); + sqlDB.Execute(String.Format("delete from tblFilterItem where applicationId = {0} and tag = 1234", AppID)); } catch (SQLiteException ex) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-01 07:49:46 UTC (rev 658) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-01 13:47:34 UTC (rev 659) @@ -58,8 +58,8 @@ ApplicationItem newApp = appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "source_type")); newApp.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); newApp.Enabled = ProgramUtils.GetBool(results, recordIndex, "enabled"); - newApp.AppID = ProgramUtils.GetIntDef(results, recordIndex, "appid", -1); - newApp.FatherID = ProgramUtils.GetIntDef(results, recordIndex, "fatherID", -1); + newApp.AppID = ProgramUtils.GetIntDef(results, recordIndex, "applicationId", -1); + newApp.FatherID = ProgramUtils.GetIntDef(results, recordIndex, "fatherNodeId", -1); newApp.Title = ProgramUtils.Get(results, recordIndex, "title"); newApp.Filename = ProgramUtils.Get(results, recordIndex, "filename"); newApp.Arguments = ProgramUtils.Get(results, recordIndex, "arguments"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-01 07:49:46 UTC (rev 658) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-01 13:47:34 UTC (rev 659) @@ -57,21 +57,28 @@ static DatabaseHandler() { + string DatabasePath = Config.GetFile(Config.Dir.Database, DATABASEFILE); + try { - // Open database - try + + //check if database exists + if (!File.Exists(DatabasePath)) { - Directory.CreateDirectory(Config.GetFolder(Config.Dir.Database)); - } - catch (Exception) { } + sqlDB = new SQLiteClient(Config.GetFile(Config.Dir.Database, DATABASEFILE)); + DatabaseUtility.SetPragmas(sqlDB); - sqlDB = new SQLiteClient(Config.GetFile(Config.Dir.Database, DATABASEFILE )); - DatabaseUtility.SetPragmas(sqlDB); + // make sure the DB-structure is complete + CreateDBTables(); - // make sure the DB-structure is complete - CreateDBTables(); + //fill upp some default lexicon values + InsertDefaultDBValues(); + } + else + { + sqlDB = new SQLiteClient(Config.GetFile(Config.Dir.Database, DATABASEFILE)); + } } catch (SQLiteException ex) { @@ -99,18 +106,140 @@ if (sqlDB == null) return false; - DatabaseUtility.AddTable(sqlDB, "tblApplicationItem", "CREATE TABLE tblApplicationItem (appid integer primary key, fatherID integer, title text, filename text, arguments text, windowstyle text, startupdir text, useshellexecute text, usequotes text, source_type text, source text, imagefile text, filedirectory text, imagedirectory text, validextensions text, enabled text, importvalidimagesonly text, iposition integer, enableGUIRefresh text, GUIRefreshPossible text, contentID integer, systemdefault text, waitforexit text, preLaunch text, postLaunch text)"); - DatabaseUtility.AddTable(sqlDB, "tblFileItem", "CREATE TABLE tblFileItem (fileid integer primary key, appid integer, title text, filename text, imagefile text, mainGenre text, subGenre text, country text, manufacturer text, year integer, rating integer, overview text, system text, import_flag integer, lastTimeLaunched text, launchcount integer, isfolder text, uppertitle text, tagdata text, categorydata text, gameInfoUrl text)"); - DatabaseUtility.AddTable(sqlDB, "tblFilterItem", "CREATE TABLE tblFilterItem (appid integer, grouperAppID integer, fileID integer, filename text, tag integer)"); - DatabaseUtility.AddTable(sqlDB, "tblSetting", "CREATE TABLE tblSetting (settingid integer primary key, key text, value text)"); + + DatabaseUtility.AddTable(sqlDB, "tblApplicationItem", @"CREATE TABLE + tblApplicationItem + ( + applicationId INTEGER PRIMARY KEY, + fatherNodeId INTEGER, + title TEXT, + filename TEXT, + arguments TEXT, + windowstyle TEXT, + startupdir TEXT, + useshellexecute TEXT, + usequotes TEXT, + source_type TEXT, + source TEXT, + imagefile TEXT, + filedirectory TEXT, + imagedirectory TEXT, + validextensions TEXT, + enabled TEXT, + importvalidimagesonly TEXT, + iposition INTEGER, + enableGUIRefresh TEXT, + GUIRefreshPossible TEXT, + contentID INTEGER, + systemdefault TEXT, + waitforexit TEXT, + preLaunch TEXT, + postLaunch TEXT + )"); + + DatabaseUtility.AddTable(sqlDB, "tblFileItem", "CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, mainGenreId INTEGER, subGenreId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, systemId INTEGER, import_flag INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, isfolder TEXT, uppertitle TEXT, tagdata TEXT, categorydata TEXT, gameInfoUrl TEXT)"); + DatabaseUtility.AddTable(sqlDB, "tblFilterItem", "CREATE TABLE tblFilterItem (applicationId INTEGER, grouperAppID INTEGER, fileID INTEGER, filename TEXT, tag INTEGER)"); + DatabaseUtility.AddTable(sqlDB, "tblSetting", "CREATE TABLE tblSetting (settingid INTEGER PRIMARY KEY, key TEXT, value TEXT)"); - DatabaseUtility.AddIndex(sqlDB, "idxFile1", "CREATE INDEX idxFile1 ON tblFileItem(appid)"); - DatabaseUtility.AddIndex(sqlDB, "idxApp1", "CREATE INDEX idxApp1 ON tblApplicationItem(fatherID)"); - DatabaseUtility.AddIndex(sqlDB, "idxFilterItem1", "CREATE UNIQUE INDEX idxFilterItem1 ON tblFilterItem(appID, fileID, grouperAppID)"); + DatabaseUtility.AddTable(sqlDB, "tblGenre", @"CREATE TABLE + tblGenre + ( + genreId INTEGER PRIMARY KEY, + genre TEXT + )"); + + DatabaseUtility.AddTable(sqlDB, "tblSystem", @"CREATE TABLE + tblSystem + ( + systemId INTEGER PRIMARY KEY, + system TEXT + )"); + DatabaseUtility.AddTable(sqlDB, "tblManufacturer", @"CREATE TABLE + tblManufacturer + ( + manufacturerId INTEGER PRIMARY KEY, + manufacturer TEXT + )"); + + + DatabaseUtility.AddIndex(sqlDB, "idxFile1", "CREATE INDEX idxFile1 ON tblFileItem(applicationId)"); + DatabaseUtility.AddIndex(sqlDB, "idxApp1", "CREATE INDEX idxApp1 ON tblApplicationItem(fatherNodeId)"); + DatabaseUtility.AddIndex(sqlDB, "idxFilterItem1", "CREATE UNIQUE INDEX idxFilterItem1 ON tblFilterItem(applicationId, fileID, grouperAppID)"); + return true; } + /// <summary> + /// Inserting some default values so that the db is preloaded + /// Should always be there. + /// </summary> + private static void InsertDefaultDBValues() + { + //Insert these + + sqlDB.Execute(@"INSERT INTO + tblGenre + ( + genre + ) + VALUES + ( + 'Unknown' + )"); + + sqlDB.Execute(@"INSERT INTO + tblManufacturer + ( + manufacturer + ) + VALUES + ( + 'Unknown' + )"); + + + sqlDB.Execute(@"INSERT INTO + tblSystem + ( + system + ) + VALUES + ( + 'Unknown' + )"); + + FillDefaultDBLexiconHelper("tblSystem","system",CreateSystemLexiconList()); + FillDefaultDBLexiconHelper("tblManufacturer","manufacturer",CreateManufacturerLexiconList()); + FillDefaultDBLexiconHelper("tblGenre", "genre", CreateGenreLexiconList()); + + } + + private static void FillDefaultDBLexiconHelper(string tableName,string columnName,List<string> itemList) + {// dont support parameters..... yet at least + //AND mediaportals sqlite support dont support multiple inserst with ; bettween... gaaa + //change to to net provider as soon as we can + string sqlStmt = ""; + + foreach (string insertValue in itemList) + { + sqlStmt = @" + INSERT INTO + " + tableName + @" + ( + " + columnName + @" + ) + VALUES + ( + '" + insertValue + @"' + );"; + + sqlDB.Execute(sqlStmt); + } + + + } + #region dbsettings static public string ReadSetting(string Key) { @@ -193,6 +322,88 @@ } #endregion dbsettings + public static int LexiconDataExists(string tableName, string columnName, string fieldValue) + { + SQLiteResultSet result = null; + + string sqlStmt = @" + SELECT + * + + FROM + " + tableName + @" + + WHERE + " + columnName + @" LIKE '" + fieldValue + "'"; + + string sqlStmtInsert = @" + INSERT INTO + " + tableName + @" + ( + " + columnName + @" + ) + VALUES + ( + '" + fieldValue + @"' + )"; + + try + { + result = sqlDB.Execute(sqlStmt); + if (result.Rows.Count > 0) + { + return Convert.ToInt32(result.Rows[0].fields[0]); + } + else + {//lexion didnt exist, we save it + + sqlDB.Execute(sqlStmtInsert); + return sqlDB.LastInsertID(); + } + } + catch (SQLiteException ex) + { + throw ex; + } + } + + + #region default lexiconvalues + private static List<string> CreateGenreLexiconList() + { + List<string> genreList = new List<string>(); + + + genreList.Add("Shooter"); + genreList.Add("Platform"); + genreList.Add("Adventure"); + + return genreList; + } + + private static List<string> CreateManufacturerLexiconList() + { + List<string> manufacturerList = new List<string>(); + + manufacturerList.Add("Sega"); + manufacturerList.Add("Nintendo"); + manufacturerList.Add("Konami"); + + return manufacturerList; + } + + private static List<string> CreateSystemLexiconList() + { + List<string> systemList = new List<string>(); + + systemList.Add("Sega Mastersystem"); + systemList.Add("Arcade"); + systemList.Add("PC"); + return systemList; + } + + #endregion default lexiconvalues + public static ProgramViewHandler ViewHandler { get { return viewHandler; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-01 07:49:46 UTC (rev 658) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-01 13:47:34 UTC (rev 659) @@ -555,7 +555,7 @@ newLink.TargetAppID = curFile.AppID; // the applicationItem where the launch will effectively happen.... newLink.Filename = curFile.Filename; newLink.Write(); - // Log.Info("Add to Favourites groupAppID:{0} Title:{1} fileID:{2} appID:{3}", GrouperAppID, currentFileItem.Title, currentFileItem.FileID, currentFileItem.AppID); + // Log.Info("Add to Favourites groupAppID:{0} Title:{1} fileID:{2} appID:{3}", GrouperAppID, currentFileItem.Title, currentFileItem.FileID, currentFileItem.applicationId); } foreach (ApplicationItem app in apps) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-01 07:49:46 UTC (rev 658) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-01 13:47:34 UTC (rev 659) @@ -36,24 +36,20 @@ this.cbRating = new MediaPortal.UserInterface.Controls.MPComboBox(); this.txtOverview = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lblOverview = new MediaPortal.UserInterface.Controls.MPLabel(); - this.txtSystem = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lblSystem = new MediaPortal.UserInterface.Controls.MPLabel(); this.txtCountry = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lblCountry = new MediaPortal.UserInterface.Controls.MPLabel(); - this.txtCategoryData = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lblCategoryData = new MediaPortal.UserInterface.Controls.MPLabel(); - this.gbExtended = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.txtTagData = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lblTagData = new MediaPortal.UserInterface.Controls.MPLabel(); - this.tabPage2 = new MediaPortal.UserInterface.Controls.MPTabPage(); this.lblRating = new MediaPortal.UserInterface.Controls.MPLabel(); this.gbFileDetails = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.systemComboBox = new System.Windows.Forms.ComboBox(); + this.manufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.subGenreComboBox = new System.Windows.Forms.ComboBox(); + this.genreComboBox = new System.Windows.Forms.ComboBox(); + this.subGenreLabel = new System.Windows.Forms.Label(); this.txtYear = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lblYear = new MediaPortal.UserInterface.Controls.MPLabel(); - this.txtManufacturer = new MediaPortal.UserInterface.Controls.MPTextBox(); this.lblManufacturer = new MediaPortal.UserInterface.Controls.MPLabel(); - this.txtGenre = new MediaPortal.UserInterface.Controls.MPTextBox(); - this.lblGenre = new MediaPortal.UserInterface.Controls.MPLabel(); + this.genreLabel = new MediaPortal.UserInterface.Controls.MPLabel(); this.lblImageFile = new MediaPortal.UserInterface.Controls.MPLabel(); this.btnImageFile = new MediaPortal.UserInterface.Controls.MPButton(); this.txtFilename = new MediaPortal.UserInterface.Controls.MPTextBox(); @@ -65,13 +61,33 @@ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.tcFileItemData = new MediaPortal.UserInterface.Controls.MPTabControl(); this.tabPage1 = new MediaPortal.UserInterface.Controls.MPTabPage(); + this.generalFileOptionsTab = new System.Windows.Forms.TabPage(); + this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.editSystemComboBox = new System.Windows.Forms.ComboBox(); + this.removeSystemLabel = new System.Windows.Forms.Label(); + this.removeSystemButton = new System.Windows.Forms.Button(); + this.addSystemLabel = new System.Windows.Forms.Label(); + this.editSystemTextBox = new System.Windows.Forms.TextBox(); + this.addSystemButton = new System.Windows.Forms.Button(); + this.editManufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.removeManufacturerLabel = new System.Windows.Forms.Label(); + this.removeManufacturerButton = new System.Windows.Forms.Button(); + this.addManufacturerLabel = new System.Windows.Forms.Label(); + this.editManufacturerTextBox = new System.Windows.Forms.TextBox(); + this.addManufacturerButton = new System.Windows.Forms.Button(); + this.editGenreComboBox = new System.Windows.Forms.ComboBox(); + this.removeGenreLabel = new System.Windows.Forms.Label(); + this.removeGenreButton = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.editGenreTextBox = new System.Windows.Forms.TextBox(); + this.addGenreButton = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.btnCancel = new MediaPortal.UserInterface.Controls.MPButton(); - this.gbExtended.SuspendLayout(); - this.tabPage2.SuspendLayout(); this.gbFileDetails.SuspendLayout(); this.tcFileItemData.SuspendLayout(); this.tabPage1.SuspendLayout(); + this.generalFileOptionsTab.SuspendLayout(); + this.generalFileItemOptionsGroupBox.SuspendLayout(); this.SuspendLayout(); // // gameinfoURLTextBox @@ -80,7 +96,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.gameinfoURLTextBox.Location = new System.Drawing.Point(97, 267); this.gameinfoURLTextBox.Name = "gameinfoURLTextBox"; - this.gameinfoURLTextBox.Size = new System.Drawing.Size(365, 21); + this.gameinfoURLTextBox.Size = new System.Drawing.Size(365, 20); this.gameinfoURLTextBox.TabIndex = 66; // // gameInfoURLLabel @@ -88,7 +104,7 @@ this.gameInfoURLLabel.AutoSize = true; this.gameInfoURLLabel.Location = new System.Drawing.Point(8, 270); this.gameInfoURLLabel.Name = "gameInfoURLLabel"; - this.gameInfoURLLabel.Size = new System.Drawing.Size(78, 13); + this.gameInfoURLLabel.Size = new System.Drawing.Size(80, 13); this.gameInfoURLLabel.TabIndex = 65; this.gameInfoURLLabel.Text = "Gameinfo URL:"; // @@ -156,26 +172,16 @@ this.lblOverview.AutoSize = true; this.lblOverview.Location = new System.Drawing.Point(8, 294); this.lblOverview.Name = "lblOverview"; - this.lblOverview.Size = new System.Drawing.Size(57, 13); + this.lblOverview.Size = new System.Drawing.Size(55, 13); this.lblOverview.TabIndex = 61; this.lblOverview.Text = "Overview:"; // - // txtSystem - // - this.txtSystem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtSystem.BorderColor = System.Drawing.Color.Empty; - this.txtSystem.Location = new System.Drawing.Point(97, 240); - this.txtSystem.Name = "txtSystem"; - this.txtSystem.Size = new System.Drawing.Size(365, 21); - this.txtSystem.TabIndex = 10; - // // lblSystem // this.lblSystem.AutoSize = true; this.lblSystem.Location = new System.Drawing.Point(8, 243); this.lblSystem.Name = "lblSystem"; - this.lblSystem.Size = new System.Drawing.Size(46, 13); + this.lblSystem.Size = new System.Drawing.Size(44, 13); this.lblSystem.TabIndex = 59; this.lblSystem.Text = "System:"; // @@ -186,7 +192,7 @@ this.txtCountry.BorderColor = System.Drawing.Color.Empty; this.txtCountry.Location = new System.Drawing.Point(97, 213); this.txtCountry.Name = "txtCountry"; - this.txtCountry.Size = new System.Drawing.Size(365, 21); + this.txtCountry.Size = new System.Drawing.Size(365, 20); this.txtCountry.TabIndex = 9; // // lblCountry @@ -194,84 +200,17 @@ this.lblCountry.AutoSize = true; this.lblCountry.Location = new System.Drawing.Point(8, 216); this.lblCountry.Name = "lblCountry"; - this.lblCountry.Size = new System.Drawing.Size(50, 13); + this.lblCountry.Size = new System.Drawing.Size(46, 13); this.lblCountry.TabIndex = 57; this.lblCountry.Text = "Country:"; // - // txtCategoryData - // - this.txtCategoryData.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.txtCategoryData.BorderColor = System.Drawing.Color.Empty; - this.txtCategoryData.Location = new System.Drawing.Point(8, 241); - this.txtCategoryData.Multiline = true; - this.txtCategoryData.Name = "txtCategoryData"; - this.txtCategoryData.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtCategoryData.Size = new System.Drawing.Size(489, 200); - this.txtCategoryData.TabIndex = 64; - // - // lblCategoryData - // - this.lblCategoryData.Location = new System.Drawing.Point(8, 215); - this.lblCategoryData.Name = "lblCategoryData"; - this.lblCategoryData.Size = new System.Drawing.Size(100, 18); - this.lblCategoryData.TabIndex = 65; - this.lblCategoryData.Text = "Category-Data:"; - // - // gbExtended - // - this.gbExtended.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.gbExtended.Controls.Add(this.txtCategoryData); - this.gbExtended.Controls.Add(this.lblCategoryData); - this.gbExtended.Controls.Add(this.txtTagData); - this.gbExtended.Controls.Add(this.lblTagData); - this.gbExtended.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.gbExtended.Location = new System.Drawing.Point(8, 9); - this.gbExtended.Name = "gbExtended"; - this.gbExtended.Size = new System.Drawing.Size(505, 449); - this.gbExtended.TabIndex = 0; - this.gbExtended.TabStop = false; - // - // txtTagData - // - this.txtTagData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtTagData.BorderColor = System.Drawing.Color.Empty; - this.txtTagData.Location = new System.Drawing.Point(8, 34); - this.txtTagData.Multiline = true; - this.txtTagData.Name = "txtTagData"; - this.txtTagData.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtTagData.Size = new System.Drawing.Size(489, 156); - this.txtTagData.TabIndex = 62; - // - // lblTagData - // - this.lblTagData.Location = new System.Drawing.Point(8, 17); - this.lblTagData.Name = "lblTagData"; - this.lblTagData.Size = new System.Drawing.Size(100, 17); - this.lblTagData.TabIndex = 63; - this.lblTagData.Text = "Tag-Data:"; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.gbExtended); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Size = new System.Drawing.Size(521, 466); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Extended"; - this.tabPage2.UseVisualStyleBackColor = true; - // // lblRating // this.lblRating.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.lblRating.AutoSize = true; this.lblRating.Location = new System.Drawing.Point(229, 189); this.lblRating.Name = "lblRating"; - this.lblRating.Size = new System.Drawing.Size(42, 13); + this.lblRating.Size = new System.Drawing.Size(41, 13); this.lblRating.TabIndex = 55; this.lblRating.Text = "Rating:"; // @@ -280,23 +219,25 @@ this.gbFileDetails.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.gbFileDetails.Controls.Add(this.systemComboBox); + this.gbFileDetails.Controls.Add(this.manufacturerComboBox); + this.gbFileDetails.Controls.Add(this.subGenreComboBox); + this.gbFileDetails.Controls.Add(this.genreComboBox); + this.gbFileDetails.Controls.Add(this.subGenreLabel); this.gbFileDetails.Controls.Add(this.gameinfoURLTextBox); this.gbFileDetails.Controls.Add(this.gameInfoURLLabel); this.gbFileDetails.Controls.Add(this.buttonViewImg); this.gbFileDetails.Controls.Add(this.cbRating); this.gbFileDetails.Controls.Add(this.txtOverview); this.gbFileDetails.Controls.Add(this.lblOverview); - this.gbFileDetails.Controls.Add(this.txtSystem); this.gbFileDetails.Controls.Add(this.lblSystem); this.gbFileDetails.Controls.Add(this.txtCountry); this.gbFileDetails.Controls.Add(this.lblCountry); this.gbFileDetails.Controls.Add(this.lblRating); this.gbFileDetails.Controls.Add(this.txtYear); this.gbFileDetails.Controls.Add(this.lblYear); - this.gbFileDetails.Controls.Add(this.txtManufacturer); this.gbFileDetails.Controls.Add(this.lblManufacturer); - this.gbFileDetails.Controls.Add(this.txtGenre); - this.gbFileDetails.Controls.Add(this.lblGenre); + this.gbFileDetails.Controls.Add(this.genreLabel); this.gbFileDetails.Controls.Add(this.lblImageFile); this.gbFileDetails.Controls.Add(this.btnImageFile); this.gbFileDetails.Controls.Add(this.txtFilename); @@ -312,13 +253,58 @@ this.gbFileDetails.TabIndex = 1; this.gbFileDetails.TabStop = false; // + // systemComboBox + // + this.systemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.systemComboBox.FormattingEnabled = true; + this.systemComboBox.Location = new System.Drawing.Point(97, 240); + this.systemComboBox.Name = "systemComboBox"; + this.systemComboBox.Size = new System.Drawing.Size(162, 21); + this.systemComboBox.TabIndex = 71; + // + // manufacturerComboBox + // + this.manufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.manufacturerComboBox.FormattingEnabled = true; + this.manufacturerComboBox.Location = new System.Drawing.Point(97, 159); + this.manufacturerComboBox.Name = "manufacturerComboBox"; + this.manufacturerComboBox.Size = new System.Drawing.Size(162, 21); + this.manufacturerComboBox.TabIndex = 70; + // + // subGenreComboBox + // + this.subGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.subGenreComboBox.FormattingEnabled = true; + this.subGenreComboBox.Location = new System.Drawing.Point(97, 129); + this.subGenreComboBox.Name = "subGenreComboBox"; + this.subGenreComboBox.Size = new System.Drawing.Size(162, 21); + this.subGenreComboBox.TabIndex = 69; + // + // genreComboBox + // + this.genreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.genreComboBox.FormattingEnabled = true; + this.genreComboBox.Location = new System.Drawing.Point(97, 103); + this.genreComboBox.Name = "genreComboBox"; + this.genreComboBox.Size = new System.Drawing.Size(162, 21); + this.genreComboBox.TabIndex = 68; + // + // subGenreLabel + // + this.subGenreLabel.AutoSize = true; + this.subGenreLabel.Location = new System.Drawing.Point(8, 132); + this.subGenreLabel.Name = "subGenreLabel"; + this.subGenreLabel.Size = new System.Drawing.Size(61, 13); + this.subGenreLabel.TabIndex = 67; + this.subGenreLabel.Text = "Sub Genre:"; + // // txtYear // this.txtYear.BorderColor = System.Drawing.Color.Empty; this.txtYear.Location = new System.Drawing.Point(97, 186); this.txtYear.MaxLength = 4; this.txtYear.Name = "txtYear"; - this.txtYear.Size = new System.Drawing.Size(60, 21); + this.txtYear.Size = new System.Drawing.Size(60, 20); this.txtYear.TabIndex = 7; // // lblYear @@ -326,56 +312,34 @@ this.lblYear.AutoSize = true; this.lblYear.Location = new System.Drawing.Point(8, 189); this.lblYear.Name = "lblYear"; - this.lblYear.Size = new System.Drawing.Size(33, 13); + this.lblYear.Size = new System.Drawing.Size(32, 13); this.lblYear.TabIndex = 53; this.lblYear.Text = "Year:"; // - // txtManufacturer - // - this.txtManufacturer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtManufacturer.BorderColor = System.Drawing.Color.Empty; - this.txtManufacturer.Location = new System.Drawing.Point(97, 159); - this.txtManufacturer.Name = "txtManufacturer"; - this.txtManufacturer.Size = new System.Drawing.Size(365, 21); - this.txtManufacturer.TabIndex = 6; - // // lblManufacturer // this.lblManufacturer.AutoSize = true; this.lblManufacturer.Location = new System.Drawing.Point(8, 162); this.lblManufacturer.Name = "lblManufacturer"; - this.lblManufacturer.Size = new System.Drawing.Size(76, 13); + this.lblManufacturer.Size = new System.Drawing.Size(73, 13); this.lblManufacturer.TabIndex = 51; this.lblManufacturer.Text = "Manufacturer:"; // - // txtGenre + // genreLabel // - this.txtGenre.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtGenre.BorderColor = System.Drawing.Color.Empty; - this.txtGenre.Location = new System.Drawing.Point(97, 101); - this.txtGenre.Multiline = true; - this.txtGenre.Name = "txtGenre"; - this.txtGenre.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtGenre.Size = new System.Drawing.Size(365, 52); - this.txtGenre.TabIndex = 5; + this.genreLabel.AutoSize = true; + this.genreLabel.Location = new System.Drawing.Point(8, 103); + this.genreLabel.Name = "genreLabel"; + this.genreLabel.Size = new System.Drawing.Size(39, 13); + this.genreLabel.TabIndex = 49; + this.genreLabel.Text = "Genre:"; // - // lblGenre - // - this.lblGenre.AutoSize = true; - this.lblGenre.Location = new System.Drawing.Point(8, 104); - this.lblGenre.Name = "lblGenre"; - this.lblGenre.Size = new System.Drawing.Size(40, 13); - this.lblGenre.TabIndex = 49; - this.lblGenre.Text = "Genre:"; - // // lblImageFile // this.lblImageFile.AutoSize = true; this.lblImageFile.Location = new System.Drawing.Point(8, 77); this.lblImageFile.Name = "lblImageFile"; - this.lblImageFile.Size = new System.Drawing.Size(55, 13); + this.lblImageFile.Size = new System.Drawing.Size(52, 13); this.lblImageFile.TabIndex = 47; this.lblImageFile.Text = "Imagefile:"; // @@ -397,7 +361,7 @@ this.txtFilename.BorderColor = System.Drawing.Color.Empty; this.txtFilename.Location = new System.Drawing.Point(97, 47); this.txtFilename.Name = "txtFilename"; - this.txtFilename.Size = new System.Drawing.Size(365, 21); + this.txtFilename.Size = new System.Drawing.Size(365, 20); this.txtFilename.TabIndex = 1; // // txtImageFile @@ -407,7 +371,7 @@ this.txtImageFile.BorderColor = System.Drawing.Color.Empty; this.txtImageFile.Location = new System.Drawing.Point(97, 74); this.txtImageFile.Name = "txtImageFile"; - this.txtImageFile.Size = new System.Drawing.Size(328, 21); + this.txtImageFile.Size = new System.Drawing.Size(328, 20); this.txtImageFile.TabIndex = 3; // // txtTitle @@ -417,7 +381,7 @@ this.txtTitle.BorderColor = System.Drawing.Color.Empty; this.txtTitle.Location = new System.Drawing.Point(97, 20); this.txtTitle.Name = "txtTitle"; - this.txtTitle.Size = new System.Drawing.Size(365, 21); + this.txtTitle.Size = new System.Drawing.Size(365, 20); this.txtTitle.TabIndex = 0; // // lblTitle @@ -425,7 +389,7 @@ this.lblTitle.AutoSize = true; this.lblTitle.Location = new System.Drawing.Point(8, 23); this.lblTitle.Name = "lblTitle"; - this.lblTitle.Size = new System.Drawing.Size(31, 13); + this.lblTitle.Size = new System.Drawing.Size(30, 13); this.lblTitle.TabIndex = 46; this.lblTitle.Text = "Title:"; // @@ -434,7 +398,7 @@ this.lblFilename.AutoSize = true; this.lblFilename.Location = new System.Drawing.Point(8, 50); this.lblFilename.Name = "lblFilename"; - this.lblFilename.Size = new System.Drawing.Size(53, 13); + this.lblFilename.Size = new System.Drawing.Size(52, 13); this.lblFilename.TabIndex = 45; this.lblFilename.Text = "Filename:"; // @@ -455,7 +419,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tcFileItemData.Controls.Add(this.tabPage1); - this.tcFileItemData.Controls.Add(this.tabPage2); + this.tcFileItemData.Controls.Add(this.generalFileOptionsTab); this.tcFileItemData.Location = new System.Drawing.Point(4, 8); this.tcFileItemData.Name = "tcFileItemData"; this.tcFileItemData.SelectedIndex = 0; @@ -472,6 +436,203 @@ this.tabPage1.Text = "Properties"; this.tabPage1.UseVisualStyleBackColor = true; // + // generalFileOptionsTab + // + this.generalFileOptionsTab.Controls.Add(this.generalFileItemOptionsGroupBox); + this.generalFileOptionsTab.Location = new System.Drawing.Point(4, 22); + this.generalFileOptionsTab.Name = "generalFileOptionsTab"; + this.generalFileOptionsTab.Padding = new System.Windows.Forms.Padding(3); + this.generalFileOptionsTab.Size = new System.Drawing.Size(521, 466); + this.generalFileOptionsTab.TabIndex = 2; + this.generalFileOptionsTab.Text = "General FileItem Options"; + this.generalFileOptionsTab.UseVisualStyleBackColor = true; + // + // generalFileItemOptionsGroupBox + // + this.generalFileItemOptionsGroupBox.Controls.Add(this.editSystemComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeSystemLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeSystemButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addSystemLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.editSystemTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addSystemButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.editManufacturerComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.editManufacturerTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.editGenreComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.label1); + this.generalFileItemOptionsGroupBox.Controls.Add(this.editGenreTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); + this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(6, 6); + this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; + this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(509, 454); + this.generalFileItemOptionsGroupBox.TabIndex = 78; + this.generalFileItemOptionsGroupBox.TabStop = false; + // + // editSystemComboBox + // + this.editSystemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.editSystemComboBox.FormattingEnabled = true; + this.editSystemComboBox.Location = new System.Drawing.Point(91, 249); + this.editSystemComboBox.Name = "editSystemComboBox"; + this.editSystemComboBox.Size = new System.Drawing.Size(312, 21); + this.editSystemComboBox.TabIndex = 92; + // + // removeSystemLabel + // + this.removeSystemLabel.AutoSize = true; + this.removeSystemLabel.Location = new System.Drawing.Point(6, 252); + this.removeSystemLabel.Name = "removeSystemLabel"; + this.removeSystemLabel.Size = new System.Drawing.Size(82, 13); + this.removeSystemLabel.TabIndex = 91; + this.removeSystemLabel.Text = "Remove system"; + // + // removeSystemButton + // + this.removeSystemButton.Location = new System.Drawing.Point(436, 249); + this.removeSystemButton.Name = "removeSystemButton"; + this.removeSystemButton.Size = new System.Drawing.Size(62, 23); + this.removeSystemButton.TabIndex = 90; + this.removeSystemButton.Text = "Remove.."; + this.removeSystemButton.UseVisualStyleBackColor = true; + this.removeSystemButton.Click += new System.EventHandler(this.removeSystemButton_Click); + // + // addSystemLabel + // + this.addSystemLabel.AutoSize = true; + this.addSystemLabel.Location = new System.Drawing.Point(6, 216); + this.addSystemLabel.Name = "addSystemLabel"; + this.addSystemLabel.Size = new System.Drawing.Size(69, 13); + this.addSystemLabel.TabIndex = 87; + this.addSystemLabel.Text = "Add System.."; + // + // editSystemTextBox + // + this.editSystemTextBox.Location = new System.Drawing.Point(91, 213); + this.editSystemTextBox.Name = "editSystemTextBox"; + this.editSystemTextBox.Size = new System.Drawing.Size(312, 20); + this.editSystemTextBox.TabIndex = 88; + // + // addSystemButton + // + this.addSystemButton.Location = new System.Drawing.Point(436, 213); + this.addSystemButton.Name = "addSystemButton"; + this.addSystemButton.Size = new System.Drawing.Size(62, 23); + this.addSystemButton.TabIndex = 89; + this.addSystemButton.Text = "Add.."; + this.addSystemButton.UseVisualStyleBackColor = true; + this.addSystemButton.Click += new System.EventHandler(this.addSystemButton_Click); + // + // editManufacturerComboBox + // + this.editManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.editManufacturerComboBox.FormattingEnabled = true; + this.editManufacturerComboBox.Location = new System.Drawing.Point(91, 165); + this.editManufacturerComboBox.Name = "editManufacturerComboBox"; + this.editManufacturerComboBox.Size = new System.Drawing.Size(312, 21); + this.editManufacturerComboBox.TabIndex = 86; + // + // removeManufacturerLabel + // + this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); + this.removeManufacturerLabel.Name = "removeManufacturerLabel"; + this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); + this.removeManufacturerLabel.TabIndex = 85; + this.removeManufacturerLabel.Text = "Remove Manufacturer"; + // + // removeManufacturerButton + // + this.removeManufacturerButton.Location = new System.Drawing.Point(436, 165); + this.removeManufacturerButton.Name = "removeManufacturerButton"; + this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.removeManufacturerButton.TabIndex = 84; + this.removeManufacturerButton.Text = "Remove.."; + this.removeManufacturerButton.UseVisualStyleBackColor = true; + this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); + // + // addManufacturerLabel + // + this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); + this.addManufacturerLabel.Name = "addManufacturerLabel"; + this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); + this.addManufacturerLabel.TabIndex = 81; + this.addManufacturerLabel.Text = "Add Manufacturer.."; + // + // editManufacturerTextBox + // + this.editManufacturerTextBox.Location = new System.Drawing.Point(91, 129); + this.editManufacturerTextBox.Name = "editManufacturerTextBox"; + this.editManufacturerTextBox.Size = new System.Drawing.Size(312, 20); + this.editManufacturerTextBox.TabIndex = 82; + // + // addManufacturerButton + // + this.addManufacturerButton.Location = new System.Drawing.Point(436, 129); + this.addManufacturerButton.Name = "addManufacturerButton"; + this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.addManufacturerButton.TabIndex = 83; + this.addManufacturerButton.Text = "Add.."; + this.addManufacturerButton.UseVisualStyleBackColor = true; + this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); + // + // editGenreComboBox + // + this.editGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.editGenreComboBox.FormattingEnabled = true; + this.editGenreComboBox.Location = new System.Drawing.Point(91, 70); + this.editGenreComboBox.Name = "editGenreComboBox"; + this.editGenreComboBox.Size = new System.Drawing.Size(312, 21); + this.editGenreComboBox.TabIndex = 80; + // + // removeGenreLabel + // + this.removeGenreLabel.AutoSize = true; + this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); + this.removeGenreLabel.Name = "removeGenreLabel"; + this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); + this.removeGenreLabel.TabIndex = 79; + this.removeGenreLabel.Text = "Remove genre"; + // + // removeGenreButton + // + this.removeGenreButton.Location = new System.Drawing.Point(436, 70); + this.removeGenreButton.Name = "removeGenreButton"; + this.removeGenreButton.Size = new System.Drawing.Size(62, 23); + this.removeGenreButton.TabIndex = 78; + this.removeGenreButton.Text = "Remove.."; + this.removeGenreButton.UseVisualStyleBackColor = true; + this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 37); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(64, 13); + this.label1.TabIndex = 74; + this.label1.Text = "Add Genre.."; + // + // editGenreTextBox + // + this.editGenreTextBox.Location = new System.Drawing.Point(91, 34); + this.editGenreTextBox.Name = "editGenreTextBox"; + this.editGenreTextBox.Size = new System.Drawing.Size(312, 20); + this.editGenreTextBox.TabIndex = 75; + // + // addGenreButton + // + this.addGenreButton.Location = new System.Drawing.Point(436, 34); + this.addGenreButton.Name = "addGenreButton"; + this.addGenreButton.Size = new System.Drawing.Size(62, 23); + this.addGenreButton.TabIndex = 76; + this.addGenreButton.Text = "Add.."; + this.addGenreButton.UseVisualStyleBackColor = true; + this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); + // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -499,13 +660,13 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "File-Details"; this.Load += new System.EventHandler(this.FileDetailsForm_Load); - this.gbExtended.ResumeLayout(false); - this.gbExtended.PerformLayout(); - this.tabPage2.ResumeLayout(false); this.gbFileDetails.ResumeLayout(false); this.gbFileDetails.PerformLayout(); this.tcFileItemData.ResumeLayout(false); this.tabPage1.ResumeLayout(false); + this.generalFileOptionsTab.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.PerformLayout(); this.ResumeLayout(false); } @@ -520,24 +681,15 @@ private MediaPortal.UserInterface.Controls.MPComboBox cbRating; private MediaPortal.UserInterface.Controls.MPTextBox txtOverview; private MediaPortal.UserInterface.Controls.MPLabel lblOverview; - private MediaPortal.UserInterface.Controls.MPTextBox txtSystem; private MediaPortal.UserInterface.Controls.MPLabel lblSystem; private MediaPortal.UserInterface.Controls.MPTextBox txtCountry; private MediaPortal.UserInterface.Controls.MPLabel lblCountry; - private MediaPortal.UserInterface.Controls.MPTextBox txtCategoryData; - private MediaPortal.UserInterface.Controls.MPLabel lblCategoryData; - private MediaPortal.UserInterface.Controls.MPGroupBox gbExtended; - private MediaPortal.UserInterface.Controls.MPTextBox txtTagData; - private MediaPortal.UserInterface.Controls.MPLabel lblTagData; - private MediaPortal.UserInterface.Controls.MPTabPage tabPage2; private MediaPortal.UserInterface.Controls.MPLabel lblRating; private MediaPortal.UserInterface.Controls.MPGroupBox gbFileDetails; private MediaPortal.UserInterface.Controls.MPTextBox txtYear; private MediaPortal.UserInterface.Controls.MPLabel lblYear; - private MediaPortal.UserInterface.Controls.MPTextBox txtManufacturer; private MediaPortal.UserInterface.Controls.MPLabel lblManufacturer; - private MediaPortal.UserInterface.Controls.MPTextBox txtGenre; - private MediaPortal.UserInterface.Controls.MPLabel lblGenre; + private MediaPortal.UserInterface.Controls.MPLabel genreLabel; private MediaPortal.UserInterface.Controls.MPLabel lblImageFile; private MediaPortal.UserInterface.Controls.MPButton btnImageFile; private MediaPortal.UserInterface.Controls.MPTextBox txtFilename; @@ -550,5 +702,30 @@ private MediaPortal.UserInterface.Controls.MPTabPage tabPage1; private System.Windows.Forms.OpenFileDialog openFileDialog1; private MediaPortal.UserInterface.Controls.MPButton btnCancel; + private System.Windows.Forms.Label subGenreLabel; + private System.Windows.Forms.ComboBox subGenreComboBox; + private System.Windows.Forms.ComboBox genreComboBox; + private System.Windows.Forms.TabPage generalFileOptionsTab; + private System.Windows.Forms.GroupBox generalFileItemOptionsGroupBox; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox editGenreTextBox; + private System.Windows.Forms.Button addGenreButton; + private System.Windows.Forms.Label removeGenreLabel; + private System.Windows.Forms.Button removeGenreButton; + private System.Windows.Forms.ComboBox editGenreComboBox; + private System.Windows.Forms.ComboBox systemComboBox; + private System.Windows.Forms.ComboBox manufacturerComboBox; + private System.Windows.Forms.ComboBox editSystemComboBox; + private System.Windows.Forms.Label removeSystemLabel; + private System.Windows.Forms.Button removeSystemButton; + private System.Windows.Forms.Label addSystemLabel; + private System.Windows.Forms.TextBox editSystemTextBox; + private System.Windows.Forms.Button addSystemButton; + private System.Windows.Forms.ComboBox editManufacturerComboBox; + private System.Windows.Forms.Label removeManufacturerLabel; + private System.Windows.Forms.Button removeManufacturerButton; + private System.Windows.Forms.Label addManufacturerLabel; + private System.Windows.Forms.TextBox editManufacturerTextBox; + private System.Windows.Forms.Button addManufacturerButton; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-01 07:49:46 UTC (rev 658) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-01 13:47:34 UTC (rev 659) @@ -24,6 +24,7 @@ #endregion using System; +using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; @@ -33,6 +34,7 @@ using GUIPrograms; using GUIPrograms.ApplicationItems; using GUIPrograms.Database; +using SQLite.NET; using GUIPrograms.FileItems; namespace GUIPrograms.Design @@ -43,6 +45,7 @@ private FileItem m_CurFile; private ConditionChecker conditionChecker; + public ApplicationItem CurApp { get @@ -82,7 +85,8 @@ txtFilename.Text = m_CurFile.Filename; txtImageFile.Text = m_CurFile.Imagefile; FileItemToGenre(); - txtManufacturer.Text = m_CurFile.Manufacturer; + manufacturerComboBox.SelectedValue = CurFile.ManufacturerId; + //txtManufacturer.Text = m_CurFile.Manufacturer; if (m_CurFile.Year > 1900) { txtYear.Text = m_CurFile.Year.ToString(); @@ -93,19 +97,104 @@ } cbRating.SelectedIndex = m_CurFile.Rating; txtCountry.Text = m_CurFile.Country; - txtSystem.Text = m_CurFile.System_; + // txtSystem.Text = m_CurFile.System_; + systemComboBox.SelectedValue = m_CurFile.SystemId; txtOverview.Text = m_CurFile.Overview; - txtTagData.Text = m_CurFile.TagData; - txtCategoryData.Text = m_CurFile.CategoryData; gameinfoURLTextBox.Text = m_CurFile.GameInfoURL; } private void FileDetailsForm_Load(object sender, EventArgs e) { + UpdateComboBoxes(); tcFileItemData.TabIndex = 0; updateDisplay(); + } + private void FillComboBox(string tableName,string orderBy,ComboBox comboBox ) + { + + + List<ListItem> listItemList = new List<ListItem>(); + SQLiteResultSet resultSet = null; + + string sqlStmt = @" + SELECT + * + + FROM + " + tableName + @" + + ORDER BY " + orderBy; + + try + { + resultSet = DatabaseHandler.sqlDB.Execute(sqlStmt); + } + catch (Exception exception) + { + throw exception; + } + + if (resultSet.Rows.Count > 0) + { + for (int i = 0; i < resultSet.Rows.Count; i++) + { + //genreid why oh why cant the implementation offer getvalue from columname... arrghr + //maybe can use the sqlnet provider later on.. + + ListItem listItem = new ListItem(resultSet.Rows[i].fields[1].ToString(), Convert.ToInt32(resultSet.Rows[i].fields[0])); + listItemList.Add(listItem); + } + + + comboBox.DataSource = listItemList; + comboBox.ValueMember = "Value"; + comboBox... [truncated message content] |
From: <che...@us...> - 2007-07-02 10:06:09
|
Revision: 664 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=664&view=rev Author: chef_koch Date: 2007-07-02 03:06:04 -0700 (Mon, 02 Jul 2007) Log Message: ----------- fixed a few issues with getThumbsFromMpThumbsDir Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-01 14:58:53 UTC (rev 663) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-02 10:06:04 UTC (rev 664) @@ -1204,6 +1204,7 @@ else if (item.MusicTag is ApplicationItem) { ApplicationItem curApp = item.MusicTag as ApplicationItem; + return curApp.Imagefile; } else return ""; @@ -1212,6 +1213,7 @@ public string GetCurThumb(FileItem fileItem) { string curThumb = ""; + if (thumbFolderIndex == -1) { curThumb = fileItem.Imagefile; @@ -1221,6 +1223,7 @@ string curFolder = imageDirs[thumbFolderIndex]; curThumb = curFolder + "\\" + fileItem.ExtractImageFileNoPath(); } + if (thumbIndex > 0) { // try to find another thumb.... @@ -1242,6 +1245,7 @@ } } } + return curThumb; } @@ -1252,7 +1256,7 @@ Path.GetFileNameWithoutExtension(fileItem.Filename) ); - if (curThumb != "") + if (File.Exists(curThumb)) if (thumbIndex > 0) { // try to find another thumb.... @@ -1263,12 +1267,12 @@ Path.GetFileNameWithoutExtension(fileItem.Filename) + "_" + thumbIndex.ToString() ); - if (cand != "") + if (File.Exists(cand)) curThumb = cand; else { - thumbIndex = 0; // restart at the first thumb! - //GetNextThumbFolderIndex(fileItem); + // restart at the first thumb! + thumbIndex = 0; } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-01 14:58:53 UTC (rev 663) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-02 10:06:04 UTC (rev 664) @@ -337,6 +337,8 @@ public bool FirstImageDirectoryValid() { + if (DatabaseHandler.useMPsThumbDirectory) return true; + if (this.imageDirsTextBox.Text.Length == 0) { return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-02 21:31:03
|
Revision: 667 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=667&view=rev Author: northern_sky Date: 2007-07-02 14:30:59 -0700 (Mon, 02 Jul 2007) Log Message: ----------- db:genre stuff fixed and some hackcode removed. re init db;( hoping to soon be done with the db-stuff Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -885,22 +885,22 @@ arguments, windowstyle, startupdir, - useshellexecute, - usequotes, - source_type, + useShellExecute, + useQuotes, + applicationItemType, source, imagefile, filedirectory, imagedirectory, - validextensions, - importvalidimagesonly, + validExtensions, + importValidImagesOnly, iposition, enabled, enableGUIRefresh, GUIRefreshPossible, contentID, systemDefault, - WaitForExit, + waitForExit, preLaunch, postLaunch ) @@ -962,15 +962,15 @@ arguments = '" + ProgramUtils.Encode(Arguments) + @"', windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + @"', startupdir = '" + ProgramUtils.Encode(StartupDir) + @"', - useshellexecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + @"', - usequotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + @"', - source_type = '" + ProgramUtils.ApplicationTypeToString(SourceType) + @"', + useShellExecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + @"', + useQuotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + @"', + applicationItemType = '" + ProgramUtils.ApplicationTypeToString(SourceType) + @"', source = '" + ProgramUtils.Encode(Source) + @"', imagefile = '" + ProgramUtils.Encode(Imagefile) + @"', filedirectory = '" + ProgramUtils.Encode(FileDirectory) + @"', imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + @"', - validextensions = '" + ProgramUtils.Encode(ValidExtensions) + @"', - importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + @"', + validExtensions = '" + ProgramUtils.Encode(ValidExtensions) + @"', + importValidImagesOnly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + @"', iposition = " + Position + @", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + @"', fatherNodeId = '" + FatherID + @"', @@ -978,7 +978,7 @@ GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) +@"', contentID = '" + ContentID + @"', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + @"', - WaitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + @"', + waitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + @"', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + @"', postLaunch = '" + ProgramUtils.Encode(PostLaunch) + @"' Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -55,7 +55,7 @@ static private ApplicationItem DBGetApp(SQLiteResultSet results, int recordIndex) { - ApplicationItem newApp = appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "source_type")); + ApplicationItem newApp = appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType")); newApp.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); newApp.Enabled = ProgramUtils.GetBool(results, recordIndex, "enabled"); newApp.AppID = ProgramUtils.GetIntDef(results, recordIndex, "applicationId", -1); @@ -67,7 +67,7 @@ newApp.StartupDir = ProgramUtils.Get(results, recordIndex, "startupdir"); newApp.UseShellExecute = ProgramUtils.GetBool(results, recordIndex, "useshellexecute"); newApp.UseQuotes = ProgramUtils.GetBool(results, recordIndex, "usequotes"); - newApp.SourceType = ProgramUtils.GetSourceType(results, recordIndex, "source_type"); + newApp.SourceType = ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"); newApp.Source = ProgramUtils.Get(results, recordIndex, "source"); newApp.Imagefile = ProgramUtils.Get(results, recordIndex, "imagefile"); newApp.FileDirectory = ProgramUtils.Get(results, recordIndex, "filedirectory"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -117,30 +117,31 @@ arguments TEXT, windowstyle TEXT, startupdir TEXT, - useshellexecute TEXT, - usequotes TEXT, - source_type TEXT, + useShellExecute TEXT, + useQuotes TEXT, + applicationItemType TEXT, source TEXT, imagefile TEXT, filedirectory TEXT, imagedirectory TEXT, - validextensions TEXT, + validExtensions TEXT, enabled TEXT, - importvalidimagesonly TEXT, + importValidImagesOnly TEXT, iposition INTEGER, enableGUIRefresh TEXT, GUIRefreshPossible TEXT, contentID INTEGER, systemdefault TEXT, - waitforexit TEXT, + waitForExit TEXT, preLaunch TEXT, postLaunch TEXT )"); - DatabaseUtility.AddTable(sqlDB, "tblFileItem", "CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, mainGenreId INTEGER, subGenreId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, systemId INTEGER, import_flag INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, isfolder TEXT, uppertitle TEXT, tagdata TEXT, categorydata TEXT, gameInfoUrl TEXT)"); + DatabaseUtility.AddTable(sqlDB, "tblFileItem", "CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, mainGenreId INTEGER, subGenreId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, platformId INTEGER, import_flag INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, isfolder TEXT, uppertitle TEXT, tagdata TEXT, categorydata TEXT, gameInfoUrl TEXT)"); DatabaseUtility.AddTable(sqlDB, "tblFilterItem", "CREATE TABLE tblFilterItem (applicationId INTEGER, grouperAppID INTEGER, fileID INTEGER, filename TEXT, tag INTEGER)"); DatabaseUtility.AddTable(sqlDB, "tblSetting", "CREATE TABLE tblSetting (settingid INTEGER PRIMARY KEY, key TEXT, value TEXT)"); - + + DatabaseUtility.AddTable(sqlDB, "tblGenre", @"CREATE TABLE tblGenre ( @@ -148,17 +149,17 @@ genre TEXT )"); - DatabaseUtility.AddTable(sqlDB, "tblSystem", @"CREATE TABLE - tblSystem + DatabaseUtility.AddTable(sqlDB, "tblPlatform", @"CREATE TABLE + tblPlatform ( - systemId INTEGER PRIMARY KEY, - system TEXT + platformId INTEGER PRIMARY KEY, + platform TEXT )"); DatabaseUtility.AddTable(sqlDB, "tblManufacturer", @"CREATE TABLE tblManufacturer ( - manufacturerId INTEGER PRIMARY KEY, + manufacturerId INTEGER PRIMARY KEY, manufacturer TEXT )"); @@ -200,16 +201,16 @@ sqlDB.Execute(@"INSERT INTO - tblSystem + tblPlatform ( - system + platform ) VALUES ( 'Unknown' )"); - FillDefaultDBLexiconHelper("tblSystem","system",CreateSystemLexiconList()); + FillDefaultDBLexiconHelper("tblPlatform","platform",CreateSystemLexiconList()); FillDefaultDBLexiconHelper("tblManufacturer","manufacturer",CreateManufacturerLexiconList()); FillDefaultDBLexiconHelper("tblGenre", "genre", CreateGenreLexiconList()); @@ -334,7 +335,7 @@ " + tableName + @" WHERE - " + columnName + @" LIKE '" + fieldValue + "'"; + " + columnName + @" LIKE '" + ProgramUtils.Encode(fieldValue) + "'"; string sqlStmtInsert = @" INSERT INTO @@ -344,7 +345,7 @@ ) VALUES ( - '" + fieldValue + @"' + '" + ProgramUtils.Encode(fieldValue) + @"' )"; try Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -489,7 +489,7 @@ this.removeSystemLabel.Name = "removeSystemLabel"; this.removeSystemLabel.Size = new System.Drawing.Size(82, 13); this.removeSystemLabel.TabIndex = 91; - this.removeSystemLabel.Text = "Remove system"; + this.removeSystemLabel.Text = "Remove platform"; // // removeSystemButton // Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -97,8 +97,8 @@ } cbRating.SelectedIndex = m_CurFile.Rating; txtCountry.Text = m_CurFile.Country; - // txtSystem.Text = m_CurFile.System_; - systemComboBox.SelectedValue = m_CurFile.SystemId; + // txtSystem.Text = m_CurFile.Platform; + systemComboBox.SelectedValue = m_CurFile.PlatformId; txtOverview.Text = m_CurFile.Overview; gameinfoURLTextBox.Text = m_CurFile.GameInfoURL; } @@ -156,11 +156,11 @@ private void UpdateComboBoxes() { - FillComboBox("tblSystem", "system", editSystemComboBox); + FillComboBox("tblPlatform", "platform", editSystemComboBox); FillComboBox("tblManufacturer", "manufacturer", editManufacturerComboBox); FillComboBox("tblGenre", "genre", editGenreComboBox); - FillComboBox("tblSystem", "system", systemComboBox); + FillComboBox("tblPlatform", "platform", systemComboBox); FillComboBox("tblManufacturer", "manufacturer", manufacturerComboBox); FillComboBox("tblGenre", "genre",genreComboBox); FillComboBox("tblGenre", "genre", subGenreComboBox); @@ -241,7 +241,7 @@ genreComboBox.SelectedValue = CurFile.MainGenreId; subGenreComboBox.SelectedValue = CurFile.SubGenreId; manufacturerComboBox.SelectedValue = CurFile.ManufacturerId; - systemComboBox.SelectedValue = CurFile.SystemId; + systemComboBox.SelectedValue = CurFile.PlatformId; } private void btnOk_Click(object sender, EventArgs e) @@ -257,7 +257,7 @@ CurFile.Year = ProgramUtils.StringToInteger(txtYear.Text, -1); CurFile.Rating = cbRating.SelectedIndex; CurFile.Country = txtCountry.Text; - CurFile.SystemId = (int)systemComboBox.SelectedValue; + CurFile.PlatformId = (int)systemComboBox.SelectedValue; CurFile.Overview = txtOverview.Text; CurFile.GameInfoURL = this.gameinfoURLTextBox.Text; if (EntriesOK()) @@ -407,16 +407,16 @@ private void addSystemButton_Click(object sender, EventArgs e) { - InsertData("tblSystem", "system", "'" + this.editSystemTextBox.Text + "'"); + InsertData("tblSystem", "platform", "'" + this.editSystemTextBox.Text + "'"); UpdateComboBoxes(); } private void removeSystemButton_Click(object sender, EventArgs e) { DeleteData("tblSystem", "systemId", this.editSystemComboBox.SelectedValue.ToString()); - if (CurFile.SystemId == (int)this.editSystemComboBox.SelectedValue) + if (CurFile.PlatformId == (int)this.editSystemComboBox.SelectedValue) { - CurFile.SystemId = 1; + CurFile.PlatformId = 1; } UpdateFileItems("systemId", this.editSystemComboBox.SelectedValue.ToString()); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -64,8 +64,8 @@ int year; int rating; string overview; - string system; - int systemId; + string platform; + int platformId; DateTime lastTimeLaunched; int launchCount; @@ -109,8 +109,8 @@ year = -1; rating = -1; overview = ""; - system = ""; - systemId = 1; + platform = ""; + platformId = 1; isFolder = false; lastTimeLaunched = DateTime.MinValue; launchCount = 0; @@ -344,26 +344,26 @@ overview = value; } } - public string System_ + public string Platform { get { - return system; + return platform; } set { - system = value; + platform = value; } } - public int SystemId + public int PlatformId { get { - return systemId; + return platformId; } set { - systemId = value; + platformId = value; } } public DateTime LastTimeLaunched @@ -604,7 +604,7 @@ year, rating, overview, - systemId, + platformId, lastTimeLaunched, launchcount, isfolder, @@ -628,7 +628,7 @@ '" + Year.ToString() + @"', '" + Rating + @"', '" + ProgramUtils.Encode(Overview) + @"', - '" + SystemId + @"', + '" + PlatformId + @"', '" + LastTimeLaunched.ToString() + @"', '" + LaunchCount.ToString() + @"', '" + ProgramUtils.BooleanToStr(IsFolder) + @"', @@ -638,6 +638,7 @@ '" + ProgramUtils.Encode(GameInfoURL) + @"' )"; // Log.Info("dw sql\n{0}", strSQL); + sqlDB.Execute(strSQL); } catch (SQLiteException ex) @@ -646,6 +647,7 @@ } } + private void Update() { @@ -664,7 +666,7 @@ try { string strSQL = String.Format( - "UPDATE tblFileItem SET title = '{1}', filename = '{2}', imagefile = '{3}', mainGenreId = '{4}', subGenreId = '{5}', country = '{6}', manufacturerId = '{7}', year = '{8}', rating = '{9}', overview = '{10}', systemId = '{11}', uppertitle = '{12}', tagdata = '{13}', categorydata = '{14}', gameInfoURL = '" + ProgramUtils.Encode(GameInfoURL) + "' where fileid = {0}", FileID, ProgramUtils.Encode(Title), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Imagefile), MainGenreId, SubGenreId, ProgramUtils.Encode(Country), ManufacturerId, strYear, Rating, ProgramUtils.Encode(Overview), SystemId, ProgramUtils.Encode(Title.ToUpper()), ProgramUtils.Encode(TagData), ProgramUtils.Encode(CategoryData)); + "UPDATE tblFileItem SET title = '{1}', filename = '{2}', imagefile = '{3}', mainGenreId = '{4}', subGenreId = '{5}', country = '{6}', manufacturerId = '{7}', year = '{8}', rating = '{9}', overview = '{10}', platformId = '{11}', uppertitle = '{12}', tagdata = '{13}', categorydata = '{14}', gameInfoURL = '" + ProgramUtils.Encode(GameInfoURL) + "' where fileid = {0}", FileID, ProgramUtils.Encode(Title), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Imagefile), MainGenreId, SubGenreId, ProgramUtils.Encode(Country), ManufacturerId, strYear, Rating, ProgramUtils.Encode(Overview), PlatformId, ProgramUtils.Encode(Title.ToUpper()), ProgramUtils.Encode(TagData), ProgramUtils.Encode(CategoryData)); sqlDB.Execute(strSQL); } catch (SQLiteException ex) @@ -802,8 +804,8 @@ FileInfoFavourite.Year = this.Year.ToString(); FileInfoFavourite.Overview = this.Overview; FileInfoFavourite.Rating = this.Rating; - FileInfoFavourite.Platform = this.System_; - FileInfoFavourite.PlatformId = this.SystemId; + FileInfoFavourite.Platform = this.Platform; + FileInfoFavourite.PlatformId = this.PlatformId; } public void SaveFromFileInfoFavourite() @@ -821,14 +823,14 @@ LexiconId = DatabaseHandler.LexiconDataExists("tblManufacturer", "manufacturer", FileInfoFavourite.Manufacturer); this.ManufacturerId = LexiconId; - LexiconId = DatabaseHandler.LexiconDataExists("tblSystem", "system", FileInfoFavourite.Platform); - this.SystemId = LexiconId; + LexiconId = DatabaseHandler.LexiconDataExists("tblPlatform", "platform", FileInfoFavourite.Platform); + this.PlatformId = LexiconId; // DON'T overwrite title! this.Title = FileInfoFavourite.Title; this.MainGenre = FileInfoFavourite.MainGenre; this.SubGenre = FileInfoFavourite.SubGenre; - this.System_ = FileInfoFavourite.Platform; + this.Platform = FileInfoFavourite.Platform; this.Manufacturer = FileInfoFavourite.Manufacturer; this.Year = ProgramUtils.StringToInteger(FileInfoFavourite.Year, -1); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -85,8 +85,8 @@ newFile.Year = ProgramUtils.GetIntDef(results, iRecord, "year", -1); newFile.Rating = ProgramUtils.GetIntDef(results, iRecord, "rating", 5); newFile.Overview = ProgramUtils.Get(results, iRecord, "overview"); - newFile.System_ = ProgramUtils.Get(results, iRecord, "system"); - newFile.SystemId = ProgramUtils.GetIntDef(results, iRecord, "systemId",1); + newFile.Platform = ProgramUtils.Get(results, iRecord, "platform"); + newFile.PlatformId = ProgramUtils.GetIntDef(results, iRecord, "platformId",1); newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); newFile.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -63,8 +63,8 @@ newLink.Year = ProgramUtils.GetIntDef(results, iRecord, "year", -1); newLink.Rating = ProgramUtils.GetIntDef(results, iRecord, "rating", 5); newLink.Overview = ProgramUtils.Get(results, iRecord, "overview"); - newLink.System_ = ProgramUtils.Get(results, iRecord, "system"); - newLink.SystemId = ProgramUtils.GetIntDef(results, iRecord, "systemId",1); + newLink.Platform = ProgramUtils.Get(results, iRecord, "platform"); + newLink.PlatformId = ProgramUtils.GetIntDef(results, iRecord, "systemId",1); newLink.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); newLink.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); newLink.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); @@ -103,7 +103,7 @@ year, rating, overview, - system, + platform, systemId, import_flag, lastTimeLaunched, Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -189,9 +189,9 @@ switch (TagName) { - case "system": + case "platform": { - result = curFile.System_; + result = curFile.Platform; break; } case "yearmanu": Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -1233,7 +1233,7 @@ dlgProgress.ShowProgressBar(false); dlgProgress.SetHeading("Lookup Gameinfo"); dlgProgress.SetLine(1, curFile.Title); - dlgProgress.SetLine(2, curFile.System_); + dlgProgress.SetLine(2, curFile.Platform); dlgProgress.SetLine(3, ""); dlgProgress.StartModal(GetID); // dlgProgress.SetPercentage(60); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -93,7 +93,7 @@ curFile.Rating = 5; // average / not rated.... } curFile.Overview = myReader["MemoText"].ToString(); - curFile.System_ = applicationItem.Title; + curFile.Platform = applicationItem.Title; // not imported properties => set default values curFile.LastTimeLaunched = DateTime.MinValue; curFile.LaunchCount = 0; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -436,8 +436,8 @@ ProcessGenreEntry(curFile, genreEntry); ProcessVersionEntry(curFile, versionEntry); - int LexiconId = DatabaseHandler.LexiconDataExists("tblSystem", "system", "Arcade"); - curFile.SystemId = LexiconId; + int LexiconId = DatabaseHandler.LexiconDataExists("tblPlatform", "platform", "Arcade"); + curFile.PlatformId = LexiconId; curFile.Rating = 5; curFile.Write(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs 2007-07-02 17:34:55 UTC (rev 666) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs 2007-07-02 21:30:59 UTC (rev 667) @@ -66,10 +66,8 @@ FilterDefinition filter1 = null; FilterDefinition filter2 = null; FilterDefinition filter3 = null; - FilterDefinition filter4 = null; - FilterDefinition filter5 = null; - FilterDefinition filter6 = null; + //manufacturer ViewDefinition viewManufacturer = new ViewDefinition(); viewManufacturer.Name = "13031"; // Manufacturer @@ -310,42 +308,19 @@ // build the SQL query respecting all the filters and let // the query be executed from outside (this is different from MusicViewHandler) - //sqlSelect.AddTable("tblFileItem"); + sqlSelect.AddTable("tblFileItem"); - + sqlSelect.AddTable("tblGenre AS tblMainGenre"); + sqlSelect.AddTable("tblGenre AS tblSubGenre"); sqlSelect.AddTable("tblManufacturer"); - sqlSelect.AddTable("tblSystem"); + sqlSelect.AddTable("tblPlatform"); - if (currentView != null) - { - string tmpCurrentViewFilterFieldVariable = ((FilterDefinition)currentView.Filters[CurrentLevel]).Where; - - if (tmpCurrentViewFilterFieldVariable == "mainGenre") - { - sqlSelect.AddTable("tblGenre"); - sqlSelect.AddWhereCond("tblFileItem.mainGenreId = tblGenre.genreId"); - sqlSelect.AddField("DISTINCT tblGenre.genre AS mainGenre"); - - } - else if (tmpCurrentViewFilterFieldVariable == "filename") - { - sqlSelect.AddTable("tblGenre"); - sqlSelect.AddWhereCond("tblFileItem.subGenreId = tblGenre.genreId"); - sqlSelect.AddField("tblGenre.genre AS subGenre"); - - } - else if (tmpCurrentViewFilterFieldVariable == "subGenre") - { - sqlSelect.AddTable("tblGenre"); - sqlSelect.AddWhereCond("tblFileItem.subGenreId = tblGenre.genreId"); - sqlSelect.AddField("tblGenre.genre AS subGenre"); - - } - } - sqlSelect.AddWhereCond("applicationId = " + appID +@" + sqlSelect.AddWhereCond("applicationId = " + appID +@" AND tblFileItem.manufacturerId = tblManufacturer.manufacturerId - AND tblFileItem.systemId = tblSystem.systemId "); - + AND tblFileItem.platformId = tblPlatform.platformId + AND tblFileItem.mainGenreId = tblMainGenre.genreId + AND tblFileItem.subGenreId = tblSubGenre.genreId"); + if (currentView == null) { // no View / leaf view activated: build standard queries @@ -354,16 +329,14 @@ // b: "select file.*, '' as title2, '' as fieldtype2 from file where applicationId = {0} and filepath = '{1}' order by isfolder desc, uppertitle" sqlSelect.AddField("tblFileItem.*"); - - sqlSelect.AddField("tblSystem.system AS system"); + sqlSelect.AddField("tblMainGenre.genre AS mainGenre"); + sqlSelect.AddField("tblSubGenre.genre AS subGenre"); + sqlSelect.AddField("tblPlatform.platform AS platform"); sqlSelect.AddField("tblManufacturer.manufacturer AS manufacturer"); sqlSelect.AddField("'' as title2"); sqlSelect.AddField("'' as fieldtype2"); - /* if (pathSubfolders != "") - { - sqlSelect.AddWhereCond(String.Format("filepath = '{0}'", pathSubfolders)); - }*/ + sqlSelect.AddOrderField("isfolder desc"); sqlSelect.AddOrderField("uppertitle"); } @@ -489,16 +462,10 @@ void BuildFilter(FilterDefinition filter, SQLSelectBuilder sqlSelect,int appId) { - if (filter.Where == "mainGenre") - { - string mainGenreFilter = @" fileid IN (SELECT a.fileId FROM tblFileItem a INNER JOIN tblGenre b ON a.mainGenreid = b.genreid WHERE b.genre = '" + ProgramUtils.Encode(filter.SelectedValue) + @"' AND applicationId = " + appId + @")"; - sqlSelect.AddWhereCond(mainGenreFilter); - - } - else { + sqlSelect.AddWhereCond(String.Format(" {0}='{1}'", GetFieldId(filter.Where), ProgramUtils.Encode(filter.SelectedValue))); - } - } + + } void BuildRestriction(FilterDefinition filter, SQLSelectBuilder sqlSelect) { @@ -569,6 +536,14 @@ void BuildOrder(FilterDefinition filter, SQLSelectBuilder sqlSelect) { string orderClause = GetField(filter.Where); + if (orderClause == "mainGenre") + { + orderClause = "tblMainGenre.genre"; + } + else if(orderClause == "subGenre") { + + orderClause = "tblSubGenre.genre"; + } if (orderClause != "") { if (!filter.SortAscending) orderClause += " desc"; @@ -603,8 +578,8 @@ if (where == "title") return "title"; if (where == "mainGenreId") return "mainGenreId"; if (where == "subGenreId") return "subGenreId"; - if (where == "mainGenre") return "mainGenre"; - if (where == "subGenre") return "subGenre"; + if (where == "mainGenre") return "tblMainGenre.Genre"; + if (where == "subGenre") return "tblSubGenre.Genre"; if (where == "country") return "country"; if (where == "manufacturer") return "manufacturer"; if (where == "manufacturerId") return "manufacturerId"; @@ -622,9 +597,9 @@ // and the MAY be different in the future..... if (where == "title") return "title"; else if (where == "mainGenreId") return "mainGenreId"; - else if (where == "subGenre") return "subGenre"; + else if (where == "subGenre") return "tblSubGenre.genre"; else if (where == "subGenreId") return "subGenreId"; - else if (where == "mainGenre") return "mainGenre"; + else if (where == "mainGenre") return "tblMainGenre.genre"; else if (where == "manufacturer") return "manufacturer"; else if (where == "manufacturerId") return "manufacturerId"; else if (where == "country") return "country"; @@ -653,14 +628,14 @@ { res = "tblFileItem.*"; } - else if (where == "mainGenre") + else if (where == "mainGenre") { - res = "genre as title"; + res = "tblMainGenre.genre as title"; } else if (where == "subGenre") { - res = "genre as title"; - } + res = "tblSubGenre.genre as title"; + } else { res = res + " as title"; @@ -715,7 +690,7 @@ bool GetDistinct(string where) { if (where == "title") return false; - else if (where == "mainGenreId") return true; + else if (where == "mainGenre") return true; else if (where == "subGenre") return true; else if (where == "manufacturer") return true; else if (where == "manufacturerId") return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-05 19:07:12
|
Revision: 673 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=673&view=rev Author: northern_sky Date: 2007-07-05 12:07:07 -0700 (Thu, 05 Jul 2007) Log Message: ----------- basic db options page for adding genre,platforms, etc.. removed databasesort class, moved needed methods to programsort.. Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -97,7 +97,8 @@ string lastFilepath = ""; // cached path - private DatabaseSorter dbPc = new DatabaseSorter(); + //private DatabaseSorter dbPc = new DatabaseSorter(); + private ProgramSort dbPc = new ProgramSort(ProgramSort.SortMethod.Name, true); #endregion @@ -765,7 +766,7 @@ public virtual void OnSortToggle(GUIFacadeControl view) { - dbPc.sortAscending = (!dbPc.sortAscending); + dbPc.SortAscending = (!dbPc.SortAscending); view.Sort(dbPc); } @@ -786,12 +787,12 @@ public virtual bool GetCurrentSortIsAscending() { - return dbPc.sortAscending; + return dbPc.SortAscending; } public virtual void SetCurrentSortIsAscending(bool newValue) { - dbPc.sortAscending = newValue; + dbPc.SortAscending = newValue; } #endregion Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -1,286 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using System.Collections.Generic; -using MediaPortal.GUI.Library; - -using GUIPrograms.FileItems; - -namespace GUIPrograms.Database -{ - /// <summary> - /// Summary description for DatabaseSorter. - /// </summary> - public class DatabaseSorter : IComparer<GUIListItem> - { - enum SortMethod - { - SORT_NAME = 0, SORT_LAUNCHES = 1, SORT_RECENT = 2, SORT_RATING = 3 - } - - SortMethod currentSortMethod = SortMethod.SORT_NAME; - public bool sortAscending = true; - - public string CurrentSortMethodAsText - { - get - { - return GetCurrentSortMethodAsText(); - } - } - - public int CurrentSortMethodIndex - { - get - { - return (int)currentSortMethod; - } - set - { - SetCurrentSortMethodAsIndex(value); - } - } - - private string GetCurrentSortMethodAsText() - { - string strLine = ""; - SortMethod method = currentSortMethod; - switch (method) - { - case SortMethod.SORT_NAME: - strLine = GUILocalizeStrings.Get(103); - break; - case SortMethod.SORT_LAUNCHES: - strLine = GUILocalizeStrings.Get(13016); - break; - case SortMethod.SORT_RECENT: - strLine = GUILocalizeStrings.Get(13017); - break; - case SortMethod.SORT_RATING: - strLine = GUILocalizeStrings.Get(13018); - break; - } - return strLine; - } - - private void SetCurrentSortMethodAsIndex(int value) - { - try - { - currentSortMethod = (SortMethod)value; - } - catch - { - currentSortMethod = 0; - } - } - - - - public void UpdateState() - { - switch (currentSortMethod) - { - // SORT_NAME=0, - // SORT_LAUNCHES=1, - // SORT_RECENT=2, - // SORT_RATING=3 - - case SortMethod.SORT_NAME: - currentSortMethod = SortMethod.SORT_LAUNCHES; - sortAscending = false; - break; - case SortMethod.SORT_LAUNCHES: - currentSortMethod = SortMethod.SORT_RECENT; - sortAscending = false; - break; - case SortMethod.SORT_RECENT: - currentSortMethod = SortMethod.SORT_RATING; - sortAscending = false; - break; - case SortMethod.SORT_RATING: - currentSortMethod = SortMethod.SORT_NAME; - sortAscending = true; - break; - } - } - - public int Compare(GUIListItem item1, GUIListItem item2) - { - FileItem curFile1 = null; - FileItem curFile2 = null; - if (item1 == item2) - return 0; - if (item1 == null) - return -1; - if (item2 == null) - return -1; - if (item1.MusicTag == null) - return -1; - if (item2.MusicTag == null) - return -1; - if (item1.IsFolder && item1.Label == "..") - return -1; - if (item2.IsFolder && item2.Label == "..") - return -1; - if (item1.IsFolder && !item2.IsFolder) - return -1; - if (item1.IsFolder && item2.IsFolder) - return 0; - //don't sort folders! - else if (!item1.IsFolder && item2.IsFolder) - return 1; - - - if (currentSortMethod != SortMethod.SORT_NAME) - { - curFile1 = (FileItem)item1.MusicTag; - curFile2 = (FileItem)item2.MusicTag; - if (curFile1 == null) - return -1; - if (curFile2 == null) - return -1; - } - - // ok let's start sorting :-) - int temp; - switch (currentSortMethod) - { - case SortMethod.SORT_NAME: - item1.Label2 = ""; - item2.Label2 = ""; - if (sortAscending) - { - return String.Compare(item1.Label, item2.Label, true); - } - else - { - return String.Compare(item2.Label, item1.Label, true); - } - case SortMethod.SORT_LAUNCHES: - item1.Label2 = String.Format("{0}", curFile1.LaunchCount); - item2.Label2 = String.Format("{0}", curFile2.LaunchCount); - if (curFile1.LaunchCount == curFile2.LaunchCount) - { - // second sort always title ASC - return String.Compare(item1.Label, item2.Label, true); - } - else - { - if (curFile1.LaunchCount < curFile2.LaunchCount) - { - temp = -1; - } - else - { - temp = 1; - } - if (sortAscending) - { - return temp; - } - else - { - return -temp; - } - } - - case SortMethod.SORT_RATING: - item1.Label2 = String.Format("{0}", curFile1.Rating); - item2.Label2 = String.Format("{0}", curFile2.Rating); - if (curFile1.Rating == curFile2.Rating) - { - // second sort always title ASC - return String.Compare(item1.Label, item2.Label, true); - } - else - { - if (curFile1.Rating < curFile2.Rating) - { - temp = -1; - } - else - { - temp = 1; - } - if (sortAscending) - { - return temp; - } - else - { - return -temp; - } - } - - case SortMethod.SORT_RECENT: - if (curFile1.LastTimeLaunched > DateTime.MinValue) - { - item1.Label2 = curFile1.LastTimeLaunched.ToShortDateString(); - } - else - { - item1.Label2 = ""; - } - if (curFile2.LastTimeLaunched > DateTime.MinValue) - { - item2.Label2 = curFile1.LastTimeLaunched.ToShortDateString(); - } - else - { - item2.Label2 = ""; - } - - if (curFile1.LastTimeLaunched == curFile2.LastTimeLaunched) - { - // second sort always title ASC - return String.Compare(item1.Label, item2.Label, true); - } - else - { - if (curFile1.LastTimeLaunched < curFile2.LastTimeLaunched) - { - temp = -1; - } - else - { - temp = 1; - } - if (sortAscending) - { - return temp; - } - else - { - return -temp; - } - } - } - - return 0; - } - } -} \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -61,33 +61,11 @@ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.tcFileItemData = new MediaPortal.UserInterface.Controls.MPTabControl(); this.tabPage1 = new MediaPortal.UserInterface.Controls.MPTabPage(); - this.generalFileOptionsTab = new System.Windows.Forms.TabPage(); - this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); - this.editSystemComboBox = new System.Windows.Forms.ComboBox(); - this.removeSystemLabel = new System.Windows.Forms.Label(); - this.removeSystemButton = new System.Windows.Forms.Button(); - this.addSystemLabel = new System.Windows.Forms.Label(); - this.editSystemTextBox = new System.Windows.Forms.TextBox(); - this.addSystemButton = new System.Windows.Forms.Button(); - this.editManufacturerComboBox = new System.Windows.Forms.ComboBox(); - this.removeManufacturerLabel = new System.Windows.Forms.Label(); - this.removeManufacturerButton = new System.Windows.Forms.Button(); - this.addManufacturerLabel = new System.Windows.Forms.Label(); - this.editManufacturerTextBox = new System.Windows.Forms.TextBox(); - this.addManufacturerButton = new System.Windows.Forms.Button(); - this.editGenreComboBox = new System.Windows.Forms.ComboBox(); - this.removeGenreLabel = new System.Windows.Forms.Label(); - this.removeGenreButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.editGenreTextBox = new System.Windows.Forms.TextBox(); - this.addGenreButton = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.btnCancel = new MediaPortal.UserInterface.Controls.MPButton(); this.gbFileDetails.SuspendLayout(); this.tcFileItemData.SuspendLayout(); this.tabPage1.SuspendLayout(); - this.generalFileOptionsTab.SuspendLayout(); - this.generalFileItemOptionsGroupBox.SuspendLayout(); this.SuspendLayout(); // // gameinfoURLTextBox @@ -419,7 +397,6 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tcFileItemData.Controls.Add(this.tabPage1); - this.tcFileItemData.Controls.Add(this.generalFileOptionsTab); this.tcFileItemData.Location = new System.Drawing.Point(4, 8); this.tcFileItemData.Name = "tcFileItemData"; this.tcFileItemData.SelectedIndex = 0; @@ -436,203 +413,6 @@ this.tabPage1.Text = "Properties"; this.tabPage1.UseVisualStyleBackColor = true; // - // generalFileOptionsTab - // - this.generalFileOptionsTab.Controls.Add(this.generalFileItemOptionsGroupBox); - this.generalFileOptionsTab.Location = new System.Drawing.Point(4, 22); - this.generalFileOptionsTab.Name = "generalFileOptionsTab"; - this.generalFileOptionsTab.Padding = new System.Windows.Forms.Padding(3); - this.generalFileOptionsTab.Size = new System.Drawing.Size(521, 466); - this.generalFileOptionsTab.TabIndex = 2; - this.generalFileOptionsTab.Text = "General FileItem Options"; - this.generalFileOptionsTab.UseVisualStyleBackColor = true; - // - // generalFileItemOptionsGroupBox - // - this.generalFileItemOptionsGroupBox.Controls.Add(this.editSystemComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeSystemLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeSystemButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addSystemLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editSystemTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addSystemButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editManufacturerComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editManufacturerTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editGenreComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.label1); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editGenreTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); - this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(6, 6); - this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; - this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(509, 454); - this.generalFileItemOptionsGroupBox.TabIndex = 78; - this.generalFileItemOptionsGroupBox.TabStop = false; - // - // editSystemComboBox - // - this.editSystemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.editSystemComboBox.FormattingEnabled = true; - this.editSystemComboBox.Location = new System.Drawing.Point(91, 249); - this.editSystemComboBox.Name = "editSystemComboBox"; - this.editSystemComboBox.Size = new System.Drawing.Size(312, 21); - this.editSystemComboBox.TabIndex = 92; - // - // removeSystemLabel - // - this.removeSystemLabel.AutoSize = true; - this.removeSystemLabel.Location = new System.Drawing.Point(6, 252); - this.removeSystemLabel.Name = "removeSystemLabel"; - this.removeSystemLabel.Size = new System.Drawing.Size(82, 13); - this.removeSystemLabel.TabIndex = 91; - this.removeSystemLabel.Text = "Remove platform"; - // - // removeSystemButton - // - this.removeSystemButton.Location = new System.Drawing.Point(436, 249); - this.removeSystemButton.Name = "removeSystemButton"; - this.removeSystemButton.Size = new System.Drawing.Size(62, 23); - this.removeSystemButton.TabIndex = 90; - this.removeSystemButton.Text = "Remove.."; - this.removeSystemButton.UseVisualStyleBackColor = true; - this.removeSystemButton.Click += new System.EventHandler(this.removeSystemButton_Click); - // - // addSystemLabel - // - this.addSystemLabel.AutoSize = true; - this.addSystemLabel.Location = new System.Drawing.Point(6, 216); - this.addSystemLabel.Name = "addSystemLabel"; - this.addSystemLabel.Size = new System.Drawing.Size(69, 13); - this.addSystemLabel.TabIndex = 87; - this.addSystemLabel.Text = "Add System.."; - // - // editSystemTextBox - // - this.editSystemTextBox.Location = new System.Drawing.Point(91, 213); - this.editSystemTextBox.Name = "editSystemTextBox"; - this.editSystemTextBox.Size = new System.Drawing.Size(312, 20); - this.editSystemTextBox.TabIndex = 88; - // - // addSystemButton - // - this.addSystemButton.Location = new System.Drawing.Point(436, 213); - this.addSystemButton.Name = "addSystemButton"; - this.addSystemButton.Size = new System.Drawing.Size(62, 23); - this.addSystemButton.TabIndex = 89; - this.addSystemButton.Text = "Add.."; - this.addSystemButton.UseVisualStyleBackColor = true; - this.addSystemButton.Click += new System.EventHandler(this.addSystemButton_Click); - // - // editManufacturerComboBox - // - this.editManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.editManufacturerComboBox.FormattingEnabled = true; - this.editManufacturerComboBox.Location = new System.Drawing.Point(91, 165); - this.editManufacturerComboBox.Name = "editManufacturerComboBox"; - this.editManufacturerComboBox.Size = new System.Drawing.Size(312, 21); - this.editManufacturerComboBox.TabIndex = 86; - // - // removeManufacturerLabel - // - this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); - this.removeManufacturerLabel.Name = "removeManufacturerLabel"; - this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); - this.removeManufacturerLabel.TabIndex = 85; - this.removeManufacturerLabel.Text = "Remove Manufacturer"; - // - // removeManufacturerButton - // - this.removeManufacturerButton.Location = new System.Drawing.Point(436, 165); - this.removeManufacturerButton.Name = "removeManufacturerButton"; - this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); - this.removeManufacturerButton.TabIndex = 84; - this.removeManufacturerButton.Text = "Remove.."; - this.removeManufacturerButton.UseVisualStyleBackColor = true; - this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); - // - // addManufacturerLabel - // - this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); - this.addManufacturerLabel.Name = "addManufacturerLabel"; - this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); - this.addManufacturerLabel.TabIndex = 81; - this.addManufacturerLabel.Text = "Add Manufacturer.."; - // - // editManufacturerTextBox - // - this.editManufacturerTextBox.Location = new System.Drawing.Point(91, 129); - this.editManufacturerTextBox.Name = "editManufacturerTextBox"; - this.editManufacturerTextBox.Size = new System.Drawing.Size(312, 20); - this.editManufacturerTextBox.TabIndex = 82; - // - // addManufacturerButton - // - this.addManufacturerButton.Location = new System.Drawing.Point(436, 129); - this.addManufacturerButton.Name = "addManufacturerButton"; - this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); - this.addManufacturerButton.TabIndex = 83; - this.addManufacturerButton.Text = "Add.."; - this.addManufacturerButton.UseVisualStyleBackColor = true; - this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); - // - // editGenreComboBox - // - this.editGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.editGenreComboBox.FormattingEnabled = true; - this.editGenreComboBox.Location = new System.Drawing.Point(91, 70); - this.editGenreComboBox.Name = "editGenreComboBox"; - this.editGenreComboBox.Size = new System.Drawing.Size(312, 21); - this.editGenreComboBox.TabIndex = 80; - // - // removeGenreLabel - // - this.removeGenreLabel.AutoSize = true; - this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); - this.removeGenreLabel.Name = "removeGenreLabel"; - this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); - this.removeGenreLabel.TabIndex = 79; - this.removeGenreLabel.Text = "Remove genre"; - // - // removeGenreButton - // - this.removeGenreButton.Location = new System.Drawing.Point(436, 70); - this.removeGenreButton.Name = "removeGenreButton"; - this.removeGenreButton.Size = new System.Drawing.Size(62, 23); - this.removeGenreButton.TabIndex = 78; - this.removeGenreButton.Text = "Remove.."; - this.removeGenreButton.UseVisualStyleBackColor = true; - this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 37); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(64, 13); - this.label1.TabIndex = 74; - this.label1.Text = "Add Genre.."; - // - // editGenreTextBox - // - this.editGenreTextBox.Location = new System.Drawing.Point(91, 34); - this.editGenreTextBox.Name = "editGenreTextBox"; - this.editGenreTextBox.Size = new System.Drawing.Size(312, 20); - this.editGenreTextBox.TabIndex = 75; - // - // addGenreButton - // - this.addGenreButton.Location = new System.Drawing.Point(436, 34); - this.addGenreButton.Name = "addGenreButton"; - this.addGenreButton.Size = new System.Drawing.Size(62, 23); - this.addGenreButton.TabIndex = 76; - this.addGenreButton.Text = "Add.."; - this.addGenreButton.UseVisualStyleBackColor = true; - this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); - // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -664,9 +444,6 @@ this.gbFileDetails.PerformLayout(); this.tcFileItemData.ResumeLayout(false); this.tabPage1.ResumeLayout(false); - this.generalFileOptionsTab.ResumeLayout(false); - this.generalFileItemOptionsGroupBox.ResumeLayout(false); - this.generalFileItemOptionsGroupBox.PerformLayout(); this.ResumeLayout(false); } @@ -705,27 +482,7 @@ private System.Windows.Forms.Label subGenreLabel; private System.Windows.Forms.ComboBox subGenreComboBox; private System.Windows.Forms.ComboBox genreComboBox; - private System.Windows.Forms.TabPage generalFileOptionsTab; - private System.Windows.Forms.GroupBox generalFileItemOptionsGroupBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox editGenreTextBox; - private System.Windows.Forms.Button addGenreButton; - private System.Windows.Forms.Label removeGenreLabel; - private System.Windows.Forms.Button removeGenreButton; - private System.Windows.Forms.ComboBox editGenreComboBox; private System.Windows.Forms.ComboBox systemComboBox; private System.Windows.Forms.ComboBox manufacturerComboBox; - private System.Windows.Forms.ComboBox editSystemComboBox; - private System.Windows.Forms.Label removeSystemLabel; - private System.Windows.Forms.Button removeSystemButton; - private System.Windows.Forms.Label addSystemLabel; - private System.Windows.Forms.TextBox editSystemTextBox; - private System.Windows.Forms.Button addSystemButton; - private System.Windows.Forms.ComboBox editManufacturerComboBox; - private System.Windows.Forms.Label removeManufacturerLabel; - private System.Windows.Forms.Button removeManufacturerButton; - private System.Windows.Forms.Label addManufacturerLabel; - private System.Windows.Forms.TextBox editManufacturerTextBox; - private System.Windows.Forms.Button addManufacturerButton; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -156,10 +156,8 @@ private void UpdateComboBoxes() { - FillComboBox("tblPlatform", "platform", editSystemComboBox); - FillComboBox("tblManufacturer", "manufacturer", editManufacturerComboBox); - FillComboBox("tblGenre", "genre", editGenreComboBox); + FillComboBox("tblPlatform", "platform", systemComboBox); FillComboBox("tblManufacturer", "manufacturer", manufacturerComboBox); FillComboBox("tblGenre", "genre",genreComboBox); @@ -284,144 +282,7 @@ } } - private void InsertData(string tableName,string column,string insertValue) - { - string sqlStmt = @" - INSERT INTO - " + tableName + @" - ( - "+ column + @" - ) - VALUES - ( - " + insertValue + @" - ) - "; + - try - { - DatabaseHandler.sqlDB.Execute(sqlStmt); - } - catch (Exception exception) - { - throw exception; - } - } - - //if something was removed that is in a fileitem - //set it to as default value (unknown) - private void UpdateFileItems(string removedField,string removedValue) - { - string sqlStmt = @" - UPDATE - tblFileItem - - SET - " + removedField + @" = 1 - - WHERE - " + removedField + @" = " + removedValue; - - try - { - // - - DatabaseHandler.sqlDB.Execute(sqlStmt); - - - } - catch (Exception exception) - { - throw exception; - } - - - } - - - private void DeleteData(string tableName, string column, string uniqueValue) - { - //never remove 1 (unknown) - string sqlStmt = @" - DELETE FROM - " + tableName + @" - - WHERE - " + column + @" = " + uniqueValue + @" - - AND - " + column + @" <> 1 "; - - - - try - { - DatabaseHandler.sqlDB.Execute(sqlStmt); - } - catch (Exception exception) - { - throw exception; - } - } - - private void addGenreButton_Click(object sender, EventArgs e) - { - InsertData("tblGenre", "genre", "'" + this.editGenreTextBox.Text + "'"); - UpdateComboBoxes(); - } - - private void removeGenreButton_Click(object sender, EventArgs e) - { - DeleteData("tblGenre", "genreId", this.editGenreComboBox.SelectedValue.ToString()); - if (CurFile.MainGenreId == (int)editGenreComboBox.SelectedValue) - { - CurFile.MainGenreId = 1; - CurFile.SubGenreId = 1; - } - UpdateFileItems("mainGenreId", this.editGenreComboBox.SelectedValue.ToString()); - UpdateFileItems("subGenreId", this.editGenreComboBox.SelectedValue.ToString()); - - - UpdateComboBoxes(); - } - - private void removeManufacturerButton_Click(object sender, EventArgs e) - { - DeleteData("tblManufacturer", "manufacturerId", this.editManufacturerComboBox.SelectedValue.ToString()); - if (CurFile.ManufacturerId == (int)this.editManufacturerComboBox.SelectedValue) - { - CurFile.ManufacturerId = 1; - } - UpdateFileItems("manufacturerId", this.editManufacturerComboBox.SelectedValue.ToString()); - - UpdateComboBoxes(); - - } - - private void addManufacturerButton_Click(object sender, EventArgs e) - { - InsertData("tblManufacturer", "manufacturer", "'" + this.editManufacturerTextBox.Text + "'"); - UpdateComboBoxes(); - - } - - private void addSystemButton_Click(object sender, EventArgs e) - { - InsertData("tblSystem", "platform", "'" + this.editSystemTextBox.Text + "'"); - UpdateComboBoxes(); - } - - private void removeSystemButton_Click(object sender, EventArgs e) - { - DeleteData("tblSystem", "systemId", this.editSystemComboBox.SelectedValue.ToString()); - if (CurFile.PlatformId == (int)this.editSystemComboBox.SelectedValue) - { - CurFile.PlatformId = 1; - } - UpdateFileItems("systemId", this.editSystemComboBox.SelectedValue.ToString()); - - UpdateComboBoxes(); - - } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -28,7 +28,7 @@ /// </summary> private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Applications"); + System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Applications"); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -46,8 +46,30 @@ this.detailsTabPage = new System.Windows.Forms.TabPage(); this.directoryTabPage = new System.Windows.Forms.TabPage(); this.viewTabPage = new System.Windows.Forms.TabPage(); + this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); + this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); + this.removePlatformLabel = new System.Windows.Forms.Label(); + this.removePlatformButton = new System.Windows.Forms.Button(); + this.addPlatformLabel = new System.Windows.Forms.Label(); + this.addPlatformTextBox = new System.Windows.Forms.TextBox(); + this.addPlatformButton = new System.Windows.Forms.Button(); + this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.removeManufacturerLabel = new System.Windows.Forms.Label(); + this.removeManufacturerButton = new System.Windows.Forms.Button(); + this.addManufacturerLabel = new System.Windows.Forms.Label(); + this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); + this.addManufacturerButton = new System.Windows.Forms.Button(); + this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); + this.removeGenreLabel = new System.Windows.Forms.Label(); + this.removeGenreButton = new System.Windows.Forms.Button(); + this.addGenreLabel = new System.Windows.Forms.Label(); + this.addGenreTextBox = new System.Windows.Forms.TextBox(); + this.addGenreButton = new System.Windows.Forms.Button(); this.menuStrip.SuspendLayout(); this.tabControl.SuspendLayout(); + this.dbOptionsTabPage.SuspendLayout(); + this.generalFileItemOptionsGroupBox.SuspendLayout(); this.SuspendLayout(); // // menuStrip @@ -67,7 +89,7 @@ this.addApplicationToolStripMenuItem, this.deleteApplicationToolStripMenuItem}); this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; - this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(132, 20); + this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(146, 20); this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; // // addApplicationToolStripMenuItem @@ -77,20 +99,20 @@ this.addGroupnodeToolStripMenuItem, this.extendedApplicationItemToolStripMenuItem}); this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; - this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.addApplicationToolStripMenuItem.Text = "Add application"; // // applicationWithFiledirectoryToolStripMenuItem // this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; - this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler(this.applicationWithFiledirectoryToolStripMenuItem_Click); // // addGroupnodeToolStripMenuItem // this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; - this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler(this.addGroupnodeToolStripMenuItem_Click); // @@ -100,20 +122,20 @@ this.mameImportToolStripMenuItem, this.importGamebaseItemToolStripMenuItem}); this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; - this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; // // mameImportToolStripMenuItem // this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; - this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.mameImportToolStripMenuItem.Text = "Import Mame"; this.mameImportToolStripMenuItem.Click += new System.EventHandler(this.mameImportToolStripMenuItem_Click); // // importGamebaseItemToolStripMenuItem // this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; - this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler(this.importGamebaseItemToolStripMenuItem_Click); // @@ -121,7 +143,7 @@ // this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; - this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.deleteApplicationToolStripMenuItem.Text = "Delete application"; this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler(this.deleteApplicationToolStripMenuItem_Click); // @@ -130,7 +152,7 @@ this.toolsStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.premadeConfigurationsToolStripMenuItem}); this.toolsStripMenuItem.Name = "toolsStripMenuItem"; - this.toolsStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.toolsStripMenuItem.Size = new System.Drawing.Size(48, 20); this.toolsStripMenuItem.Text = "Tools"; // // premadeConfigurationsToolStripMenuItem @@ -138,13 +160,13 @@ this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.emulatorSetupToolStripMenuItem}); this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; - this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(155, 22); + this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(153, 22); this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; // // emulatorSetupToolStripMenuItem // this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; - this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(158, 22); + this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(155, 22); this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; // // treeView @@ -155,33 +177,35 @@ this.treeView.LabelEdit = true; this.treeView.Location = new System.Drawing.Point(0, 27); this.treeView.Name = "treeView"; - treeNode1.Name = "applicationNode"; - treeNode1.Text = "Applications"; + treeNode3.Name = "applicationNode"; + treeNode3.Text = "Applications"; this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode1}); + treeNode3}); this.treeView.Size = new System.Drawing.Size(224, 576); this.treeView.TabIndex = 8; + this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); + this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_AfterLabelEdit); - this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); + this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter); - this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_BeforeLabelEdit); this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeSelect); this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag); - this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); // // tabControl // this.tabControl.Controls.Add(this.detailsTabPage); this.tabControl.Controls.Add(this.directoryTabPage); this.tabControl.Controls.Add(this.viewTabPage); + this.tabControl.Controls.Add(this.dbOptionsTabPage); this.tabControl.Location = new System.Drawing.Point(230, 27); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; this.tabControl.ShowToolTips = true; this.tabControl.Size = new System.Drawing.Size(505, 577); this.tabControl.TabIndex = 2; + this.tabControl.Click += new System.EventHandler(this.dbOptionsTabPage_Click); this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); // // detailsTabPage @@ -214,6 +238,204 @@ this.viewTabPage.TabIndex = 2; this.viewTabPage.Text = "Views"; // + // dbOptionsTabPage + // + this.dbOptionsTabPage.Controls.Add(this.generalFileItemOptionsGroupBox); + this.dbOptionsTabPage.Location = new System.Drawing.Point(4, 22); + this.dbOptionsTabPage.Name = "dbOptionsTabPage"; + this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.dbOptionsTabPage.Size = new System.Drawing.Size(497, 551); + this.dbOptionsTabPage.TabIndex = 3; + this.dbOptionsTabPage.Text = "DB options"; + this.dbOptionsTabPage.UseVisualStyleBackColor = true; + this.dbOptionsTabPage.Click += new System.EventHandler(this.dbOptionsTabPage_Click); + // + // generalFileItemOptionsGroupBox + // + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); + this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(3, 6); + this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; + this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(488, 496); + this.generalFileItemOptionsGroupBox.TabIndex = 79; + this.generalFileItemOptionsGroupBox.TabStop = false; + // + // removePlatformComboBox + // + this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removePlatformComboBox.FormattingEnabled = true; + this.removePlatformComboBox.Location = new System.Drawing.Point(99, 249); + this.removePlatformComboBox.Name = "removePlatformComboBox"; + this.removePlatformComboBox.Size = new System.Drawing.Size(306, 21); + this.removePlatformComboBox.TabIndex = 92; + // + // removePlatformLabel + // + this.removePlatformLabel.AutoSize = true; + this.removePlatformLabel.Location = new System.Drawing.Point(6, 252); + this.removePlatformLabel.Name = "removePlatformLabel"; + this.removePlatformLabel.Size = new System.Drawing.Size(87, 13); + this.removePlatformLabel.TabIndex = 91; + this.removePlatformLabel.Text = "Remove platform"; + // + // removePlatformButton + // + this.removePlatformButton.Location = new System.Drawing.Point(411, 249); + this.removePlatformButton.Name = "removePlatformButton"; + this.removePlatformButton.Size = new System.Drawing.Size(62, 23); + this.removePlatformButton.TabIndex = 90; + this.removePlatformButton.Text = "Remove.."; + this.removePlatformButton.UseVisualStyleBackColor = true; + this.removePlatformButton.Click += new System.EventHandler(this.removePlatformButton_Click); + // + // addPlatformLabel + // + this.addPlatformLabel.AutoSize = true; + this.addPlatformLabel.Location = new System.Drawing.Point(6, 216); + this.addPlatformLabel.Name = "addPlatformLabel"; + this.addPlatformLabel.Size = new System.Drawing.Size(72, 13); + this.addPlatformLabel.TabIndex = 87; + this.addPlatformLabel.Text = "Add platform.."; + // + // addPlatformTextBox + // + this.addPlatformTextBox.Location = new System.Drawing.Point(99, 213); + this.addPlatformTextBox.Name = "addPlatformTextBox"; + this.addPlatformTextBox.Size = new System.Drawing.Size(306, 20); + this.addPlatformTextBox.TabIndex = 88; + // + // addPlatformButton + // + this.addPlatformButton.Location = new System.Drawing.Point(411, 213); + this.addPlatformButton.Name = "addPlatformButton"; + this.addPlatformButton.Size = new System.Drawing.Size(62, 23); + this.addPlatformButton.TabIndex = 89; + this.addPlatformButton.Text = "Add.."; + this.addPlatformButton.UseVisualStyleBackColor = true; + this.addPlatformButton.Click += new System.EventHandler(this.addPlatformButton_Click); + // + // removeManufacturerComboBox + // + this.removeManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removeManufacturerComboBox.FormattingEnabled = true; + this.removeManufacturerComboBox.Location = new System.Drawing.Point(99, 165); + this.removeManufacturerComboBox.Name = "removeManufacturerComboBox"; + this.removeManufacturerComboBox.Size = new System.Drawing.Size(306, 21); + this.removeManufacturerComboBox.TabIndex = 86; + // + // removeManufacturerLabel + // + this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); + this.removeManufacturerLabel.Name = "removeManufacturerLabel"; + this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); + this.removeManufacturerLabel.TabIndex = 85; + this.removeManufacturerLabel.Text = "Remove Manufacturer"; + // + // removeManufacturerButton + // + this.removeManufacturerButton.Location = new System.Drawing.Point(411, 165); + this.removeManufacturerButton.Name = "removeManufacturerButton"; + this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.removeManufacturerButton.TabIndex = 84; + this.removeManufacturerButton.Text = "Remove.."; + this.removeManufacturerButton.UseVisualStyleBackColor = true; + this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); + // + // addManufacturerLabel + // + this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); + this.addManufacturerLabel.Name = "addManufacturerLabel"; + this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); + this.addManufacturerLabel.TabIndex = 81; + this.addManufacturerLabel.Text = "Add Manufacturer.."; + // + // addManufacturerTextBox + // + this.addManufacturerTextBox.Location = new System.Drawing.Point(99, 129); + this.addManufacturerTextBox.Name = "addManufacturerTextBox"; + this.addManufacturerTextBox.Size = new System.Drawing.Size(306, 20); + this.addManufacturerTextBox.TabIndex = 82; + // + // addManufacturerButton + // + this.addManufacturerButton.Location = new System.Drawing.Point(411, 129); + this.addManufacturerButton.Name = "addManufacturerButton"; + this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.addManufacturerButton.TabIndex = 83; + this.addManufacturerButton.Text = "Add.."; + this.addManufacturerButton.UseVisualStyleBackColor = true; + this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); + // + // removeGenreComboBox + // + this.removeGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removeGenreComboBox.FormattingEnabled = true; + this.removeGenreComboBox.Location = new System.Drawing.Point(99, 70); + this.removeGenreComboBox.Name = "removeGenreComboBox"; + this.removeGenreComboBox.Size = new System.Drawing.Size(306, 21); + this.removeGenreComboBox.TabIndex = 80; + // + // removeGenreLabel + // + this.removeGenreLabel.AutoSize = true; + this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); + this.removeGenreLabel.Name = "removeGenreLabel"; + this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); + this.removeGenreLabel.TabIndex = 79; + this.removeGenreLabel.Text = "Remove genre"; + // + // removeGenreButton + // + this.removeGenreButton.Location = new System.Drawing.Point(411, 70); + this.removeGenreButton.Name = "removeGenreButton"; + this.removeGenreButton.Size = new System.Drawing.Size(62, 23); + this.removeGenreButton.TabIndex = 78; + this.removeGenreButton.Text = "Remove.."; + this.removeGenreButton.UseVisualStyleBackColor = true; + this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); + // + // addGenreLabel + // + this.addGenreLabel.AutoSize = true; + this.addGenreLabel.Location = new System.Drawing.Point(6, 37); + this.addGenreLabel.Name = "addGenreLabel"; + this.addGenreLabel.Size = new System.Drawing.Size(62, 13); + this.addGenreLabel.TabIndex = 74; + this.addGenreLabel.Text = "Add genre.."; + // + // addGenreTextBox + // + this.addGenreTextBox.Location = new System.Drawing.Point(99, 34); + this.addGenreTextBox.Name = "addGenreTextBox"; + this.addGenreTextBox.Size = new System.Drawing.Size(306, 20); + this.addGenreTextBox.TabIndex = 75; + // + // addGenreButton + // + this.addGenreButton.Location = new System.Drawing.Point(411, 34); + this.addGenreButton.Name = "addGenreButton"; + this.addGenreButton.Size = new System.Drawing.Size(62, 23); + this.addGenreButton.TabIndex = 76; + this.addGenreButton.Text = "Add.."; + this.addGenreButton.UseVisualStyleBackColor = true; + this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); + // // SetupForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -229,11 +451,14 @@ this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "SetupForm"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SetupForm_FormClosed); this.Load += new System.EventHandler(this.SetupForm_Load); - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SetupForm_FormClosed); this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.tabControl.ResumeLayout(false); + this.dbOptionsTabPage.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -258,5 +483,25 @@ private System.Windows.Forms.ToolStripMenuItem extendedApplicationItemToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem mameImportToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importGamebaseItemToolStripMenuItem; + private System.Windows.Forms.TabPage dbOptionsTabPage; + private System.Windows.Forms.GroupBox generalFileItemOptionsGroupBox; + private System.Windows.Forms.ComboBox removePlatformComboBox; + private System.Windows.Forms.Label removePlatformLabel; + private System.Windows.Forms.Button removePlatformButton; + private System.Windows.Forms.Label addPlatformLabel; + private System.Windows.Forms.TextBox addPlatformTextBox; + private System.Windows.Forms.Button addPlatformButton; + private System.Windows.Forms.ComboBox removeManufacturerComboBox; + private System.Windows.Forms.Label removeManufacturerLabel; + private System.Windows.Forms.Button removeManufacturerButton; + private System.Windows.Forms.Label addManufacturerLabel; + private System.Windows.Forms.TextBox addManufacturerTextBox; + private System.Windows.Forms.Button addManufacturerButton; + private System.Windows.Forms.ComboBox removeGenreComboBox; + private System.Windows.Forms.Label removeGenreLabel; + private System.Windows.Forms.Button removeGenreButton; + private System.Windows.Forms.Label addGenreLabel; + private System.Windows.Forms.TextBox addGenreTextBox; + private System.Windows.Forms.Button addGenreButton; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -8,6 +8,7 @@ using System.Windows.Forms; using MediaPortal.GUI.Library; using MediaPortal.Util; +using SQLite.NET; using MediaPortal.Configuration; using System.IO; @@ -327,6 +328,15 @@ viewTabPage.Refresh(); } + private void AddDBOptionsPage() + { + if (!TabIsDisplayed(dbOptionsTabPage)) + { + tabControl.Controls.Add(dbOptionsTabPage); + } + dbOptionsTabPage.Refresh(); + } + private void RemoveFilesPage() { if (TabIsDisplayed(directoryTabPage)) @@ -343,7 +353,15 @@ } } + void RemoveDBOptionsPage() + { + if (TabIsDisplayed(this.dbOptionsTabPage)) + { + tabControl.Controls.Remove(this.dbOptionsTabPage); + } + } + private void SyncPanel(AppSettingsBase pageSettings) { this.tabControl.TabPages["detailsTabPage"].Controls.Clear(); @@ -358,6 +376,7 @@ if (currentApplication != null) { RemoveViewsPage(); + RemoveDBOptionsPage(); if (currentApplication.FileEditorAllowed()) { AddFilesPage(currentApplication); @@ -372,6 +391,7 @@ // special treatment for root node RemoveFilesPage(); AddViewsPage(); + AddDBOptionsPage(); } } } @@ -934,7 +954,83 @@ toolsStripMenuItem.Enabled = true; } } + private void UpdateComboBoxes() + { + FillComboBox("tblPlatform", "platform", removePlatformComboBox); + FillComboBox("tblManufacturer", "manufacturer", removeManufacturerComboBox); + FillComboBox("tblGenre", "genre", removeGenreComboBox); + } + + public class ListItem + { + private string text; + + public string Text + { + get { return text; } + set { text = value; } + } + private int value; + + public int Value + { + get { return this.value; } + set { this.value = value; } + } + + public ListItem(string label, int data) + { + text = label; + value = data; + } + + + } + + private void FillComboBox(string tableName, string orderBy, ComboBox comboBox) + { + + + List<ListItem> listItemList = new List<ListItem>(); + SQLiteResultSet resultSet = null; + + string sqlStmt = @" + SELECT + * + + FROM + " + tableName + @" + + ORDER BY " + orderBy; + + try + { + resultSet = DatabaseHandler.sqlDB.Execute(sqlStmt); + } + catch (Exception exception) + { + throw exception; + } + + if (resultSet.Rows.Count > 0) + { + for (int i = 0; i < resultSet.Rows.Count; i++) + { + //genreid why oh why cant the implementation offer getvalue from columname... arrghr + //maybe can use the sqlnet provider later on.. + + ListItem listItem = new ListItem(resultSet.Rows[i].fields[1].ToString(), Convert.ToInt32(resultSet.Rows[i].fields[0])); + listItemList.Add(listItem); + } + + + comboBox.DataSource = listItemList; + comboBox.ValueMember = "Value"; + comboBox.DisplayMember = "Text"; + } + } + private void mameImportToolStripMenuItem_Click(object sender, EventArgs e) { AddApplication(ApplicationType.MAMEDIRECT); @@ -949,5 +1045,136 @@ { this.tabControl.SelectedIndex = 0; } + + private void addGenreButton_Click(object sender, EventArgs e) + { + InsertData("tblGenre", "genre", "'" + this.addGenreTextBox.Text + "'"); + UpdateComboBoxes(); + } + + private void removeGenreButton_Click(object sender, EventArgs e) + { + DeleteData("tblGenre", "genreId", this.removeGenreComboBox.SelectedValue.ToString()); + UpdateFileItems("mainGenreId", this.removeGenreComboBox.SelectedValue.ToString()); + UpdateFileItems("subGenreId", this.removeGenreComboBox.SelectedValue.ToString()); + UpdateComboBoxes(); + } + + private void addManufacturerButton_Click(object sender, EventArgs e) + { + InsertData("tblManufacturer", "manufacturer", "'" + this.addManufacturerTextBox.Text + "'"); + UpdateComboBoxes(); + + } + + private void removeManufacturerButton_Click(object sender, EventArgs e) + { + DeleteData("tblManufacturer", "manufacturerId", this.removeManufacturerComboBox.SelectedValue.ToString()); + UpdateFileItems("manufacturerId", this.removeManufacturerComboBox.SelectedValue.ToString()); + + UpdateComboBoxes(); + } + + private void addPlatformButton_Click(object sender, EventArgs e) + { + InsertData("tblPlatform", "platform", "'" + this.addPlatformTextBox.Text + "'"); + UpdateComboBoxes(); + } + + private void removePlatformButton_Click(object sender, EventArgs e) + { + DeleteData("tblPlatform", "platformId", this.removePlatformComboBox.SelectedValue.ToString()); + UpdateFileItems("platformId", this.removePlatformComboBox.SelectedValue.ToString()); + UpdateComboBoxes(); + } + + private void InsertData(string tableName, string column, string insertValue) + { + string sqlStmt = @" + INSERT INTO + " + tableName + @" + ( + " + column + @" + ) + VALUES + ( + " + insertValue + @" + ) + "; + + try + { + DatabaseHandler.sqlDB.Execute(sqlStmt); + } + catch (Exception exception) + { + throw exception; + } + } + + //if something was removed that is in a fileitem + //set it to as default value (unknown) + private void UpdateFileItems(string removedField, string removedValue) + { + string sqlStmt = @" + U... [truncated message content] |
From: <nor...@us...> - 2007-07-07 21:11:01
|
Revision: 676 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=676&view=rev Author: northern_sky Date: 2007-07-07 14:10:58 -0700 (Sat, 07 Jul 2007) Log Message: ----------- merged programsort, added base for sorting. Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/ Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-06 05:03:26 UTC (rev 675) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-07 21:10:58 UTC (rev 676) @@ -40,6 +40,7 @@ using GUIPrograms.Database; using GUIPrograms.FileItems; + namespace GUIPrograms.ApplicationItems { public class ApplicationItem @@ -67,6 +68,7 @@ int appPosition; string currentView = ""; + public bool filesAreLoaded = false; // load on demand.... protected FileItemList fileList = null; public bool linksAreLoaded = false; // load on demand.... @@ -98,7 +100,7 @@ string lastFilepath = ""; // cached path //private DatabaseSorter dbPc = new DatabaseSorter(); - private ProgramSort dbPc = new ProgramSort(ProgramSort.SortMethod.Name, true); + //private ProgramSort dbPc = new ProgramSort(ProgramSort.SortMethod.Name, true); #endregion @@ -213,6 +215,8 @@ get { return currentView; } set { currentView = value; } } + + public FileItemList Files { // load on demand.... @@ -312,16 +316,18 @@ } - public int CurrentSortIndex - { + /* public int CurrentSortIndex + { get { return GetCurrentSortIndex(); } - set { SetCurrentSortIndex(value); } - } - public bool CurrentSortIsAscending - { - get { return GetCurrentSortIsAscending(); } - set { SetCurrentSortIsAscending(value); } - } + set { SetCurrentSortIndex(value); } + + }*/ + /* public bool CurrentSortIsAscending + { + get { return GetCurrentSortIsAscending(); } + set { SetCurrentSortIsAscending(value); } + + } */ #endregion @@ -764,10 +770,10 @@ */ } - public virtual void OnSortToggle(GUIFacadeControl view) + /* public virtual void OnSortToggle(GUIFacadeControl view) { - dbPc.SortAscending = (!dbPc.SortAscending); - view.Sort(dbPc); + // dbPc.SortAscending = (!dbPc.SortAscending); + //view.Sort(dbPc); } public virtual int GetCurrentSortIndex() @@ -794,7 +800,7 @@ { dbPc.SortAscending = newValue; } - + */ #endregion Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs 2007-07-06 05:03:26 UTC (rev 675) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs 2007-07-07 21:10:58 UTC (rev 676) @@ -305,7 +305,7 @@ cbOperators.SelectionChangeCommitted += new EventHandler(ComboBox_SelectionChangeCommitted); //Create the combo box object and set its properties - SyncedComboBox cbView = new SyncedComboBox("ViewAs"); + SyncedComboBox cbView = new SyncedComboBox("ViewLayout"); foreach (string strText in viewsAs) cbView.Items.Add(strText); cbView.Grid = dataGrid; @@ -329,7 +329,7 @@ arrColumnNames[1] = "Operator"; arrColumnNames[2] = "Restriction"; arrColumnNames[3] = "Limit"; - arrColumnNames[4] = "ViewAs"; + arrColumnNames[4] = "ViewLayout"; arrColumnNames[5] = "SortBy"; //Create the Data Table object which will then be used to hold Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-06 05:03:26 UTC (rev 675) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-07 21:10:58 UTC (rev 676) @@ -94,7 +94,7 @@ } public string Author() { - return "Reconstruct by Northern & chefkoch"; + return "Reconstruct by Northern/Chefkoch"; } public void ShowPlugin() { @@ -140,8 +140,8 @@ [Serializable] public class MapSettings { - protected int sortBy; - protected int viewAs; + protected int sortMethod; + protected int viewLayout; protected bool sortAscending; protected int lastApplicationID; protected int lastFileID; @@ -150,8 +150,8 @@ public MapSettings() { - sortBy = 0; //name - viewAs = 0; //list + sortMethod = 0; //name + viewLayout = 0; //list sortAscending = true; overviewVisible = true; lastApplicationID = -1; @@ -160,18 +160,18 @@ } - [XmlElement("SortBy")] - public int SortBy + [XmlElement("SortMethod")] + public int SortMethod { - get { return sortBy; } - set { sortBy = value; } + get { return sortMethod; } + set { sortMethod = value; } } - [XmlElement("ViewAs")] - public int ViewAs + [XmlElement("ViewLayout")] + public int ViewLayout { - get { return viewAs; } - set { viewAs = value; } + get { return viewLayout; } + set { viewLayout = value; } } [XmlElement("SortAscending")] @@ -210,34 +210,38 @@ } - public string ViewAsText + public string ViewLayoutTextName { - get { return GetViewAsText(); } + get { return GetViewLayoutAsText(); } } - public void SwitchToNextView() + public void SwitchToNextViewLayout() { - switch ((Layout)ViewAs) + switch ((Layout)ViewLayout) { case Layout.List: - ViewAs = (int)Layout.Icons; + ViewLayout = (int)Layout.Icons; + break; case Layout.Icons: - ViewAs = (int)Layout.LargeIcons; + ViewLayout = (int)Layout.LargeIcons; + break; case Layout.LargeIcons: - ViewAs = (int)Layout.FilmStrip; + ViewLayout = (int)Layout.FilmStrip; + break; case Layout.FilmStrip: - ViewAs = (int)Layout.List; + ViewLayout = (int)Layout.List; + break; } } - string GetViewAsText() + string GetViewLayoutAsText() { string result = ""; - switch ((Layout)ViewAs) + switch ((Layout)ViewLayout) { case Layout.List: result = GUILocalizeStrings.Get(101); @@ -261,33 +265,33 @@ { using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - switch ((Layout)mapSettings.ViewAs) + switch ((Layout)mapSettings.ViewLayout) { case Layout.List: - xmlwriter.SetValue("myprograms", "viewby", "list"); + xmlwriter.SetValue("myprograms", "viewLayout", "list"); break; case Layout.Icons: - xmlwriter.SetValue("myprograms", "viewby", "icons"); + xmlwriter.SetValue("myprograms", "viewLayout", "icons"); break; case Layout.LargeIcons: - xmlwriter.SetValue("myprograms", "viewby", "largeicons"); + xmlwriter.SetValue("myprograms", "viewLayout", "largeicons"); break; case Layout.FilmStrip: - xmlwriter.SetValue("myprograms", "viewby", "filmstrip"); + xmlwriter.SetValue("myprograms", "viewLayout", "filmstrip"); break; } xmlwriter.SetValue("myprograms", "lastAppID", mapSettings.LastAppID.ToString()); // xmlwriter.SetValue("myprograms", "lastViewLevel", mapSettings.LastViewLevel.ToString()); xmlwriter.SetValue("myprograms", "lastViewLevel", DatabaseHandler.ViewHandler.CurrentLevel); - xmlwriter.SetValue("myprograms", "sortby", mapSettings.SortBy); + xmlwriter.SetValue("myprograms", "sortMethod", mapSettings.SortMethod); // avoid bool conversion...... don't wanna know why it doesn't work! :-( if (mapSettings.SortAscending) { - xmlwriter.SetValue("myprograms", "sortasc", "yes"); + xmlwriter.SetValue("myprograms", "sortASC", "yes"); } else { - xmlwriter.SetValue("myprograms", "sortasc", "no"); + xmlwriter.SetValue("myprograms", "sortASC", "no"); } if (mapSettings.OverviewVisible) @@ -300,13 +304,14 @@ } xmlwriter.SetValue("myprograms", "startWindow", StartWindow.ToString()); - xmlwriter.SetValue("myprograms", "startview", CurrentView); + xmlwriter.SetValue("myprograms", "startview", (int)CurrentLayout); } } void LoadSettings() { string _slideSpeed = DatabaseHandler.ReadSetting(ProgramUtils.cSLIDESPEED); + if ((_slideSpeed != "") && (_slideSpeed != null)) { slideSpeed = int.Parse(_slideSpeed); @@ -315,26 +320,22 @@ using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string curText = ""; - curText = xmlreader.GetValueAsString("myprograms", "viewby", "list"); - if (curText == "list") - mapSettings.ViewAs = (int)Layout.List; - else if (curText == "icons") - mapSettings.ViewAs = (int)Layout.Icons; - else if (curText == "largeicons") - mapSettings.ViewAs = (int)Layout.LargeIcons; - else if (curText == "filmstrip") - mapSettings.ViewAs = (int)Layout.FilmStrip; - else - mapSettings.ViewAs = (int)Layout.List; + curText = xmlreader.GetValueAsString("myprograms", "viewLayout", "list"); + if (curText == "list") mapSettings.ViewLayout = (int)Layout.List; + else if (curText == "icons") mapSettings.ViewLayout = (int)Layout.Icons; + else if (curText == "largeicons") mapSettings.ViewLayout = (int)Layout.LargeIcons; + else if (curText == "filmstrip") mapSettings.ViewLayout = (int)Layout.FilmStrip; + else mapSettings.ViewLayout = (int)Layout.List; + + CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myprograms", "sortMethod", (int)ProgramSort.SortMethod.Name); + mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - mapSettings.SortBy = xmlreader.GetValueAsInt("myprograms", "sortby", 0); - mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortasc", true); - mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortasc", true); + mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortASC", true); + mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortASC", true); StartWindow = xmlreader.GetValueAsInt("myprograms", "startWindow", GetID); - CurrentView = xmlreader.GetValueAsString("myprograms", "startview", String.Empty); } } @@ -345,8 +346,8 @@ { mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - mapSettings.SortBy = xmlreader.GetValueAsInt("myprograms", "sortby", 0); - mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortasc", true); + mapSettings.SortMethod = xmlreader.GetValueAsInt("myprograms", "sortMethod", 0); + mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortAsc", true); mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "overviewvisible", true); } } @@ -374,7 +375,7 @@ #region SkinControls - enum Layout + public enum Layout { List = 0, Icons = 1, @@ -385,11 +386,12 @@ // Buttons [SkinControl(2)] protected GUIButtonControl btnViewAs = null; - [SkinControl(3)] - protected GUIButtonControl btnRefresh = null; + [SkinControlAttribute(3)] + protected GUISortButtonControl btnSortBy = null; [SkinControl(4)] protected GUIButtonControl btnViews = null; - + [SkinControl(5)] + protected GUIButtonControl btnRefresh = null; //Images [SkinControl(6)] protected GUIImage screenShotImage = null; @@ -411,12 +413,6 @@ skipInit = true; } - ~GUIPrograms() - { - SaveSettings(); - //FolderSettings.DeleteFolderSetting("root", "Programs"); - } - #endregion #region Init / DeInit @@ -450,8 +446,7 @@ if (lastApp != null) { lastFilepath = lastApp.DefaultFilepath(); - lastApp.CurrentSortIndex = mapSettings.SortBy; - lastApp.CurrentSortIsAscending = mapSettings.SortAscending; + this.CurrentSortAsc = mapSettings.SortAscending; DatabaseHandler.ViewHandler.CurrentLevel = mapSettings.LastViewLevel; } else @@ -467,24 +462,25 @@ #region Base & Content Variables + static int startWindow = (int)GUIWindow.Window.WINDOW_FILES; - + protected ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Name; + string currentView = ""; + bool currentSortAsc = true; + static ApplicationItemList applicationList = DatabaseHandler.ApplicationItemList; MapSettings mapSettings = new MapSettings(); DirectoryHistory itemHistory = new DirectoryHistory(); ApplicationItem lastApp = null; + string lastFilepath = ""; int selectedItemIndex = -1; int slideSpeed = 3000; // speed in milliseconds between two slides long slideTime = 0; + public Layout currentLayout = Layout.List; bool skipInit = false; - static string currentView = ""; - Layout[,] layout; - bool[,] sortasc; - ProgramSort.SortMethod[,] sortby; - static string _thumbnailPath = string.Empty; static string _lastThumbnailPath = string.Empty; @@ -507,129 +503,36 @@ } } + public string CurrentView + { + get { return currentView; } + set { currentView = value; } + } + public int StartWindow { get { return startWindow; } set { startWindow = value; } } - public string CurrentView + public virtual Layout CurrentLayout { - get { return currentView; } - set { currentView = value; } + get { return currentLayout; } + set { currentLayout = value; } } - Layout CurrentLayout - {//maybe we can remove this property, not sure if we would need it - get - { - if (DatabaseHandler.ViewHandler.View == null) - return Layout.List; - - if (layout == null) - { - layout = new Layout[DatabaseHandler.ViewHandler.Views.Count, 50]; - - List<String> viewStrings = new List<String>(); - viewStrings.Add("List"); - viewStrings.Add("Icons"); - viewStrings.Add("Big Icons"); - viewStrings.Add("Filmstrip"); - - for (int i = 0; i < DatabaseHandler.ViewHandler.Views.Count; ++i) - { - for (int j = 0; j < DatabaseHandler.ViewHandler.Views[i].Filters.Count; ++j) - { - FilterDefinition def = (FilterDefinition)DatabaseHandler.ViewHandler.Views[i].Filters[j]; - int defaultView = viewStrings.IndexOf(def.DefaultView); - - if (defaultView != -1) - layout[i, j] = (Layout)defaultView; - else - layout[i, j] = Layout.List; - } - } - } - - return layout[DatabaseHandler.ViewHandler.Views.IndexOf(DatabaseHandler.ViewHandler.View), DatabaseHandler.ViewHandler.CurrentLevel]; - } - set - { - layout[DatabaseHandler.ViewHandler.Views.IndexOf(DatabaseHandler.ViewHandler.View), DatabaseHandler.ViewHandler.CurrentLevel] = value; - } - } - bool CurrentSortAsc { - get - { - if (DatabaseHandler.ViewHandler.View == null) - return true; - - if (sortasc == null) - { - sortasc = new bool[DatabaseHandler.ViewHandler.Views.Count, 50]; - - for (int i = 0; i < DatabaseHandler.ViewHandler.Views.Count; ++i) - { - for (int j = 0; j < DatabaseHandler.ViewHandler.Views[i].Filters.Count; ++j) - { - FilterDefinition def = (FilterDefinition)DatabaseHandler.ViewHandler.Views[i].Filters[j]; - sortasc[i, j] = def.SortAscending; - } - } - } - - return sortasc[DatabaseHandler.ViewHandler.Views.IndexOf(DatabaseHandler.ViewHandler.View), DatabaseHandler.ViewHandler.CurrentLevel]; - } - set - { - sortasc[DatabaseHandler.ViewHandler.Views.IndexOf(DatabaseHandler.ViewHandler.View), DatabaseHandler.ViewHandler.CurrentLevel] = value; - } + get { return currentSortAsc; } + set { currentSortAsc = value; } } - ProgramSort.SortMethod CurrentSortMethod + protected virtual ProgramSort.SortMethod CurrentSortMethod { - get - { - if (DatabaseHandler.ViewHandler.View == null) - return ProgramSort.SortMethod.Name; - - if (sortby == null) - { - sortby = new ProgramSort.SortMethod[DatabaseHandler.ViewHandler.Views.Count, 50]; - - List<String> sortStrings = new List<String>(); - sortStrings.Add("Name"); - sortStrings.Add("Title"); - sortStrings.Add("Filename"); - sortStrings.Add("Rating"); - sortStrings.Add("LaunchCount"); - sortStrings.Add("LastTimeLaunched"); - - for (int i = 0; i < DatabaseHandler.ViewHandler.Views.Count; ++i) - { - for (int j = 0; j < DatabaseHandler.ViewHandler.Views[i].Filters.Count; ++j) - { - FilterDefinition def = (FilterDefinition)DatabaseHandler.ViewHandler.Views[i].Filters[j]; - int defaultSort = sortStrings.IndexOf(def.DefaultSort); - - if (defaultSort != -1) - sortby[i, j] = (ProgramSort.SortMethod)defaultSort; - else - sortby[i, j] = ProgramSort.SortMethod.Name; - } - } - } - - return sortby[DatabaseHandler.ViewHandler.Views.IndexOf(DatabaseHandler.ViewHandler.View), DatabaseHandler.ViewHandler.CurrentLevel]; - } - set - { - sortby[DatabaseHandler.ViewHandler.Views.IndexOf(DatabaseHandler.ViewHandler.View), DatabaseHandler.ViewHandler.CurrentLevel] = value; - } + get { return currentSortMethod; } + set { currentSortMethod = value; } } - + GUIListItem GetSelectedItem() { return facadeView.SelectedListItem; @@ -697,9 +600,13 @@ protected override void OnPageLoad() { - string view = CurrentView; - DatabaseHandler.ViewHandler.CurrentView = view; + //string view = CurrentView; + base.OnPageLoad(); + + if (btnSortBy != null) + btnSortBy.SortChanged += new SortEventHandler(SortChanged); + InitMyPrograms(); } @@ -709,6 +616,14 @@ base.OnPageDestroy(newWindowId); } + void SortChanged(object sender, SortEventArgs args) + { + this.CurrentSortAsc = args.Order != System.Windows.Forms.SortOrder.Descending; + + OnSort(); + UpdateButtonStates(); + } + public override void OnAction(Action action) { switch (action.wID) @@ -717,7 +632,7 @@ case Action.ActionType.ACTION_PREVIOUS_MENU: // <U> keypress BackItemClicked(); - UpdateButtons(); + UpdateButtonStates(); break; case Action.ActionType.ACTION_CLOSE_DIALOG: SaveFolderSettings(""); @@ -757,7 +672,24 @@ base.OnClicked(controlId, control, actionType); if (control == btnViewAs) { - mapSettings.SwitchToNextView(); + mapSettings.SwitchToNextViewLayout(); + + switch (mapSettings.ViewLayout) + { + case (int)Layout.List: + CurrentLayout = Layout.Icons; + break; + case (int)Layout.Icons: + CurrentLayout = Layout.LargeIcons; + break; + case (int)Layout.LargeIcons: + CurrentLayout = Layout.FilmStrip; + break; + case (int)Layout.FilmStrip: + CurrentLayout = Layout.List; + break; + } + ShowThumbPanel(); } @@ -768,7 +700,7 @@ lastApp.Refresh(true); lastFilepath = lastApp.DefaultFilepath(); // todo: reset viewHandler - UpdateButtons(); + UpdateButtonStates(); UpdateListControl(); } } @@ -776,6 +708,11 @@ { OnShowViews(); } + else if (control == btnSortBy) + { + OnShowSort(); + } + else if (control == facadeView) { // application or file-item was clicked.... @@ -858,12 +795,16 @@ #region Display - void UpdateButtons() + protected virtual void UpdateButtonStates() { + string sortBy = string.Empty; + GUIPropertyManager.SetProperty("#view", DatabaseHandler.ViewHandler.LocalizedCurrentView); - btnViewAs.Label = mapSettings.ViewAsText; btnRefresh.IsVisible = RefreshButtonVisible(); + facadeView.IsVisible = true; + GUIControl.FocusControl(GetID, facadeView.GetID); + // display apptitle if available..... if (lastApp != null) { @@ -888,13 +829,43 @@ GUIPropertyManager.SetProperty("#curheader", GUILocalizeStrings.Get(0)); } } + + btnViewAs.Label = mapSettings.ViewLayoutTextName; + + switch (CurrentSortMethod) + { + case ProgramSort.SortMethod.Name: + sortBy = GUILocalizeStrings.Get(103); + break; + case ProgramSort.SortMethod.Title: + sortBy = GUILocalizeStrings.Get(268); + break; + case ProgramSort.SortMethod.Filename: + sortBy = GUILocalizeStrings.Get(363); + break; + case ProgramSort.SortMethod.Rating: + sortBy = GUILocalizeStrings.Get(367); + break; + case ProgramSort.SortMethod.LastTimeLaunched: //tmp + sortBy = GUILocalizeStrings.Get(31); + break; + case ProgramSort.SortMethod.LaunchCount: + sortBy = GUILocalizeStrings.Get(30); //tmp + break; + } + + if (btnSortBy != null) + { + btnSortBy.Label = sortBy; + btnSortBy.IsAscending = CurrentSortAsc; + } } void ShowThumbPanel() { int itemIndex = facadeView.SelectedListItemIndex; - switch ((Layout)mapSettings.ViewAs) + switch ((Layout)mapSettings.ViewLayout) { case Layout.List: facadeView.View = GUIFacadeControl.ViewMode.List; @@ -915,7 +886,7 @@ } facadeView.SelectedListItemIndex = itemIndex; - UpdateButtons(); + UpdateButtonStates(); } void RenderThumbnail(float timePassed) @@ -1120,7 +1091,7 @@ } } } - UpdateButtons(); + UpdateButtonStates(); UpdateListControl(); RestoreItemIndex(lastApp, lastFilepath); } @@ -1319,6 +1290,9 @@ } } + + + void OnClick() { GUIListItem item = GetSelectedItem(); @@ -1335,17 +1309,148 @@ if (item.Label.Equals(ProgramUtils.cBackLabel)) { BackItemClicked(); - UpdateButtons(); + UpdateButtonStates(); } else { // application-item or subfolder FolderItemClicked(item); - UpdateButtons(); + UpdateButtonStates(); } } } + protected void OnShowSort() + { + GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + if (dlg == null) + return; + dlg.Reset(); + dlg.SetHeading(495); + + dlg.AddLocalizedString(103); // name + dlg.AddLocalizedString(268); // title + dlg.AddLocalizedString(363); // filename + dlg.AddLocalizedString(367); // rating + dlg.AddLocalizedString(30);//"LaunchCount"//whats the maopping to these??? + dlg.AddLocalizedString(31); //dlg.Add("LastLaunched"); + + + dlg.DoModal(GetID); + + if (dlg.SelectedLabel == -1) + return; + + switch (dlg.SelectedId) + { + case 103: + CurrentSortMethod = ProgramSort.SortMethod.Name; + break; + case 268: + CurrentSortMethod = ProgramSort.SortMethod.Title; + break; + case 363: + CurrentSortMethod = ProgramSort.SortMethod.Filename; + break; + case 367: + CurrentSortMethod = ProgramSort.SortMethod.Rating; + break; + case 20: + CurrentSortMethod = ProgramSort.SortMethod.LaunchCount; + break; + case 31: + CurrentSortMethod = ProgramSort.SortMethod.LastTimeLaunched; + break; + default: + CurrentSortMethod = ProgramSort.SortMethod.Name; + break; + } + + OnSort(); + GUIControl.FocusControl(GetID, btnSortBy.GetID); + } + + protected virtual void OnSort() + { + //SetLabels(); + facadeView.Sort(new ProgramSort(CurrentSortMethod, CurrentSortAsc)); + UpdateButtonStates(); + } + + protected virtual void SetLabels() + { + ProgramSort.SortMethod method = CurrentSortMethod; + + /* for (int i = 0; i < facadeView.Count; ++i) + { + GUIListItem item = facadeView[i]; + MusicTag tag = (MusicTag)item.MusicTag; + if (tag != null) + { + string trackNr = String.Format("{0:00}", tag.Track); + string fileSize = MediaPortal.Util.Utils.GetSize(item.Size); + string year = tag.Year.ToString(); + string filename = MediaPortal.Util.Utils.GetFilename(item.Path); + // For an index view, don't translate the duration + string duration = ""; + // When in Shares View, the View = null + if (handler.View != null) + { + FilterDefinition filter = (FilterDefinition)handler.View.Filters[handler.CurrentLevel]; + if (filter.SqlOperator == "group") + { + duration = Convert.ToString(tag.Duration); + } + else + { + duration = MediaPortal.Util.Utils.SecondsToHMSString(tag.Duration); + } + } + else + { + duration = MediaPortal.Util.Utils.SecondsToHMSString(tag.Duration); + } + string rating = tag.Rating.ToString(); + if (tag.Track <= 0) + trackNr = ""; + if (tag.Year < 1900) + year = ""; + + string date = ""; + if (item.FileInfo != null) + date = item.FileInfo.ModificationTime.ToShortDateString() + " " + item.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); + ; + + string line1 = _sortTags1[(int)method]; + string line2 = _sortTags2[(int)method]; + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%track%", trackNr); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%track%", trackNr); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%filesize%", fileSize); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%filesize%", fileSize); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%artist%", tag.Artist); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%artist%", tag.Artist); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%album%", tag.Album); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%album%", tag.Album); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%title%", tag.Title); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%title%", tag.Title); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%year%", year); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%year%", year); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%filename%", filename); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%filename%", filename); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%rating%", rating); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%rating%", rating); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%duration%", duration); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%duration%", duration); + line1 = MediaPortal.Util.Utils.ReplaceTag(line1, "%date%", date); + line2 = MediaPortal.Util.Utils.ReplaceTag(line2, "%date%", date); + item.Label = line1; + item.Label2 = line2; + } + }*/ + } + + + void OnInfo() { // <F3> keypress @@ -1403,7 +1508,7 @@ { int nNewWindow = (int)Window.WINDOW_FILES; StartWindow = nNewWindow; - CurrentView = ""; + CurrentLayout = Layout.List; DatabaseHandler.ViewHandler.CurrentView = null; if (nNewWindow != GetID) { @@ -1414,6 +1519,7 @@ { ViewDefinition selectedView = (ViewDefinition)DatabaseHandler.ViewHandler.Views[dlg.SelectedLabel - 1]; CurrentView = selectedView.Name; + DatabaseHandler.ViewHandler.CurrentView = selectedView.Name; int nNewWindow = (int)Window.WINDOW_FILES; if (GetID != nNewWindow) @@ -1432,7 +1538,7 @@ } } } - UpdateButtons(); + UpdateButtonStates(); UpdateListControl(); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-07-06 05:03:26 UTC (rev 675) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-07-07 21:10:58 UTC (rev 676) @@ -165,6 +165,7 @@ <ItemGroup> <Content Include="MetaData\myProgramsAltFileDetailsInfo.xml" /> <Content Include="MetaData\myProgramsAltPreconfiguration.xml" /> + <Content Include="skin\BlueTwo\myprograms.xml" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Design\AppFilesImportProgress.resx"> Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs 2007-07-06 05:03:26 UTC (rev 675) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs 2007-07-07 21:10:58 UTC (rev 676) @@ -32,6 +32,7 @@ using GUIPrograms.Database; using GUIPrograms.FileItems; +using GUIPrograms.ApplicationItems; namespace GUIPrograms { @@ -55,16 +56,6 @@ bool sortAscending = true; - public bool SortAscending - { - get { return sortAscending; } - set { sortAscending = value; } - } - public int CurrentSortMethodIndex - { - get { return (int) currentSortMethod; } - set { SetCurrentSortMethodAsIndex(value); } - } public ProgramSort(SortMethod method, bool ascending) { @@ -74,9 +65,22 @@ public int Compare(GUIListItem item1, GUIListItem item2) { + if (item1 == item2) return 0; if (item1 == null) return -1; if (item2 == null) return -1; + if (item1.MusicTag == null) return -1; + if (item2.MusicTag == null) return -1; + + if (item1.MusicTag.GetType().BaseType.Name == "ApplicationItem") return -1;//quick fix for not allowing applicationsitems... be solve by inheritence etc + if (item2.MusicTag.GetType().BaseType.Name == "ApplicationItem") return -1;//quick fix for not allowing applicationsitems... be solve by inheritence etc + if (item1.MusicTag.GetType().BaseType.Name == "ProgramFilterItem") return -1;//quick fix for not allowing applicationsitems... be solve by inheritence etc + if (item2.MusicTag.GetType().BaseType.Name == "ProgramFilterItem") return -1;//quick fix for not allowing applicationsitems... be solve by inheritence etc + + + + + if (item1 == null) return -1; if (item1.IsFolder && item1.Label == "..") return -1; if (item2.IsFolder && item2.Label == "..") return -1; if (item1.IsFolder && !item2.IsFolder) return -1; @@ -172,47 +176,5 @@ } return 0; } - - public string CurrentSortMethodAsText - { - get - { - return GetCurrentSortMethodAsText(); - } - } - - private string GetCurrentSortMethodAsText() - { - string strLine = ""; - SortMethod method = currentSortMethod; - switch (method) - { - case SortMethod.Name: - strLine = GUILocalizeStrings.Get(103); - break; - case SortMethod.LaunchCount: - strLine = GUILocalizeStrings.Get(13016); - break; - case SortMethod.LastTimeLaunched: - strLine = GUILocalizeStrings.Get(13017); - break; - case SortMethod.Rating: - strLine = GUILocalizeStrings.Get(13018); - break; - } - return strLine; - } - - private void SetCurrentSortMethodAsIndex(int value) - { - try - { - currentSortMethod = (SortMethod)value; - } - catch - { - currentSortMethod = 0; - } - } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-11 22:05:28
|
Revision: 685 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=685&view=rev Author: northern_sky Date: 2007-07-11 15:05:26 -0700 (Wed, 11 Jul 2007) Log Message: ----------- added fileinfo (from mpvideo)..needs more work Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltFileDetailsInfo.xml Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-11 22:05:26 UTC (rev 685) @@ -735,20 +735,20 @@ public virtual void OnInfo(GUIListItem item, ref bool isOverviewVisible, ref ProgramInfoAction modalResult, ref int selectedFileID) { - GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); - if (fileInfoDialog == null) return; - if (item.MusicTag == null) return; - FileItem curFile = (FileItem)item.MusicTag; - if (curFile == null) return; + // GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); + // if (fileInfoDialog == null) return; + // if (item.MusicTag == null) return; + //FileItem curFile = (FileItem)item.MusicTag; + //if (curFile == null) return; - fileInfoDialog.App = this; + /* fileInfoDialog.App = this; fileInfoDialog.File = curFile; fileInfoDialog.IsOverviewVisible = isOverviewVisible; fileInfoDialog.DoModal(GetID); isOverviewVisible = fileInfoDialog.IsOverviewVisible; modalResult = fileInfoDialog.ModalResult; selectedFileID = fileInfoDialog.SelectedFileID; - return; + return;*/ } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-11 22:05:26 UTC (rev 685) @@ -583,6 +583,33 @@ return strRes; } + public void SetProperties() + { + /* string strThumb = MediaPortal.Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, Title);*/ + //((GUIPropertyManager.SetProperty("#director", Director); + GUIPropertyManager.SetProperty("#maingenre", MainGenre); + GUIPropertyManager.SetProperty("#subgenre", SubGenre); + //GUIPropertyManager.SetProperty("#cast", Cast); + // GUIPropertyManager.SetProperty("#dvdlabel", DVDLabel); + // GUIPropertyManager.SetProperty("#imdbnumber", IMDBNumber); + // GUIPropertyManager.SetProperty("#file", File); + GUIPropertyManager.SetProperty("#plot", Overview); + // GUIPropertyManager.SetProperty("#plotoutline", PlotOutline); + GUIPropertyManager.SetProperty("#rating", Rating.ToString()); + //GUIPropertyManager.SetProperty("#tagline", TagLine); + // GUIPropertyManager.SetProperty("#votes", Votes); + // GUIPropertyManager.SetProperty("#credits", WritingCredits); + GUIPropertyManager.SetProperty("#thumb", Imagefile); + GUIPropertyManager.SetProperty("#title", Title); + GUIPropertyManager.SetProperty("#year", Year.ToString()); + GUIPropertyManager.SetProperty("#platform", Platform); + /*GUIPropertyManager.SetProperty("#runtime", RunTime.ToString()); + GUIPropertyManager.SetProperty("#mpaarating", MPARating.ToString());*/ + /* string strValue = "no"; + if (Watched > 0) strValue = "yes"; + GUIPropertyManager.SetProperty("#iswatched", strValue);*/ + } + private void Insert() { try Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs 2007-07-11 22:05:26 UTC (rev 685) @@ -1,307 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using System.Xml; -using MediaPortal.GUI.Library; -using MediaPortal.Util; -using GUIPrograms.Database; -using MediaPortal.Configuration; - -using GUIPrograms.ApplicationItems; -using GUIPrograms.FileItems; - - - -namespace GUIPrograms -{ - /// <summary> - /// Summary description for GUIFileDetailsInfoParser. - /// </summary> - public class GUIFileDetailsInfoParser - { - static XmlNodeList NodeList = null; - static XmlElement rootElement = null; - - - private GUIFileDetailsInfoParser() - { - // - // TODO: Add constructor logic here - // - } - - static GUIFileDetailsInfoParser() - { - - if (System.IO.File.Exists(Config.GetFile(Config.Dir.Config, "myProgramsAltFileDetailsInfo.xml"))) - { - try - { - XmlDocument document = new XmlDocument(); - document.Load(Config.GetFile(Config.Dir.Config, "myProgramsAltFileDetailsInfo.xml")); - rootElement = document.DocumentElement; - if ((rootElement != null) && (rootElement.Name.Equals("contentprofiles"))) - { - NodeList = rootElement.SelectNodes("/contentprofiles/profile"); - } - } - catch (Exception ex) - { - Log.Info("exception in GUIFileDetailsInfoParser err:{0} stack:{1}", ex.Message, ex.StackTrace); - } - } - else - { - Log.Info("Warning: myPrograms did not find the expected 'myProgramsAltFileDetailsInfo.xml' in your MP root directory!"); - } - } - - static public string GetFieldValue(ApplicationItem curApp, FileItem curFile, string strFieldName, string strValueIfEmpty) - { - string result = ""; - if (rootElement == null) - { - return ""; - } - XmlNode node = rootElement.SelectSingleNode(String.Format("/contentprofiles/profile[@id={0}]", curApp.ContentID)); - if (node != null) - { - XmlNode fieldnode = node.SelectSingleNode(String.Format("fields/field[@fieldid=\"{0}\"]", strFieldName)); - if (fieldnode != null) - { - result = ParseExpressions(fieldnode.InnerText, curApp, curFile); - } - else - { - Log.Info("GUIFileDetailsInfoParser Warning, no data found for \n{0}\n{1}\n{2}", curApp.Title, curFile.Title, node.InnerXml); - } - } - else - { - Log.Info("GUIFileDetailsInfoParser Warning, no data found for \n{0}\n{1}", curApp.Title, curFile.Title); - } - if (result == "") - { - result = strValueIfEmpty; - } - return result; - } - - static string ParseExpressions(string strExpression, ApplicationItem curApp, FileItem curFile) - { - string result = strExpression; - if (curApp == null) - return result; - if (curFile == null) - return result; - if (result.Length == 0) - return result; - - int iNextValueTagStart = result.IndexOf("["); - int iNextValueTagEnd = -1; - string Head = ""; - string Expression = ""; - string Tail = ""; - while (iNextValueTagStart >= 0) - { - iNextValueTagEnd = result.IndexOf("]", iNextValueTagStart); - if (iNextValueTagEnd > iNextValueTagStart) - { - iNextValueTagEnd = iNextValueTagEnd + 1; - if (iNextValueTagStart > 0) - { - Head = result.Substring(0, iNextValueTagStart); - } - else - { - Head = ""; - } - Expression = result.Substring(iNextValueTagStart, iNextValueTagEnd - iNextValueTagStart); - if (result.Length - iNextValueTagEnd > 0) - { - Tail = result.Substring(iNextValueTagEnd, result.Length - iNextValueTagEnd); - } - else - { - Tail = ""; - } - result = Head + ParseOneExpression(Expression, curFile) + Tail; - } - iNextValueTagStart = result.IndexOf("["); - } - - return result; - } - - static string ParseOneExpression(string strTagExpression, FileItem curFile) - { - string result = ""; - if (strTagExpression.StartsWith("[VALUEOFTAG(")) - { - result = ParseVALUEOFTAG(strTagExpression, curFile); - } - else if (strTagExpression.StartsWith("[NAMEOFCATEGORY(")) - { - result = ParseNAMEOFCATEGORY(strTagExpression, curFile); - } - else if (strTagExpression.StartsWith("[VALUEOFCATEGORY(")) - { - result = ParseVALUEOFCATEGORY(strTagExpression, curFile); - } - return result; - } - - static string ParseVALUEOFTAG(string strTagExpression, FileItem curFile) - { - string result = ""; - string TagName = ""; - int Start = strTagExpression.IndexOf("\""); - int End = strTagExpression.IndexOf("\"", Start + 1); - if ((Start >= 0) && (End > Start)) - { - TagName = strTagExpression.Substring(Start, End - Start + 1); - TagName = TagName.TrimStart('"'); - TagName = TagName.TrimEnd('"'); - TagName = TagName.ToLower(); - - switch (TagName) - { - case "platform": - { - result = curFile.Platform; - break; - } - case "yearmanu": - { - result = curFile.YearManu; - break; - } - case "rating": - { - if (curFile.Rating >= 0) - { - result = String.Format("{0}/10", curFile.Rating); - } - break; - } - case "genre": - { - string sep = ""; - if (curFile.MainGenre != "") - { - result = curFile.MainGenre; - sep = " / "; - } - if (curFile.SubGenre != "") - { - result = result + sep + curFile.SubGenre; - sep = " / "; - } - break; - } - case "overview": - { - result = curFile.Overview; - break; - } - case "year": - { - if (curFile.Year >= 1900) - { - result = String.Format("{0}", curFile.Year); - } - break; - } - case "manufacturer": - { - result = curFile.Manufacturer; - break; - } - default: - { - result = curFile.GetValueOfTag(TagName); - break; - } - } - } - return result; - } - - static string ParseNAMEOFCATEGORY(string strTagExpression, FileItem curFile) - { - string result = ""; - string TagName = ""; - int TagNumber = -1; - int Start = strTagExpression.IndexOf("("); - int End = strTagExpression.IndexOf(")", Start + 1); - if ((Start >= 0) && (End > Start)) - { - TagName = strTagExpression.Substring(Start, End - Start + 1); - TagName = TagName.TrimStart('('); - TagName = TagName.TrimEnd(')'); - TagName = TagName.ToLower(); - TagNumber = ProgramUtils.StringToInteger(TagName, -1); - if (TagNumber >= 0) - { - result = curFile.GetNameOfCategory(TagNumber); - } - else - { - Log.Info("Warning: GUIFileDetailsInfoParser: Invalid number {0}", TagName); - } - } - return result; - } - - static string ParseVALUEOFCATEGORY(string strTagExpression, FileItem curFile) - { - string result = ""; - string TagName = ""; - int TagNumber = -1; - int Start = strTagExpression.IndexOf("("); - int End = strTagExpression.IndexOf(")", Start + 1); - if ((Start >= 0) && (End > Start)) - { - TagName = strTagExpression.Substring(Start, End - Start + 1); - TagName = TagName.TrimStart('('); - TagName = TagName.TrimEnd(')'); - TagName = TagName.ToLower(); - TagNumber = ProgramUtils.StringToInteger(TagName, -1); - if (TagNumber >= 0) - { - result = curFile.GetValueOfCategory(TagNumber); - } - else - { - Log.Info("Warning: GUIFileDetailsInfoParser: Invalid number {0}", TagName); - } - - } - return result; - } - - } -} \ No newline at end of file Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs 2007-07-11 22:05:26 UTC (rev 685) @@ -1,554 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using Microsoft.DirectX.Direct3D; - -using MediaPortal.Dialogs; -using MediaPortal.GUI.Library; -using MediaPortal.Util; - -using GUIPrograms.ApplicationItems; -using GUIPrograms.Database; -using GUIPrograms.FileItems; - -namespace GUIPrograms -{ - /// <summary> - /// - /// </summary> - public class GUIFileInfo : GUIWindow, IRenderLayer - { - #region SkinControls - - // Labels - [SkinControlAttribute(20)] - protected GUILabelControl lblTitle = null; - [SkinControlAttribute(31)] - protected GUILabelControl lblSystemCaption = null; - [SkinControlAttribute(32)] - protected GUILabelControl lblYearManuCaption = null; - [SkinControlAttribute(33)] - protected GUILabelControl lblRatingCaption = null; - [SkinControlAttribute(34)] - protected GUILabelControl lblGenreCaption = null; - - // Fadelabels - [SkinControlAttribute(21)] - protected GUIFadeLabel lblSystemData = null; - [SkinControlAttribute(22)] - protected GUIFadeLabel lblYearManuData = null; - [SkinControlAttribute(23)] - protected GUIFadeLabel lblRatingData = null; - [SkinControlAttribute(24)] - protected GUIFadeLabel lblGenreData = null; - - - // Textbox - [SkinControlAttribute(4)] - // protected GUITextScrollUpControl tbOverviewData = null; - protected GUITextControl tbOverviewData = null; - - //Images - [SkinControlAttribute(3)] - protected GUIImage imgSmall = null; - [SkinControlAttribute(10)] - protected GUIImage imgBig = null; - - // Buttons - [SkinControlAttribute(7)] - protected GUIButtonControl btnPrev = null; - [SkinControlAttribute(8)] - protected GUIButtonControl btnLaunch = null; - [SkinControlAttribute(9)] - protected GUIButtonControl btnNext = null; - [SkinControlAttribute(11)] - protected GUIButtonControl btnToggleOverview = null; - [SkinControlAttribute(12)] - protected GUIButtonControl btnRefreshData = null; - - #endregion - - #region Base & Content Variables - - bool isRunning = false; - int parentWindowID = 0; - GUIWindow parentWindow = null; - Texture curTexture = null; - FileItem curFile = null; - ApplicationItem curApp = null; - int textureWidth = 0; - int textureHeight = 0; - bool isOverlay = false; - bool isOverviewVisible = true; - int slideSpeed = 3; - long slideTime = 0; - - string programSystemLabel = ""; - string programManufacturerLabel = ""; - string programRatingLabel = ""; - string programGenreLabel = ""; - - string programSystem = ""; - string programManufacturer = ""; - string programRating = ""; - string programGenre = ""; - - string programOverview = ""; - - ProgramInfoAction modalResult = ProgramInfoAction.None; - int selectedFileID = -1; - - #endregion - - #region Properties / Helper Routines - public ProgramInfoAction ModalResult - { - get { return modalResult; } - set { modalResult = value; } - } - - public int SelectedFileID - { - get - { return selectedFileID; } - } - - void SyncFileID() - { - if (null != curFile) - { - selectedFileID = curFile.FileID; - } - else - { - selectedFileID = -1; - } - } - - #endregion - - #region Constructor / Destructor - - public GUIFileInfo() - { - GetID = ProgramUtils.ProgramInfoID; - } - - #endregion - - #region Properties - - public FileItem File - { - set - { - curFile = value; - SyncFileID(); - } - } - - public ApplicationItem App - { - set - { - curApp = value; - if (curApp != null) - curApp.ResetThumbs(); - } - } - - public bool IsOverviewVisible - { - get - { - return isOverviewVisible; - } - set - { - isOverviewVisible = value; - } - } - - #endregion - - #region Overrides - - public override bool Init() - { - return Load(GUIGraphicsContext.Skin + @"\DialogFileInfo.xml"); - } - - public override bool OnMessage(GUIMessage message) - { - switch (message.Message) - { - case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: - isOverlay = GUIGraphicsContext.Overlay; - base.OnMessage(message); - return true; - case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: - base.OnMessage(message); - GUIGraphicsContext.Overlay = isOverlay; - return true; - } - return base.OnMessage(message); - } - - - protected override void OnPageLoad() - { - base.OnPageLoad(); - // isOverlay = GUIGraphicsContext.Overlay; - curTexture = null; - - if (curApp != null) - { - curApp.ResetThumbs(); - } - // if there is no overview text, default to bigger pictures - if (curFile != null) - { - if (curFile.Overview == "") - { - this.isOverviewVisible = false; - } - } - Refresh(); - } - - - protected override void OnPageDestroy(int newWindowId) - { - curFile = null; - if (curTexture != null) - { - curTexture.Dispose(); - curTexture = null; - } - // GUIGraphicsContext.Overlay = isOverlay; - base.OnPageDestroy(newWindowId); - } - - - protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) - { - base.OnClicked(controlId, control, actionType); - if (control == btnPrev) - { - curFile = curApp.PrevFile(curFile); - SyncFileID(); - curApp.ResetThumbs(); - Refresh(); - } - else if (control == btnNext) - { - curFile = curApp.NextFile(curFile); - SyncFileID(); - curApp.ResetThumbs(); - Refresh(); - } - else if (control == btnLaunch) - { - if (curApp != null) - { - curApp.LaunchFile(curFile, true); - Refresh(); - } - - } - else if (control == btnToggleOverview) - { - isOverviewVisible = !isOverviewVisible; - Refresh(); - } - else if (control == this.btnRefreshData) - { - Close(ProgramInfoAction.LookupFileInfo); - RefreshData(); - Refresh(); - } - } - - - public override void OnAction(Action action) - { - if (action.wID == Action.ActionType.ACTION_CLOSE_DIALOG || action.wID == Action.ActionType.ACTION_PARENT_DIR || action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) - { - Close(ProgramInfoAction.None); - return; - } - base.OnAction(action); - } - - public override void Render(float timePassed) - { - RenderDlg(timePassed); - - if (null == curTexture) - return; - - // does the thumb needs replacing?? - long timeElapsed = (DateTime.Now.Ticks / 10000) - slideTime; - if (timeElapsed >= (slideSpeed * 1000)) - { - RefreshPicture(); // only refresh the picture, don't refresh the other data otherwise scrolling of labels is interrupted! - } - - - GUIControl curImg = null; - if (this.isOverviewVisible) - { - curImg = imgSmall; - } - else - { - curImg = imgBig; - } - if (curImg != null) - { - float x = (float)curImg.XPosition; - float y = (float)curImg.YPosition; - int curWidth; - int curHeight; - GUIGraphicsContext.Correct(ref x, ref y); - - int maxWidth = curImg.Width; - int maxHeight = curImg.Height; - GUIGraphicsContext.GetOutputRect(textureWidth, textureHeight, maxWidth, maxHeight, out curWidth, out curHeight); - GUIFontManager.Present(); - int deltaX = ((curImg.Width - curWidth) / 2); - if (deltaX < 0) - { - deltaX = 0; - } - int deltaY = ((curImg.Height - curHeight) / 2); - if (deltaY < 0) - { - deltaY = 0; - } - x = x + deltaX; - y = y + deltaY; - Picture.RenderImage(curTexture, (int)x, (int)y, curWidth, curHeight, textureWidth, textureHeight, 0, 0, true); - } - } - - #endregion - - #region Display - - void Close(ProgramInfoAction res) - { - modalResult = res; - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null); - OnMessage(msg); - - GUIWindowManager.UnRoute(); - parentWindow = null; - isRunning = false; - } - - - public void DoModal(int parentId) - { - parentWindowID = parentId; - parentWindow = GUIWindowManager.GetWindow(parentWindowID); - if (null == parentWindow) - { - parentWindowID = 0; - return; - } - - GUIWindowManager.RouteToWindow(GetID); - - // activate this window... - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, 0, 0, null); - OnMessage(msg); - GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog); - - isRunning = true; - while (isRunning && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) - { - GUIWindowManager.Process(); - } - GUILayerManager.UnRegisterLayer(this); - } - - void RefreshPicture() - { - if (curTexture != null) - { - curTexture.Dispose(); - curTexture = null; - } - - if (curFile != null) - { - string thumbFile = curApp.GetCurThumb(curFile); - // load the found thumbnail picture - if (System.IO.File.Exists(thumbFile)) - { - curTexture = Picture.Load(thumbFile, 0, 512, 512, true, false, out textureWidth, out textureHeight); - } - curApp.NextThumb(); // try to find a next thumbnail - } - slideTime = (DateTime.Now.Ticks / 10000); // reset timer! - } - - void RefreshData() - { - if (curFile == null) - return; - - curFile.ToFileInfoFavourite(); - - if (curFile.FindFileInfoDetail(curApp, curFile.FileInfoFavourite, ScraperType.ALLGAME, ScraperSaveType.Data)) - { - curFile.SaveFromFileInfoFavourite(); - } - } - - - void Refresh() - { - RefreshPicture(); - Update(); - } - - - void Update() - { - if (null == curFile) - return; - - ReadContent(); - - if (isOverviewVisible) - { - imgBig.IsVisible = false; - tbOverviewData.IsVisible = true; - tbOverviewData.Clear(); - tbOverviewData.Label = programOverview; // ... and set text next! - btnToggleOverview.Label = GUILocalizeStrings.Get(13006); - } - else - { - imgBig.IsVisible = true; - tbOverviewData.IsVisible = false; - tbOverviewData.Clear(); - btnToggleOverview.Label = GUILocalizeStrings.Get(13007); - } - - lblTitle.Label = curFile.Title; - - // if any title is overwritten, re-set the fresh text - if (programSystemLabel != "") - { - lblSystemCaption.Label = programSystemLabel; - } - else - { - lblSystemCaption.Label = GUILocalizeStrings.Get(13000); - } - if (programManufacturerLabel != "") - { - lblYearManuCaption.Label = programManufacturerLabel; - } - else - { - lblYearManuCaption.Label = GUILocalizeStrings.Get(13001); - } - - if (programRatingLabel != "") - { - lblRatingCaption.Label = programRatingLabel; - } - else - { - lblRatingCaption.Label = GUILocalizeStrings.Get(173); - } - if (programGenreLabel != "") - { - lblGenreCaption.Label = programGenreLabel; - } - else - { - lblGenreCaption.Label = GUILocalizeStrings.Get(174); - } - - lblSystemData.Label = programSystem; - lblYearManuData.Label = programManufacturer; - lblRatingData.Label = programRating; - lblGenreData.Label = programGenre; - - if (curFile.Filename != "") - { - btnLaunch.Disabled = false; - } - else - { - btnLaunch.Disabled = true; - } - - } - - - void ReadContent() - { - string notAvailableText = GUILocalizeStrings.Get(416); - // read fields out of the content profile - // fields can contain texts and / or references to fields - /* programSystemLabel = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line1Label", ""); - programManufacturerLabel = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line2Label", ""); - programRatingLabel = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line3Label", ""); - programGenreLabel = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line4Label", ""); - */ - programSystem = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line1Data", notAvailableText); - programManufacturer = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line2Data", notAvailableText); - programRating = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line3Data", notAvailableText); - programGenre = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "Line4Data", notAvailableText); - programOverview = GUIFileDetailsInfoParser.GetFieldValue(curApp, curFile, "OverviewData", ""); - } - - public void RenderDlg(float timePassed) - { - base.Render(timePassed); - } - - #endregion - - #region IRenderLayer - public bool ShouldRenderLayer() - { - return true; - } - - public void RenderLayer(float timePassed) - { - Render(timePassed); - } - #endregion - } -} \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-11 22:05:26 UTC (rev 685) @@ -323,7 +323,7 @@ curText = xmlreader.GetValueAsString("myprograms", "viewLayout", "list"); if (curText == "list") mapSettings.ViewLayout = (int)Layout.List; - else if (curText == "icons") mapSettings.ViewLayout = (int)Layout.Icons; + else if (curText == "icons") mapSettings.ViewLayout = (int)Layout.Icons; else if (curText == "largeicons") mapSettings.ViewLayout = (int)Layout.LargeIcons; else if (curText == "filmstrip") mapSettings.ViewLayout = (int)Layout.FilmStrip; else mapSettings.ViewLayout = (int)Layout.List; @@ -467,7 +467,7 @@ protected ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Name; string currentView = ""; bool currentSortAsc = true; - + static ApplicationItemList applicationList = DatabaseHandler.ApplicationItemList; MapSettings mapSettings = new MapSettings(); DirectoryHistory itemHistory = new DirectoryHistory(); @@ -532,7 +532,7 @@ get { return currentSortMethod; } set { currentSortMethod = value; } } - + GUIListItem GetSelectedItem() { return facadeView.SelectedListItem; @@ -1451,44 +1451,90 @@ - void OnInfo() + /* void OnInfo() + { + // <F3> keypress + if (null != lastApp) + { + selectedItemIndex = GetSelectedItemNo(); + GUIListItem item = GetSelectedItem(); + + FileItem curFile = null; + + if (!item.Label.Equals(ProgramUtils.cBackLabel) && (!item.IsFolder)) + { + if ((item.MusicTag != null) && (item.MusicTag is FileItem)) + { + curFile = (FileItem)item.MusicTag; + } + // show file info but only if the selected item is not the back button + bool ovVisible = mapSettings.OverviewVisible; + ProgramInfoAction modalResult = ProgramInfoAction.LookupFileInfo; + int selectedFileID = -1; + lastApp.OnInfo(item, ref ovVisible, ref modalResult, ref selectedFileID); + if ((null != curFile) && (modalResult == ProgramInfoAction.LookupFileInfo)) + { + FileItem scrapeFile = lastApp.Files.GetFileItemByID(selectedFileID); + if (null != scrapeFile) + { + int scrapeIndex = lastApp.Files.IndexOf(scrapeFile); + if (-1 != scrapeIndex) + { + GUIControl.SelectItemControl(GetID, facadeView.GetID, scrapeIndex + 1); + } + ScrapeFileInfo(scrapeFile); + } + } + mapSettings.OverviewVisible = ovVisible; + UpdateListControl(); + } + } + } + */ + protected void OnInfo() { - // <F3> keypress - if (null != lastApp) + + if (lastApp == null) return; + + selectedItemIndex = GetSelectedItemNo(); + GUIListItem item = GetSelectedItem(); + FileItem curFile = null; + + if (item.Label.Equals(ProgramUtils.cBackLabel)) return; + if (item is ApplicationItem) return;//&& (!item.IsFolder)) + if (item.MusicTag == null) return; + if (item.MusicTag is FileItem) { - selectedItemIndex = GetSelectedItemNo(); - GUIListItem item = GetSelectedItem(); + curFile = (FileItem)item.MusicTag; + GUIProgramsAltFileInfo fileInfo = (GUIProgramsAltFileInfo)GUIWindowManager.GetWindow(9999); + fileInfo.Movie = curFile; + fileInfo.FolderForThumbs = string.Empty; + GUIWindowManager.ActivateWindow(9999); + } - FileItem curFile = null; + // show file info but only if the selected item is not the back button + // bool ovVisible = mapSettings.OverviewVisible; + /* ProgramInfoAction modalResult = ProgramInfoAction.LookupFileInfo; + int selectedFileID = -1; + lastApp.OnInfo(item, ref ovVisible, ref modalResult, ref selectedFileID); + if ((null != curFile) && (modalResult == ProgramInfoAction.LookupFileInfo)) + { + FileItem scrapeFile = lastApp.Files.GetFileItemByID(selectedFileID); + if (null != scrapeFile) + { + int scrapeIndex = lastApp.Files.IndexOf(scrapeFile); + if (-1 != scrapeIndex) + { + GUIControl.SelectItemControl(GetID, facadeView.GetID, scrapeIndex + 1); + } + ScrapeFileInfo(scrapeFile); + } + } + mapSettings.OverviewVisible = ovVisible; + UpdateListControl(); - if (!item.Label.Equals(ProgramUtils.cBackLabel) && (!item.IsFolder)) - { - if ((item.MusicTag != null) && (item.MusicTag is FileItem)) - { - curFile = (FileItem)item.MusicTag; - } - // show file info but only if the selected item is not the back button - bool ovVisible = mapSettings.OverviewVisible; - ProgramInfoAction modalResult = ProgramInfoAction.LookupFileInfo; - int selectedFileID = -1; - lastApp.OnInfo(item, ref ovVisible, ref modalResult, ref selectedFileID); - if ((null != curFile) && (modalResult == ProgramInfoAction.LookupFileInfo)) - { - FileItem scrapeFile = lastApp.Files.GetFileItemByID(selectedFileID); - if (null != scrapeFile) - { - int scrapeIndex = lastApp.Files.IndexOf(scrapeFile); - if (-1 != scrapeIndex) - { - GUIControl.SelectItemControl(GetID, facadeView.GetID, scrapeIndex + 1); - } - ScrapeFileInfo(scrapeFile); - } - } - mapSettings.OverviewVisible = ovVisible; - UpdateListControl(); - } - } + */ + } void OnShowViews() Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-07-11 22:05:26 UTC (rev 685) @@ -145,9 +145,8 @@ <Compile Include="FileItems\FileItemList.cs" /> <Compile Include="FileItems\FilelinkItem.cs" /> <Compile Include="FileItems\FilelinkList.cs" /> - <Compile Include="GUIFileDetailsInfoParser.cs" /> - <Compile Include="GUIProgramInfo.cs" /> <Compile Include="GUIPrograms.cs" /> + <Compile Include="GUIProgramsAltFileInfo.cs" /> <Compile Include="Imports\AllGameScraper.cs" /> <Compile Include="Imports\GamebaseImport.cs" /> <Compile Include="Imports\MameImport.cs" /> @@ -163,7 +162,6 @@ </Compile> </ItemGroup> <ItemGroup> - <Content Include="MetaData\myProgramsAltFileDetailsInfo.xml" /> <Content Include="MetaData\myProgramsAltPreconfiguration.xml" /> <Content Include="skin\BlueTwo\myprograms.xml" /> </ItemGroup> Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs 2007-07-11 22:05:26 UTC (rev 685) @@ -0,0 +1,562 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Drawing; +using System.Net; +using System.Threading; +using System.Web; +using Microsoft.DirectX; +using Microsoft.DirectX.Direct3D; +using Direct3D = Microsoft.DirectX.Direct3D; + +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +//using MediaPortal.Services; +//using MediaPortal.Threading; +using MediaPortal.Util; +using MediaPortal.Video.Database; + + +using GUIPrograms.Database; +using MediaPortal.Configuration; + +using GUIPrograms.ApplicationItems; +using GUIPrograms.FileItems; + + +namespace GUIPrograms +{ + /// <summary> + /// + /// </summary> + public class GUIProgramsAltFileInfo : GUIWindow, IRenderLayer + { + [SkinControlAttribute(2)] + protected GUIButtonControl launchButton = null; + [SkinControlAttribute(3)] + protected GUIToggleButtonControl overviewInfoButton = null; + [SkinControlAttribute(4)] + protected GUIToggleButtonControl btnCast = null; + [SkinControlAttribute(5)] + protected GUIButtonControl btnRefresh = null; + + + [SkinControlAttribute(10)] + protected GUISpinControl spinImages = null; + + [SkinControlAttribute(20)] + protected GUITextScrollUpControl tblOverviewInfoArea = null; + [SkinControlAttribute(21)] + protected GUIImage imgCoverArt = null; + [SkinControlAttribute(22)] + protected GUITextControl tbTextArea = null; + [SkinControlAttribute(30)] + protected GUILabelControl lblImage = null; + + + + enum ViewMode + { + Image, + Cast, + } + + ViewMode viewmode = ViewMode.Image; + FileItem currentFileItem = null; + string folderForThumbs = string.Empty; + string[] coverArtUrls = new string[1]; + string imdbCoverArtUrl = String.Empty; + + Thread imageSearchThread = null; + + public GUIProgramsAltFileInfo() + { + GetID = 9999; + } + + public override bool Init() + { + return Load(GUIGraphicsContext.Skin + @"\myProgramsAltFileInfo.xml"); + } + + + protected override void OnPageLoad() + { + base.OnPageLoad(); + this._isOverlayAllowed = true; + + if (currentFileItem == null) + { + return; + } + // Default picture + imdbCoverArtUrl = currentFileItem.Imagefile; + coverArtUrls = new string[1]; + coverArtUrls[0] = imdbCoverArtUrl; + + ResetSpinControl(); + + viewmode = ViewMode.Image; + + Refresh(false); + Update(); + imageSearchThread = new Thread(new ThreadStart(AmazonLookupThread)); + imageSearchThread.Start(); + } + protected override void OnPageDestroy(int newWindowId) + { + base.OnPageDestroy(newWindowId); + if ((imageSearchThread != null) && (imageSearchThread.IsAlive)) + { + imageSearchThread.Abort(); + imageSearchThread = null; + } + } + + + protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) + { + base.OnClicked(controlId, control, actionType); + if (control == btnRefresh) + { + + return; + } + + if (control == spinImages) + { + int item = spinImages.Value - 1; + if (item < 0 || item >= coverArtUrls.Length) item = 0; + if (currentFileItem.Imagefile == coverArtUrls[item]) + { + return; + } + + currentFileItem.Imagefile = coverArtUrls[item]; + string coverArtImage = MediaPortal.Util.Utils.GetCoverArtName(Thumbs.MovieTitle, currentFileItem.Title); + string largeCoverArtImage = MediaPortal.Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, currentFileItem.Title); + MediaPortal.Util.Utils.FileDelete(coverArtImage); + MediaPortal.Util.Utils.FileDelete(largeCoverArtImage); + Refresh(true); + Update(); + int idMovie = currentFileItem.FileID; + if (idMovie >= 0) + VideoDatabase.SetThumbURL(idMovie, currentFileItem.Imagefile); + return; + } + + if (control == btnCast) + { + viewmode = ViewMode.Cast; + Update(); + } + if (control == overviewInfoButton) + { + + viewmode = ViewMode.Image; + Update(); + } + + if (control == launchButton) + { + int id = currentFileItem.FileID; + + //fix hack later + // ApplicationItem a = new ApplicationItem(DatabaseHandler.sqlDB); + // a.LaunchFile(leItem, true); + // GUIVideoFiles.PlayMovie(id); + return; + } + } + + + public FileItem Movie + { + get { return currentFileItem; } + set { currentFileItem = value; } + } + public string FolderForThumbs + { + get { return folderForThumbs; } + set { folderForThumbs = value; } + } + + void Update() + { + if (currentFileItem == null) return; + + //cast->image + if (viewmode == ViewMode.Cast) + { + tblOverviewInfoArea.IsVisible = false; + tbTextArea.IsVisible = true; + imgCoverArt.IsVisible = true; + overviewInfoButton.Selected = false; + btnCast.Selected = true; + } + //cast->plot + if (viewmode == ViewMode.Image) + { + tblOverviewInfoArea.IsVisible = true; + tbTextArea.IsVisible = false; + imgCoverArt.IsVisible = true; + overviewInfoButton.Selected = true; + btnCast.Selected = false; + + } + //btnWatched.Selected = (currentFileItem.Watched != 0); + currentFileItem.SetProperties(); + if (imgCoverArt != null) + { + imgCoverArt.FreeResources(); + imgCoverArt.AllocResources(); + } + + } + + + void Refresh(bool forceFolderThumb) + { + string coverArtImage = String.Empty; + try + { + string imageUrl = currentFileItem.Imagefile; + if (imageUrl.Length > 0) + { + coverArtImage = MediaPortal.Util.Utils.GetCoverArtName(Thumbs.MovieTitle, currentFileItem.Title); + string largeCoverArtImage = MediaPortal.Util.Utils.ConvertToLargeCoverArt(coverArtImage); + + //no deafult file.. until farther check path + if (!System.IO.File.Exists(coverArtImage)) + { + coverArtImage = currentFileItem.Imagefile; + } + + + + } + } + catch (Exception ex2) + { + Log.Error("GUIVideoInfo: Error creating new thumbs for {0} - {1}", currentFileItem.Imagefile, ex2.Message); + } + currentFileItem.SetProperties(); + } + + void AmazonLookupThread() + { + try + { + if (currentFileItem == null) return; + // Search for more pictures + FileItem movie = currentFileItem; + IMPawardsSearch impSearch = new IMPawardsSearch(); + impSearch.Search(movie.Title); + AmazonImageSearch amazonSearch = new AmazonImageSearch(); + amazonSearch.Search(movie.Title); + int thumb = 0; + + if (movie.Imagefile != string.Empty) + thumb = 1; + + int pictureCount = amazonSearch.Count + impSearch.Count + thumb; + if (pictureCount == 0) + return; + + int pictureIndex = 0; + coverArtUrls = new string[pictureCount]; + + if (movie.Imagefile != string.Empty) + coverArtUrls[pictureIndex++] = movie.Imagefile; + + if ((impSearch.Count > 0) && (impSearch[0] != string.Empty)) + { + for (int i = 0; i < impSearch.Count; ++i) + { + coverArtUrls[pictureIndex++] = impSearch[i]; + } + } + + if (amazonSearch.Count > 0) + { + for (int i = 0; i < amazonSearch.Count; ++i) + { + coverArtUrls[pictureIndex++] = amazonSearch[i]; + } + } + + // AmazonImagesDownloaded(); + } + catch (ThreadAbortException) + { + } + finally + { + imageSearchThread = null; + } + } + + private void ResetSpinControl() + { + spinImages.Reset(); + //spinImages.SetReverse(true); + //spinImages.SetRange(1, pictureCount); + spinImages.SetRange(1, coverArtUrls.Length); + spinImages.Value = 1; + + spinImages.ShowRange = true; + spinImages.UpDownType = GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT; + } + + private void OnAmazonImagesDownloaded() + { + ResetSpinControl(); + } + + #region IMDB.IProgress + public bool OnDisableCancel(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + if (pDlgProgress.IsInstance(fetcher)) + { + pDlgProgress.DisableCancel(true); + } + return true; + } + public void OnProgress(string line1, string line2, string line3, int percent) + { + if (!GUIWindowManager.IsRouted) return; + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + pDlgProgress.ShowProgressBar(true); + pDlgProgress.SetLine(1, line1); + pDlgProgress.SetLine(2, line2); + if (percent > 0) + pDlgProgress.SetPercentage(percent); + pDlgProgress.Progress(); + } + public bool OnSearchStarting(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + // show dialog that we're busy querying www.imdb.com + pDlgProgress.Reset(); + pDlgProgress.SetHeading(197); + pDlgProgress.SetLine(1, fetcher.MovieName); + pDlgProgress.SetLine(2, String.Empty); + pDlgProgress.SetObject(fetcher); + pDlgProgress.StartModal(GUIWindowManager.ActiveWindow); + return true; + } + public bool OnSearchStarted(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + pDlgProgress.SetObject(fetcher); + pDlgProgress.DoModal(GUIWindowManager.ActiveWindow); + if (pDlgProgress.IsCanceled) + { + return false; + } + return true; + } + public bool OnSearchEnd(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + if ((pDlgProgress != null) && (pDlgProgress.IsInstance(fetcher))) + { + pDlgProgress.Close(); + } + return true; + } + public bool OnMovieNotFound(IMDBFetcher fetcher) + { + // show dialog... + GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + pDlgOK.SetHeading(195); + pDlgOK.SetLine(1, fetcher.MovieName); + pDlgOK.SetLine(2, String.Empty); + pDlgOK.DoModal(GUIWindowManager.ActiveWindow); + return true; + } + public bool OnDetailsStarted(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + pDlgProgress.SetObject(fetcher); + pDlgProgress.DoModal(GUIWindowManager.ActiveWindow); + if (pDlgProgress.IsCanceled) + { + return false; + } + return true; + } + public bool OnDetailsStarting(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + // show dialog that we're downloading the movie info + pDlgProgress.Reset(); + pDlgProgress.SetHeading(198); + pDlgProgress.SetLine(1, fetcher.MovieName); + pDlgProgress.SetLine(2, String.Empty); + pDlgProgress.SetObject(fetcher); + pDlgProgress.StartModal(GUIWindowManager.ActiveWindow); + return true; + } + public bool OnDetailsEnd(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + if ((pDlgProgress != null) && (pDlgProgress.IsInstance(fetcher))) + { + pDlgProgress.Close(); + } + return true; + } + public bool OnActorsStarted(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + pDlgProgress.SetObject(fetcher); + pDlgProgress.DoModal(GUIWindowManager.ActiveWindow); + if (pDlgProgress.IsCanceled) + { + return false; + } + return true; + } + public bool OnActorsStarting(IMDBFetcher fetcher) + { + GUIDialogProgress pDlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + // show dialog that we're downloading the actor info + pDlgProgress.Reset(); + pDlgProgress.SetHeading(986); + pDlgProgress.SetLine(1, fetcher.MovieName); + pDlgProgress.SetLine(2, String.Empty); + pDlgProgress.SetObject(fetcher); + pDlgProgress.StartModal(GUIWindowManager.ActiveWindow); + return true; + } + public bool OnActorsEnd(IMDBFetcher fetcher) + { + return true; + } + public bool OnDetailsNotFound(IMDBFetcher fetcher) + { + // show dialog... + GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + // show dialog... + pDlgOK.SetHeading(195); + pDlgOK.SetLine(1, fetcher.MovieName); + pDlgOK.SetLine(2, String.Empty); + pDlgOK.DoModal(GUIWindowManager.ActiveWindow); + return false; + } + + public bool OnRequestMovieTitle(IMDBFetcher fetcher, out string movieName) + { + string strMovieName = ""; + GetStringFromKeyboard(ref strMovieName); + movieName = strMovieName; + if (movieName == string.Empty) + { + return false; + } + return true; + } + + public bool OnSelectMovie(IMDBFetcher fetcher, out int selectedMovie) + { + GUIDialogSelect pDlgSelect = (GUIDialogSelect)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT); + // more then 1 movie found + // ask user to select 1 + pDlgSelect.SetHeading(196);//select movie + pDlgSelect.Reset(); + for (int i = 0; i < fetcher.Count; ++i) + { + pDlgSelect.Add(fetcher[i].Title); + } + pDlgSelect.EnableButton(true); + pDlgSelect.SetButtonLabel(413); // manual + pDlgSelect.DoModal(GUIWindowManager.ActiveWindow); + + // and wait till user selects one + selectedMovie = pDlgSelect.SelectedLabel; + if (selectedMovie != -1) + { + return true; + } + if (!pDlgSelect.IsButtonPressed) + { + return false; + } + else + { + return true; + } + } + + public bool OnScanStart(int total) + { + return true; + } + public bool OnScanEnd() + { + return true; + } + public bool OnScanIterating(int count) + { + return true; + } + public bool OnScanIterated(int count) + { + return true; + } + + #endregion + + static public void GetStringFromKeyboard(ref string strLine) + { + VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); + if (null == keyboard) return; + keyboard.Reset(); + keyboard.Text = strLine; + keyboard.DoModal(GUIWindowManager.ActiveWindow); + strLine = String.Empty; + if (keyboard.IsConfirmed) + { + strLine = keyboard.Text; + } + } + + + #region IRenderLayer + public bool ShouldRenderLayer() + { + return true; + } + + public void RenderLayer(float timePassed) + { + Render(timePassed); + } + #endregion + } +} Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltFileDetailsInfo.xml =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltFileDetailsInfo.xml 2007-07-11 22:03:07 UTC (rev 684) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltFileDetailsInfo.xml 2007-07-11 22:05:26 UTC (rev 685) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<contentprofiles> - <profile id="100"> - <title>Default Profile</title> - <fields> - <field fieldid="Line1Data">[VALUEOFTAG("system")]</field> - <field fieldid="Line2Data">[VALUEOFTAG("yearmanu")]</field> - <field fieldid="Line3Data">[VALUEOFTAG("rating")]</field> - <field fieldid="Line4Data">[VALUEOFTAG("genre")]</field> - <field fieldid="OverviewData">[VALUEOFTAG("overview")]</field> - </fields> - </profile> - </contentprofiles> Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml 2007-07-11 22:05:26 UTC (rev 685) @@ -0,0 +1,335 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<window> + <id>9999</id> + <defaultcontrol>2</defaultcontrol> + <allowoverlay>no</allowoverlay> + <controls> + <control> + <description>background image</description> + <type>image</type> + <id>1</id> + <width>720</width> + <height>576</height> + </control> + <control> + <type>image</type> + <id>1</id> + <posX>60</posX> + <posY>20</posY> + <texture>movieinfo_logo.png</texture> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <description>Movie Title value</description> + <type>fadelabel</type> + <id>1</id> + <posX>200</posX> + <posY>40</posY> + <width>400</width> + <label>#title</label> + <font>font18</font> + <textcolor>FFFFFFFF</textcolor> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <description>MPAA Rating</description> + <type>fadelabel</type> + <id>1</id> + <posX>200</posX> + <posY>70</posY> + <width>400</width> + <label>(#mpaarating)</label> + <font>font12</font> + <textcolor>FFFFFFFF</textcolor> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <description>Launch Button</description> + <type>button</type> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <width>120</width> + <label>208</label> + <font>font13</font> + <onleft>22</onleft> + <onright>22</onright> + <onup>7</onup> + <ondown>3</ondown> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <description>Overview</description> + <type>togglebutton</type> + <id>3</id> + <posX>60</posX> + <posY>131</posY> + <width>120</width> + <label>207</label> + <font>font13</font> + <onleft>22</onleft> + <onright>22</onright> + <onup>2</onup> + <ondown>4</ondown> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <!--<control> + <description>Cast</description> + <type>togglebutton</type> + <id>4</id> + <posX>60</posX> + <posY>165</posY> + <width>120</width> + <label>206</label> + <font>font13</font> + <onleft>22</onleft> + <onright>22</onright> + <onup>3</onup> + <ondown>5</ondown> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control>--> + <control> + <description>Refresh</description> + <type>button</type> + <id>5</id> + <posX>60</posX> + <posY>199</posY> + <width>120</width> + <label>184</label> + <onleft>22</onleft> + <onright>22</onright> + <onup>4</onup> + <ondown>6</ondown> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> +<!-- <control> + <description>Watched</description> + <type>togglebutton</type> + <id>6</id> + <posX>60</posX> + <posY>233</posY> + <width>120</width> + <label>1010</label> + <onleft>22</onleft> + <onright>22</onright> + <onup>5</onup> + <ondown>10</ondown> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control>--> + <control> + <description>image title:</description> + <type>label</type> + <id>30</id> + <posX>60</posX> + <posY>270</posY> + <label>734</label> + <font>font13</font> + <align>left</align> + <textcolor>FFB2D4F5</textcolor> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <description>spin control</description> + <type>spincontrol</type> + <id>10</id> + <posX>60</posX> + <posY>292</posY> + <onup>6</onup> + <ondown>11</ondown> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <type>imagelist</type> + <id>1</id> + <posX>400</posX> + <posY>100</posY> + <width>160</width> + <height>32</height> + <textureWidth>16</textureWidth> + <textureHeight>16</textureHeight> + <subitems> + <subitem>greystar.png</subitem> + <subitem>star.png</subitem> + </subitems> + <orientation>horizontal</orientation> + <percentage>#rating</percentage> + <animation effect="fade" time="200">WindowOpen</animation> + <animation effect="fade" time="200">WindowClose</animation> + </control> + <control> + <description>Platform</description> + <type>label</type> + <id>1</id> + <posX>400</posX> + <posY>115</posY> + <label>Platform</label> + <... [truncated message content] |
From: <nor...@us...> - 2007-07-14 10:39:14
|
Revision: 691 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=691&view=rev Author: northern_sky Date: 2007-07-14 03:39:11 -0700 (Sat, 14 Jul 2007) Log Message: ----------- some residue code removed Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-13 02:56:29 UTC (rev 690) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-14 10:39:11 UTC (rev 691) @@ -89,7 +89,6 @@ string validExtensions; bool importValidImagesOnly; - int contentID; string systemDefault; string launchErrorMsg; @@ -299,11 +298,6 @@ set { importValidImagesOnly = value; } } - public int ContentID - { - get { return contentID; } - set { contentID = value; } - } public string SystemDefault { get { return systemDefault; } @@ -369,7 +363,6 @@ appPosition = 0; importValidImagesOnly = false; enableGUIRefresh = false; - contentID = 100; systemDefault = ""; waitForExit = true; filesAreLoaded = false; @@ -806,8 +799,6 @@ string sql = ""; - if (ContentID <= 0) - ContentID = 100; try { AppID = GetNewAppID(); // important to avoid subsequent inserts! @@ -835,7 +826,6 @@ enabled, enableGUIRefresh, GUIRefreshPossible, - contentID, systemDefault, waitForExit, preLaunch, @@ -863,7 +853,6 @@ '"+ ProgramUtils.BooleanToStr(Enabled)+@"', '"+ ProgramUtils.BooleanToStr(EnableGUIRefresh) +@"', '" + ProgramUtils.BooleanToStr(GUIRefreshPossible)+@"', - '" + ContentID +@"', '"+ ProgramUtils.Encode(SystemDefault)+@"', '"+ ProgramUtils.BooleanToStr(WaitForExit) +@"', '"+ ProgramUtils.Encode(PreLaunch)+@"', @@ -886,8 +875,6 @@ string sql = ""; - if (ContentID <= 0) - ContentID = 100; try { sql = String.Format( @@ -913,7 +900,6 @@ fatherNodeId = '" + FatherID + @"', enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + @"', GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) +@"', - contentID = '" + ContentID + @"', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + @"', waitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + @"', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + @"', @@ -1089,7 +1075,7 @@ this.PreLaunch = sourceApp.PreLaunch; this.PostLaunch = sourceApp.PostLaunch; this.SystemDefault = sourceApp.SystemDefault; - this.ContentID = sourceApp.ContentID; + } #region imagedirectory stuff Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-13 02:56:29 UTC (rev 690) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-14 10:39:11 UTC (rev 691) @@ -76,7 +76,6 @@ newApp.ImportValidImagesOnly = ProgramUtils.GetBool(results, recordIndex, "importvalidimagesonly"); newApp.Position = ProgramUtils.GetIntDef(results, recordIndex, "iposition", 0); newApp.EnableGUIRefresh = ProgramUtils.GetBool(results, recordIndex, "enableGUIRefresh"); - newApp.ContentID = ProgramUtils.GetIntDef(results, recordIndex, "contentID", 100); newApp.SystemDefault = ProgramUtils.Get(results, recordIndex, "systemdefault"); newApp.WaitForExit = ProgramUtils.GetBool(results, recordIndex, "waitforexit"); newApp.PreLaunch = ProgramUtils.Get(results, recordIndex, "preLaunch"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-13 02:56:29 UTC (rev 690) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-14 10:39:11 UTC (rev 691) @@ -130,7 +130,6 @@ iposition INTEGER, enableGUIRefresh TEXT, GUIRefreshPossible TEXT, - contentID INTEGER, systemdefault TEXT, waitForExit TEXT, preLaunch TEXT, Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-13 02:56:29 UTC (rev 690) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-14 10:39:11 UTC (rev 691) @@ -119,20 +119,6 @@ gameInfoURL = string.Empty; } - private string GetYearManu() - { - string result = ""; - if (year <= 0) - { - result = manufacturer; - } - else - { - result = manufacturer + " [" + year + "]"; - } - return (result.Trim()); - } - #region Properties public int FileID @@ -429,13 +415,6 @@ set { gameInfoURL = value; } } - public string YearManu - { - get - { - return GetYearManu(); - } - } public List<FileItemInfo> FileInfoList { @@ -474,59 +453,6 @@ return nRes; } - public string ExtractFileName() - { - if (Filename == "") - { - return ""; - } - string strRes = ""; - string strSep = ""; - string[] parts = Filename.Split(' '); - if (Filename.StartsWith("\"")) - { - // filename is quoted => traverse array and concetenate strings until two quotes are found - int nNbOfQuotes = 0; - for (int i = 0; i < parts.Length; i++) - { - if (nNbOfQuotes <= 2) - { - strRes = strRes + strSep + parts[i]; - strSep = " "; - } - if (parts[i].IndexOf("\"") >= 0) - { - nNbOfQuotes = nNbOfQuotes + CountQuotes(parts[i]); - if (nNbOfQuotes == 2) - { - break; - } - } - } - } - else - { - strRes = parts[0]; - } - return strRes; - - } - - - public string ExtractDirectory(string curFilename) - { - string strRes = ""; - string strSep = ""; - string[] parts = curFilename.Split('\\'); - for (int i = 0; i < parts.Length - 1; i++) - { - strRes = strRes + strSep + parts[i]; - strSep = "\\"; - } - strRes = strRes.TrimStart('\"'); - return strRes; - } - public string ExtractImageExtension() { string strRes = ""; @@ -549,40 +475,6 @@ } return strRes; } - - public string ExtractArguments() - { - string strRes = ""; - string strSep = ""; - string[] parts = Filename.Split(' '); - if (Filename.StartsWith("\"")) - { - // filename is quoted => traverse array and concetenate strings after two quotes have been found - int nNbOfQuotes = 0; - for (int i = 0; i < parts.Length; i++) - { - if (nNbOfQuotes >= 2) - { - strRes = strRes + strSep + parts[i]; - strSep = " "; - } - if (parts[i].IndexOf("\"") >= 0) - { - nNbOfQuotes = nNbOfQuotes + CountQuotes(parts[i]); - } - } - } - else - { - for (int i = 1; i < parts.Length; i++) - { - strRes = strRes + strSep + parts[i]; - strSep = " "; - } - } - return strRes; - } - public void SetProperties() { /* string strThumb = MediaPortal.Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, Title);*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-15 16:20:55
|
Revision: 692 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=692&view=rev Author: northern_sky Date: 2007-07-15 09:20:48 -0700 (Sun, 15 Jul 2007) Log Message: ----------- fixed view bug,some minor infoupdate,some redundant dbstuff rem.. Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -64,7 +64,6 @@ string postLaunch; bool enabled; - bool enableGUIRefresh; int appPosition; string currentView = ""; @@ -76,8 +75,11 @@ bool importMamePlaychoice10 = false; bool importMameMahjong = false; + bool refreshGUIAllowed = false; + + // more variables, maybe need some renaming or anything else Process proc; ApplicationType sourceType; @@ -193,15 +195,13 @@ get { return enabled; } set { enabled = value; } } - public bool EnableGUIRefresh + + public virtual bool RefreshGUIAllowed { - get { return enableGUIRefresh; } - set { enableGUIRefresh = value; } + get { return refreshGUIAllowed; } + set { refreshGUIAllowed = value; } } - public bool GUIRefreshPossible - { - get { return RefreshButtonVisible(); } - } + public int Position { get { return appPosition; } @@ -362,7 +362,6 @@ validExtensions = ""; appPosition = 0; importValidImagesOnly = false; - enableGUIRefresh = false; systemDefault = ""; waitForExit = true; filesAreLoaded = false; @@ -727,11 +726,6 @@ } - public virtual bool RefreshButtonVisible() - { - return false; // otherwise, override this in child class - } - public virtual bool FileEditorAllowed() { return true; // otherwise, override this in child class @@ -824,8 +818,7 @@ importValidImagesOnly, iposition, enabled, - enableGUIRefresh, - GUIRefreshPossible, + refreshGUIAllowed, systemDefault, waitForExit, preLaunch, @@ -851,8 +844,7 @@ '"+ ProgramUtils.BooleanToStr(importValidImagesOnly)+@"', '"+ Position+@"', '"+ ProgramUtils.BooleanToStr(Enabled)+@"', - '"+ ProgramUtils.BooleanToStr(EnableGUIRefresh) +@"', - '" + ProgramUtils.BooleanToStr(GUIRefreshPossible)+@"', + '" + ProgramUtils.BooleanToStr(RefreshGUIAllowed)+@"', '"+ ProgramUtils.Encode(SystemDefault)+@"', '"+ ProgramUtils.BooleanToStr(WaitForExit) +@"', '"+ ProgramUtils.Encode(PreLaunch)+@"', @@ -898,8 +890,7 @@ iposition = " + Position + @", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + @"', fatherNodeId = '" + FatherID + @"', - enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + @"', - GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) +@"', + refreshGUIAllowed = '" + ProgramUtils.BooleanToStr(RefreshGUIAllowed) +@"', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + @"', waitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + @"', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + @"', @@ -1070,7 +1061,6 @@ this.ValidExtensions = sourceApp.ValidExtensions; this.ImportValidImagesOnly = sourceApp.ImportValidImagesOnly; this.Position = sourceApp.Position; - this.EnableGUIRefresh = sourceApp.EnableGUIRefresh; this.WaitForExit = sourceApp.WaitForExit; this.PreLaunch = sourceApp.PreLaunch; this.PostLaunch = sourceApp.PostLaunch; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -201,35 +201,38 @@ { FileInfo fileInDir = null; - DirectoryInfo directoryInfo = new DirectoryInfo(dirPath); - FileSystemInfo[] allUnderLyingFiles = directoryInfo.GetFileSystemInfos(); - - for (int i = 0; i < allUnderLyingFiles.Length; i++) + if (Directory.Exists(dirPath)) { - if (allUnderLyingFiles[i] is FileInfo) + DirectoryInfo directoryInfo = new DirectoryInfo(dirPath); + FileSystemInfo[] allUnderLyingFiles = directoryInfo.GetFileSystemInfos(); + + for (int i = 0; i < allUnderLyingFiles.Length; i++) { - Boolean FileExists = false; + if (allUnderLyingFiles[i] is FileInfo) + { + Boolean FileExists = false; - fileInDir = (FileInfo)allUnderLyingFiles[i]; + fileInDir = (FileInfo)allUnderLyingFiles[i]; - foreach (FileItem DBfile in this.Files) - { - if (DBfile.Filename == fileInDir.FullName) + foreach (FileItem DBfile in this.Files) { - FileExists = true; - break;//ugly + if (DBfile.Filename == fileInDir.FullName) + { + FileExists = true; + break;//ugly + } } - } - if (!FileExists) + if (!FileExists) + { + ImportFileItem(fileInDir); + UpdateProgressDialog(fileInDir, mpGuiMode); + } + }//if dir found,, recurse + else if (allUnderLyingFiles[i] is DirectoryInfo) { - ImportFileItem(fileInDir); - UpdateProgressDialog(fileInDir, mpGuiMode); + DirectoryInfo directory = (DirectoryInfo)allUnderLyingFiles[i]; + ImportFile(directory.FullName, mpGuiMode); } - }//if dir found,, recurse - else if (allUnderLyingFiles[i] is DirectoryInfo) - { - DirectoryInfo directory = (DirectoryInfo)allUnderLyingFiles[i]; - ImportFile(directory.FullName, mpGuiMode); } } } @@ -291,12 +294,6 @@ return this.FileDirectory; } - override public bool RefreshButtonVisible() - { - return true; - } - - override public bool FileBrowseAllowed() { return true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -117,11 +117,6 @@ } - override public bool RefreshButtonVisible() - { - return true; - } - override public bool ProfileLoadingAllowed() { return true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -75,7 +75,7 @@ newApp.ValidExtensions = ProgramUtils.Get(results, recordIndex, "validextensions"); newApp.ImportValidImagesOnly = ProgramUtils.GetBool(results, recordIndex, "importvalidimagesonly"); newApp.Position = ProgramUtils.GetIntDef(results, recordIndex, "iposition", 0); - newApp.EnableGUIRefresh = ProgramUtils.GetBool(results, recordIndex, "enableGUIRefresh"); + newApp.RefreshGUIAllowed = ProgramUtils.GetBool(results, recordIndex, "refreshGUIAllowed"); newApp.SystemDefault = ProgramUtils.Get(results, recordIndex, "systemdefault"); newApp.WaitForExit = ProgramUtils.GetBool(results, recordIndex, "waitforexit"); newApp.PreLaunch = ProgramUtils.Get(results, recordIndex, "preLaunch"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -65,11 +65,6 @@ } - override public bool RefreshButtonVisible() - { - return true; - } - override public bool ProfileLoadingAllowed() { return true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -128,15 +128,14 @@ enabled TEXT, importValidImagesOnly TEXT, iposition INTEGER, - enableGUIRefresh TEXT, - GUIRefreshPossible TEXT, + refreshGUIAllowed TEXT, systemdefault TEXT, waitForExit TEXT, preLaunch TEXT, postLaunch TEXT )"); - DatabaseUtility.AddTable(sqlDB, "tblFileItem", "CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, mainGenreId INTEGER, subGenreId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, platformId INTEGER, import_flag INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, isfolder TEXT, uppertitle TEXT, tagdata TEXT, categorydata TEXT, gameInfoUrl TEXT)"); + DatabaseUtility.AddTable(sqlDB, "tblFileItem", "CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, mainGenreId INTEGER, subGenreId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, platformId INTEGER, import_flag INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, isfolder TEXT, uppertitle TEXT,categorydata TEXT, gameInfoUrl TEXT)"); DatabaseUtility.AddTable(sqlDB, "tblFilterItem", "CREATE TABLE tblFilterItem (applicationId INTEGER, grouperAppID INTEGER, fileID INTEGER, filename TEXT, tag INTEGER)"); DatabaseUtility.AddTable(sqlDB, "tblSetting", "CREATE TABLE tblSetting (settingid INTEGER PRIMARY KEY, key TEXT, value TEXT)"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -165,7 +165,6 @@ { newButton.Enabled = currentApplication.FileAddAllowed(); addFavouriteButton.Enabled = currentApplication.FilesCanBeFavourites() && (fileListView.SelectedItems.Count > 0); - updateDatabaseButton.Visible = currentApplication.RefreshButtonVisible(); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -58,7 +58,7 @@ quoteCheckBox.Checked = curApp.UseQuotes; waitExitCheckBox.Checked = (curApp.WaitForExit); applicationImageTextBox.Text = curApp.Imagefile; - allowRefreshCheckBox.Checked = curApp.EnableGUIRefresh; + allowRefreshCheckBox.Checked = curApp.RefreshGUIAllowed; return true; } @@ -76,7 +76,7 @@ curApp.WaitForExit = waitExitCheckBox.Checked; curApp.SourceType = ApplicationType.DIRCACHE; curApp.Imagefile = applicationImageTextBox.Text; - curApp.EnableGUIRefresh = (allowRefreshCheckBox.Checked); + curApp.RefreshGUIAllowed = (allowRefreshCheckBox.Checked); } @@ -120,7 +120,6 @@ //untiil we really do something with this option in appdircache.. allowRefreshCheckBox.Checked = false; - allowRefreshCheckBox.Visible = false; } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -72,7 +72,7 @@ SetWindowStyle(curApp.WindowStyle); this.applicationImageTextBox.Text = curApp.Imagefile; - this.allowRefreshCheckBox.Checked = curApp.EnableGUIRefresh; + this.allowRefreshCheckBox.Checked = curApp.RefreshGUIAllowed; return true; } @@ -92,7 +92,7 @@ curApp.SourceType = ApplicationType.GAMEBASE; curApp.Imagefile = this.applicationImageTextBox.Text; - curApp.EnableGUIRefresh = this.allowRefreshCheckBox.Checked; + curApp.RefreshGUIAllowed = this.allowRefreshCheckBox.Checked; } public override bool EntriesOK(ApplicationItem curApp) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -72,7 +72,7 @@ curApp.Imagefile = this.applicationImageTextBox.Text; - curApp.EnableGUIRefresh = true; + curApp.RefreshGUIAllowed = true; } @@ -109,7 +109,6 @@ this.enabledCheckbox.Checked = true; this.prePostButton.Visible = false; - this.allowRefreshCheckBox.Visible = false; } private void informationLabel_Click(object sender, EventArgs e) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -69,8 +69,6 @@ DateTime lastTimeLaunched; int launchCount; - - string tagData; string categoryData; bool isFolder; string gameInfoURL; @@ -114,7 +112,6 @@ isFolder = false; lastTimeLaunched = DateTime.MinValue; launchCount = 0; - tagData = ""; categoryData = ""; gameInfoURL = string.Empty; } @@ -375,18 +372,6 @@ } } - - public string TagData - { - get - { - return tagData; - } - set - { - tagData = value; - } - } public string CategoryData { get @@ -481,8 +466,8 @@ //((GUIPropertyManager.SetProperty("#director", Director); GUIPropertyManager.SetProperty("#maingenre", MainGenre); GUIPropertyManager.SetProperty("#subgenre", SubGenre); - //GUIPropertyManager.SetProperty("#cast", Cast); - // GUIPropertyManager.SetProperty("#dvdlabel", DVDLabel); + GUIPropertyManager.SetProperty("#manufacturer", Manufacturer); + GUIPropertyManager.SetProperty("#fname", Filename); // GUIPropertyManager.SetProperty("#imdbnumber", IMDBNumber); // GUIPropertyManager.SetProperty("#file", File); GUIPropertyManager.SetProperty("#plot", Overview); @@ -528,7 +513,6 @@ launchcount, isfolder, uppertitle, - tagdata, categorydata, gameInfoUrl ) @@ -552,7 +536,6 @@ '" + LaunchCount.ToString() + @"', '" + ProgramUtils.BooleanToStr(IsFolder) + @"', '" + ProgramUtils.Encode(Title.ToUpper()) + @"', - '" + ProgramUtils.Encode(TagData) + @"', '" + ProgramUtils.Encode(CategoryData)) + @"', '" + ProgramUtils.Encode(GameInfoURL) + @"' )"; @@ -585,7 +568,7 @@ try { string strSQL = String.Format( - "UPDATE tblFileItem SET title = '{1}', filename = '{2}', imagefile = '{3}', mainGenreId = '{4}', subGenreId = '{5}', country = '{6}', manufacturerId = '{7}', year = '{8}', rating = '{9}', overview = '{10}', platformId = '{11}', uppertitle = '{12}', tagdata = '{13}', categorydata = '{14}', gameInfoURL = '" + ProgramUtils.Encode(GameInfoURL) + "' where fileid = {0}", FileID, ProgramUtils.Encode(Title), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Imagefile), MainGenreId, SubGenreId, ProgramUtils.Encode(Country), ManufacturerId, strYear, Rating, ProgramUtils.Encode(Overview), PlatformId, ProgramUtils.Encode(Title.ToUpper()), ProgramUtils.Encode(TagData), ProgramUtils.Encode(CategoryData)); + "UPDATE tblFileItem SET title = '{1}', filename = '{2}', imagefile = '{3}', mainGenreId = '{4}', subGenreId = '{5}', country = '{6}', manufacturerId = '{7}', year = '{8}', rating = '{9}', overview = '{10}', platformId = '{11}', uppertitle = '{12}', categorydata = '{13}', gameInfoURL = '" + ProgramUtils.Encode(GameInfoURL) + "' where fileid = {0}", FileID, ProgramUtils.Encode(Title), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Imagefile), MainGenreId, SubGenreId, ProgramUtils.Encode(Country), ManufacturerId, strYear, Rating, ProgramUtils.Encode(Overview), PlatformId, ProgramUtils.Encode(Title.ToUpper()),ProgramUtils.Encode(CategoryData)); sqlDB.Execute(strSQL); } catch (SQLiteException ex) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -75,7 +75,7 @@ newFile.Title = ProgramUtils.Get(results, iRecord, "title"); newFile.Filename = ProgramUtils.Get(results, iRecord, "filename"); newFile.Imagefile = ProgramUtils.Get(results, iRecord, "imagefile"); - newFile.MainGenre = ProgramUtils.Get(results, iRecord, "mainGenreId"); + newFile.MainGenre = ProgramUtils.Get(results, iRecord, "mainGenre"); newFile.MainGenreId = ProgramUtils.GetIntDef(results, iRecord, "mainGenreId", 1); newFile.SubGenre = ProgramUtils.Get(results, iRecord, "subGenre"); newFile.SubGenreId = ProgramUtils.GetIntDef(results, iRecord, "subGenreId", 1); @@ -90,7 +90,6 @@ newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); newFile.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); - newFile.TagData = ProgramUtils.Get(results, iRecord, "tagdata"); newFile.CategoryData = ProgramUtils.Get(results, iRecord, "categorydata"); newFile.GameInfoURL= ProgramUtils.Get(results, iRecord, "gameInfoUrl"); string fieldtype2 = ProgramUtils.Get(results, iRecord, "fieldtype2"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-15 16:20:48 UTC (rev 692) @@ -555,17 +555,6 @@ } } - bool RefreshButtonVisible() - { - if (lastApp == null) - { - return false; - } - else - { - return (lastApp.RefreshButtonVisible() && lastApp.GUIRefreshPossible && lastApp.EnableGUIRefresh); - } - } bool ThereAreAppsToDisplay() { @@ -800,7 +789,17 @@ string sortBy = string.Empty; GUIPropertyManager.SetProperty("#view", DatabaseHandler.ViewHandler.LocalizedCurrentView); - btnRefresh.IsVisible = RefreshButtonVisible(); + + if (lastApp == null) + { + btnRefresh.IsVisible = false; + } + else + { + btnRefresh.IsVisible = lastApp.RefreshGUIAllowed; + } + + facadeView.IsVisible = true; GUIControl.FocusControl(GetID, facadeView.GetID); @@ -1516,7 +1515,8 @@ int nNewWindow = (int)Window.WINDOW_FILES; StartWindow = nNewWindow; CurrentLayout = Layout.List; - DatabaseHandler.ViewHandler.CurrentView = null; + CurrentView = GUILocalizeStrings.Get(100000 + GetID);//my files + DatabaseHandler.ViewHandler.CurrentView = GUILocalizeStrings.Get(100000 + GetID);//my files if (nNewWindow != GetID) { GUIWindowManager.ReplaceWindow(nNewWindow); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml 2007-07-14 10:39:11 UTC (rev 691) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml 2007-07-15 16:20:48 UTC (rev 692) @@ -34,13 +34,13 @@ <animation effect="fade" time="200">WindowClose</animation> </control> <control> - <description>MPAA Rating</description> + <description>Filename</description> <type>fadelabel</type> <id>1</id> <posX>200</posX> <posY>70</posY> - <width>400</width> - <label>(#mpaarating)</label> + <width>1000</width> + <label>(#filename)</label> <font>font12</font> <textcolor>FFFFFFFF</textcolor> <animation effect="fade" time="200">WindowOpen</animation> @@ -192,24 +192,24 @@ <animation effect="fade" time="200">WindowClose</animation> </control> <control> - <description>Runtime txt</description> + <description>Manufacturer txt</description> <type>label</type> <id>1</id> <posX>400</posX> <posY>295</posY> - <label>299</label> + <label>Manufacturer</label> <font>font13</font> <textcolor>FFB2D4F5</textcolor> <animation effect="fade" time="200">WindowOpen</animation> <animation effect="fade" time="200">WindowClose</animation> </control> <control> - <description>Runtime value</description> + <description>Manufacturer value</description> <type>label</type> <id>1</id> <posX>400</posX> <posY>310</posY> - <label>#runtime</label> + <label>#manufacturer</label> <font>font13</font> <textcolor>FFFFFFFF</textcolor> <animation effect="fade" time="200">WindowOpen</animation> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-22 16:03:09
|
Revision: 749 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=749&view=rev Author: northern_sky Date: 2007-07-22 09:03:05 -0700 (Sun, 22 Jul 2007) Log Message: ----------- restructure of items etc.. probably some bugs introduced too=) Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/BaseItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FilterItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -38,16 +38,16 @@ using GUIPrograms; using GUIPrograms.Database; -using GUIPrograms.FileItems; +using GUIPrograms.Items; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { - public class ApplicationItem + public class ApplicationItem : BaseItem { #region Variables - protected static SQLiteClient sqlDB = null; + int appID; int fatherID; @@ -69,20 +69,23 @@ string currentView = ""; public bool filesAreLoaded = false; // load on demand.... - protected FileItemList fileList = null; + // protected FileItemList fileList = null; + public bool linksAreLoaded = false; // load on demand.... - protected FilelinkItemList fileLinks = null; + + bool importMamePlaychoice10 = false; bool importMameMahjong = false; bool refreshGUIAllowed = false; + // more variables, maybe need some renaming or anything else Process proc; - ApplicationType sourceType; + ItemType sourceType; string sourceFile; string imageFile; string imageDirectories; // in one string for sqlite db field @@ -98,7 +101,7 @@ int thumbIndex = 0; int thumbFolderIndex = -1; - string lastFilepath = ""; // cached path + protected string lastFilepath = ""; // cached path //private DatabaseSorter dbPc = new DatabaseSorter(); //private ProgramSort dbPc = new ProgramSort(ProgramSort.SortMethod.Name, true); @@ -215,32 +218,6 @@ set { currentView = value; } } - - public FileItemList Files - { - // load on demand.... - get - { - if (!filesAreLoaded) - { - LoadFiles(); - } - return fileList; - } - } - public FilelinkItemList Filelinks - { - // load on demand.... - get - { - if (!linksAreLoaded) - { - LoadFileLinks(); - } - return fileLinks; - } - } - public bool ImportMamePlaychoice10 { get { return importMamePlaychoice10; } @@ -282,7 +259,7 @@ get { return sourceFile; } set { sourceFile = value; } } - public ApplicationType SourceType + public ItemType SourceType { get { return sourceType; } set { sourceType = value; } @@ -309,20 +286,6 @@ set { launchErrorMsg = value; } } - - /* public int CurrentSortIndex - { - get { return GetCurrentSortIndex(); } - set { SetCurrentSortIndex(value); } - - }*/ - /* public bool CurrentSortIsAscending - { - get { return GetCurrentSortIsAscending(); } - set { SetCurrentSortIsAscending(value); } - - } */ - #endregion #region Events @@ -338,12 +301,10 @@ #region Constructor - public ApplicationItem(SQLiteClient initSqlDB) + public ApplicationItem(SQLiteClient initSqlDb) : base(initSqlDb) { - - // constructor: save SQLiteDB object - sqlDB = initSqlDB; - // .. init member variables ... + + // .. init member variables ... appID = -1; fatherID = -1; title = ""; @@ -354,7 +315,7 @@ useShellExecute = false; useQuotes = true; enabled = true; - sourceType = ApplicationType.UNKNOWN; + sourceType = ItemType.UNKNOWN; sourceFile = ""; imageFile = ""; fileDirectory = ""; @@ -386,38 +347,39 @@ protected int GetID = ProgramUtils.GetID; + + public FileItem PrevFile(FileItem curFile) { - if (Files == null) return null; - if (Files.Count == 0) return null; + if (ItemList == null) return null; + if (ItemList.Count == 0) return null; - int index = this.Files.IndexOf(curFile); + int index = this.ItemList.IndexOf(curFile); index = index - 1; if (index < 0) - index = Files.Count - 1; - return (FileItem)Files[index]; + index = ItemList.Count - 1; + return (FileItem)ItemList[index]; } public FileItem NextFile(FileItem curFile) { - if (Files == null) return null; - if (Files.Count == 0) return null; + if (ItemList == null) return null; + if (ItemList.Count == 0) return null; - int index = this.Files.IndexOf(curFile); + int index = this.ItemList.IndexOf(curFile); index = index + 1; - if (index > Files.Count - 1) + if (index > ItemList.Count - 1) index = 0; - return (FileItem)Files[index]; + return (FileItem)ItemList[index]; } /// <summary> /// look for FileItem and launch it using the found object /// </summary> /// <param name="guiListItem"></param> - public virtual void LaunchFile(GUIListItem guiListItem) + public virtual void LaunchFile(BaseItem launchItem) { - if (guiListItem.MusicTag == null) return; - FileItem curFileItem = (FileItem)guiListItem.MusicTag; + FileItem curFileItem = (FileItem)launchItem; if (curFileItem == null) return; this.LaunchFile(curFileItem, true); @@ -623,15 +585,26 @@ int totalItems = 0; if (filePath != lastFilepath) { - Files.Load(AppID, filePath); - Filelinks.Load(AppID, filePath); + ItemLoad(AppID, filePath); + //Filelinks.Load(AppID, filePath); } - totalItems = totalItems + DisplayArrayList(filePath, this.Files, facadeView); - totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); + totalItems = totalItems + DisplayItemList(filePath, this.ItemList, facadeView); + // totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); lastFilepath = filePath; return totalItems; } + public override void OnClick(BaseItem baseItem,GUIPrograms guiPrograms) + { + ApplicationItem candidate = (ApplicationItem)baseItem; + guiPrograms.SaveItemIndex(guiPrograms.GetSelectedItemNo().ToString(), guiPrograms.lastApp, lastFilepath); + guiPrograms.lastApp = candidate; + guiPrograms.mapSettings.LastAppID = guiPrograms.lastApp.AppID; + guiPrograms.lastFilepath = guiPrograms.lastApp.DefaultFilepath(); + guiPrograms.ViewHandler.CurrentLevel = 0; + guiPrograms.lastApp.ViewHandler = guiPrograms.ViewHandler; + } + protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) { int totalItems = 0; @@ -643,89 +616,20 @@ { FileItem curFile = obj as FileItem; GUIListItem gli = new GUIListItem(curFile.Title); - gli.Label2 = curFile.Title2; + gli.MusicTag = curFile; gli.IsFolder = curFile.IsFolder; gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); facadeView.Add(gli); } - else if (obj is ProgramFilterItem) - { - ProgramFilterItem curFilter = obj as ProgramFilterItem; - GUIListItem gli = new GUIListItem(curFilter.Title); - gli.Label2 = curFilter.Title2; // some filters may have more than one text - gli.MusicTag = curFilter; - gli.IsFolder = true; - //ck - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - - - facadeView.Add(gli); - - } } return totalItems; } - void OnRetrieveCoverArt(GUIListItem guiListItem) - { - if (guiListItem.MusicTag == null) return; - FileItem curFileItem = (FileItem)guiListItem.MusicTag; - if (curFileItem == null) return; - - string imgFile = String.Empty; - - if (DatabaseHandler.useMPsThumbDirectory) - imgFile = curFileItem.Imagefile; - else - imgFile = MediaPortal.Util.Utils.GetCoverArtName( - Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), - Path.GetFileNameWithoutExtension(curFileItem.Filename) - ); - if (imgFile != "") - { - guiListItem.ThumbnailImage = curFileItem.Imagefile; - guiListItem.IconImageBig = curFileItem.Imagefile; - guiListItem.IconImage = curFileItem.Imagefile; - } - else - { - guiListItem.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - guiListItem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - guiListItem.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; - } - } - /* private void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip == null) return; - if (item == null) return; - if ((item.MusicTag != null) && (item.MusicTag is FileItem) && (!item.IsFolder)) - { - filmstrip.InfoImageFileName = item.ThumbnailImage; - } - else - { - filmstrip.InfoImageFileName = ""; - } - }*/ - private void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIPrograms.ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" - ) - { - // only show big thumb if there is really one.... - GUIPrograms.ThumbnailPath = item.ThumbnailImage; - } - } - public virtual bool FileEditorAllowed() { return true; // otherwise, override this in child class @@ -956,33 +860,18 @@ public virtual void LoadFiles() { + //linksAreLoaded = true; if (sqlDB == null) return; - - // load Files and fill Files-List<string> here! - if (fileList == null) - fileList = new FileItemList(sqlDB); - else - fileList.Clear(); - + lastFilepath = ""; - fileList.Load(AppID, ""); + ItemLoad(AppID, ""); filesAreLoaded = true; } - public virtual void LoadFileLinks() - { - if (sqlDB == null) return; - if (fileLinks == null) - fileLinks = new FilelinkItemList(sqlDB); - else - fileLinks.Clear(); - lastFilepath = ""; - fileLinks.Load(AppID, ""); - linksAreLoaded = true; - } + public void InsertOrUpdateSettings() { if (appID == -1) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -36,9 +36,9 @@ using GUIPrograms; using GUIPrograms.Database; -using GUIPrograms.FileItems; +using GUIPrograms.Items; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { /// <summary> /// Summary description for ApplicationItemDirectoryCache. @@ -153,11 +153,10 @@ FileItem curFile = new FileItem(sqlDB); curFile.FileID = -1; // to force an INSERT statement when writing the item curFile.AppID = this.AppID; - curFile.Title = fileInfo.Name; - curFile.Title = curFile.TitleNormalized; + curFile.Title = Path.GetFileNameWithoutExtension(fileInfo.Name); curFile.Filename = fileInfo.FullName; - curFile.Imagefile = GetThumbsFile(fileInfo, curFile.TitleNormalized); + curFile.Imagefile = GetThumbsFile(fileInfo, curFile.Title); // not imported properties => set default values curFile.LastTimeLaunched = DateTime.MinValue; @@ -178,8 +177,8 @@ private void DeleteOrphaned() { string TheFileName; - this.Files.Load(AppID, ""); - foreach (FileItem DBfile in this.Files) + ItemLoad(AppID, ""); + foreach (FileItem DBfile in ItemList) { TheFileName = DBfile.Filename; @@ -214,7 +213,7 @@ fileInDir = (FileInfo)allUnderLyingFiles[i]; - foreach (FileItem DBfile in this.Files) + foreach (FileItem DBfile in ItemList) { if (DBfile.Filename == fileInDir.FullName) { @@ -251,7 +250,7 @@ return; if (this.AppID < 0) return; - if (this.SourceType != ApplicationType.DIRCACHE) + if (this.SourceType != ItemType.DIRCACHE) return; if (mpGuiMode) { @@ -260,7 +259,7 @@ try { ValidExtensions = ValidExtensions.Replace(" ", ""); - this.Files.Load(AppID, ""); + ItemLoad(AppID, ""); string[] fileDirPaths = this.FileDirectory.Split(';'); ImportDirectory(fileDirPaths, mpGuiMode); @@ -278,9 +277,9 @@ override public string CurrentFilePath() { - if (Files.Filepath != "") + if (filePath != "") { - return Files.Filepath; + return filePath; } else { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -24,10 +24,10 @@ #endregion using SQLite.NET; - +using System; using GUIPrograms; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { /// <summary> /// Factory object that creates the matchin Application descendant class @@ -46,26 +46,147 @@ // nothing to create...... } - public ApplicationItem GetApplicationItem(SQLiteClient sqlDB, ApplicationType sourceType) + public BaseItem GetApplicationItem(SQLiteClient sqlDB, ItemType sourceType,SQLiteResultSet results, int iRecord) { - ApplicationItem applicationItem = null; + BaseItem item = null; switch (sourceType) { - case ApplicationType.DIRCACHE: - applicationItem = new ApplicationItemDirectoryCache(sqlDB); + case ItemType.DIRCACHE: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.DIRCACHE); break; - case ApplicationType.MAMEDIRECT: - applicationItem = new ApplicationItemMame(sqlDB); + case ItemType.MAMEDIRECT: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.MAMEDIRECT); break; - case ApplicationType.GROUPER: - applicationItem = new ApplicationItemGrouper(sqlDB); + case ItemType.GROUPER: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.GROUPER); break; - case ApplicationType.GAMEBASE: - applicationItem = new ApplicationItemGameBase(sqlDB); + case ItemType.GAMEBASE: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.GAMEBASE); break; + case ItemType.FILEITEM: + item = FileItemFactory(sqlDB,results, iRecord); + break; + case ItemType.FILELINKITEM: + item = FilelinkItemFactory(sqlDB, results, iRecord); + break; + case ItemType.FILTERITEM: + item = FilterItemFactory(sqlDB, results, iRecord); + break; } - return applicationItem; + return item; } + + private ApplicationItem AppItemFactory(SQLiteClient sqldb, SQLiteResultSet results, int recordIndex, ItemType sourceType) + { + ApplicationItem item = null;//= (ApplicationItem)appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"), null, 0); + + switch (sourceType) + { + case ItemType.DIRCACHE: + item = new ApplicationItemDirectoryCache(sqldb); + break; + case ItemType.MAMEDIRECT: + item = new ApplicationItemMame(sqldb); + break; + case ItemType.GROUPER: + item = new ApplicationItemGrouper(sqldb); + break; + case ItemType.GAMEBASE: + item = new ApplicationItemGameBase(sqldb); + break; + } + + //fetches from db,, + if (results != null) + { + item.Enabled = ProgramUtils.GetBool(results, recordIndex, "enabled"); + item.AppID = ProgramUtils.GetIntDef(results, recordIndex, "applicationId", -1); + item.FatherID = ProgramUtils.GetIntDef(results, recordIndex, "fatherNodeId", -1); + item.Title = ProgramUtils.Get(results, recordIndex, "title"); + item.Filename = ProgramUtils.Get(results, recordIndex, "filename"); + item.Arguments = ProgramUtils.Get(results, recordIndex, "arguments"); + item.WindowStyle = ProgramUtils.GetProcessWindowStyle(results, recordIndex, "windowstyle"); + item.StartupDir = ProgramUtils.Get(results, recordIndex, "startupdir"); + item.UseShellExecute = ProgramUtils.GetBool(results, recordIndex, "useShellExecute"); + item.UseQuotes = ProgramUtils.GetBool(results, recordIndex, "useQuotes"); + item.SourceType = ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"); + item.Source = ProgramUtils.Get(results, recordIndex, "source"); + item.Imagefile = ProgramUtils.Get(results, recordIndex, "imagefile"); + item.FileDirectory = ProgramUtils.Get(results, recordIndex, "filedirectory"); + item.ImageDirectory = ProgramUtils.Get(results, recordIndex, "imagedirectory"); + item.ValidExtensions = ProgramUtils.Get(results, recordIndex, "validextensions"); + item.ImportValidImagesOnly = ProgramUtils.GetBool(results, recordIndex, "importvalidimagesonly"); + item.Position = ProgramUtils.GetIntDef(results, recordIndex, "iposition", 0); + item.RefreshGUIAllowed = ProgramUtils.GetBool(results, recordIndex, "refreshGUIAllowed"); + item.SystemDefault = ProgramUtils.Get(results, recordIndex, "systemdefault"); + item.WaitForExit = ProgramUtils.GetBool(results, recordIndex, "waitforexit"); + item.PreLaunch = ProgramUtils.Get(results, recordIndex, "preLaunch"); + item.PostLaunch = ProgramUtils.Get(results, recordIndex, "postLaunch"); + } + return item; + } + + private FileItem FileItemFactory(SQLiteClient sqlDB,SQLiteResultSet results, int iRecord) + { + FileItem newFile = new FileItem(sqlDB); + newFile.FileID = ProgramUtils.GetIntDef(results, iRecord, "fileid", -1); + newFile.AppID = ProgramUtils.GetIntDef(results, iRecord, "applicationId", -1); + newFile.Title = ProgramUtils.Get(results, iRecord, "title"); + newFile.Filename = ProgramUtils.Get(results, iRecord, "filename"); + newFile.Imagefile = ProgramUtils.Get(results, iRecord, "imagefile"); + newFile.MainGenre = ProgramUtils.Get(results, iRecord, "mainGenre"); + newFile.MainGenreId = ProgramUtils.GetIntDef(results, iRecord, "mainGenreId", 1); + newFile.SubGenre = ProgramUtils.Get(results, iRecord, "subGenre"); + newFile.SubGenreId = ProgramUtils.GetIntDef(results, iRecord, "subGenreId", 1); + newFile.Country = ProgramUtils.Get(results, iRecord, "country"); + newFile.ManufacturerId = ProgramUtils.GetIntDef(results, iRecord, "manufacturerId", 1); + newFile.Manufacturer = ProgramUtils.Get(results, iRecord, "manufacturer"); + newFile.Year = ProgramUtils.GetIntDef(results, iRecord, "year", -1); + newFile.Rating = ProgramUtils.GetIntDef(results, iRecord, "rating", 5); + newFile.Overview = ProgramUtils.Get(results, iRecord, "overview"); + newFile.Platform = ProgramUtils.Get(results, iRecord, "platform"); + newFile.PlatformId = ProgramUtils.GetIntDef(results, iRecord, "platformId", 1); + + newFile.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); + newFile.CategoryData = ProgramUtils.Get(results, iRecord, "categorydata"); + newFile.GameInfoURL = ProgramUtils.Get(results, iRecord, "gameInfoUrl"); + return newFile; + } + + private FilterItem FilterItemFactory(SQLiteClient sqlDB,SQLiteResultSet results, int iRecord) + { + FilterItem filterItem = new FilterItem(sqlDB); + filterItem.Title = ProgramUtils.Get(results, iRecord, "title"); + // newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); + //newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); ; + return filterItem; + } + + + private FilelinkItem FilelinkItemFactory(SQLiteClient sqlDB, SQLiteResultSet results, int iRecord) + { + FilelinkItem newLink = new FilelinkItem(sqlDB); + newLink.FileID = ProgramUtils.GetIntDef(results, iRecord, "fileId", -1); + newLink.AppID = ProgramUtils.GetIntDef(results, iRecord, "grouperAppId", -1); + newLink.TargetAppID = ProgramUtils.GetIntDef(results, iRecord, "targetAppId", -1); + newLink.Title = ProgramUtils.Get(results, iRecord, "title"); + newLink.Filename = ProgramUtils.Get(results, iRecord, "filename"); + newLink.Imagefile = ProgramUtils.Get(results, iRecord, "imagefile"); + newLink.MainGenre = ProgramUtils.Get(results, iRecord, "mainGenre"); + newLink.SubGenre = ProgramUtils.Get(results, iRecord, "subGenre"); + newLink.Country = ProgramUtils.Get(results, iRecord, "country"); + newLink.ManufacturerId = ProgramUtils.GetIntDef(results, iRecord, "manufacturerId", 1); + newLink.Manufacturer = ProgramUtils.Get(results, iRecord, "manufacturer"); + newLink.Year = ProgramUtils.GetIntDef(results, iRecord, "year", -1); + newLink.Rating = ProgramUtils.GetIntDef(results, iRecord, "rating", 5); + newLink.Overview = ProgramUtils.Get(results, iRecord, "overview"); + newLink.Platform = ProgramUtils.Get(results, iRecord, "platform"); + newLink.PlatformId = ProgramUtils.GetIntDef(results, iRecord, "platformId", 1); + newLink.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); + newLink.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); + newLink.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); + return newLink; + } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -34,7 +34,7 @@ using GUIPrograms.Database; using GUIPrograms.Imports; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { /// <summary> /// Summary description for ApplicationItemGameBase. @@ -68,7 +68,7 @@ return; if (this.AppID < 0) return; - if ((this.SourceType != ApplicationType.GAMEBASE) || (Source == "") || (!File.Exists(Source))) + if ((this.SourceType != ItemType.GAMEBASE) || (Source == "") || (!File.Exists(Source))) return; // show progress dialog and run the import... if (bGUIMode) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -27,9 +27,9 @@ using SQLite.NET; using GUIPrograms.Database; -using GUIPrograms.FileItems; +using GUIPrograms.Items; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { /// <summary> /// Summary description for appFilesEdit. @@ -58,7 +58,111 @@ { return false; // links cannot be links again..... :) } + public override void LoadFiles() + { + if (sqlDB == null) return; + lastFilepath = ""; + ItemLoad(AppID, ""); + linksAreLoaded = true; + } + + + public override void ItemLoad(int appID, string pathSubfolders) +{ + string strSQL = ""; + // filePath = strPath; + // applicationItem. + // SPECIAL: the current application IS NOT the application with the launchinfo! + strSQL = @" + + SELECT + fi.applicationId AS targetAppId, + fi.grouperAppId AS grouperAppId, + f.fileId AS fileId, + title, + upperTitle, + f.filename AS filename, + imagefile, + tblMaingenre.genre as mainGenre, + mainGenreId, + tblSubgenre.genre as subGenre, + country, + f.manufacturerId, + manufacturer, + year, + rating, + overview, + platform, + f.platformId, + import_flag, + lastTimeLaunched, + launchCount, + isFolder + + FROM + tblFileItem f, + tblFilterItem fi, + tblGenre tblMainGenre, + tblGenre tblSubGenre, + tblManufacturer, + tblPlatform + + WHERE + f.fileId = fi.fileId + AND + tblMainGenre.genreId = f.mainGenreId + AND + tblSubGenre.genreId = f.subGenreId + AND + tblManufacturer.manufacturerId = f.manufacturerId + AND + tblPlatform.platformId = f.platformId + AND + grouperAppId = " + appID + @" + + ORDER BY f.fileName, uppertitle + + "; + + //Debugger.Launch(); + if (sqlDB == null) + return; + + try + { + ItemList.Clear(); + SQLiteResultSet results; + filePath = pathSubfolders; + results = sqlDB.Execute(strSQL); + if (results.Rows.Count == 0) + return; + + + for (int curRow = 0; curRow < results.Rows.Count; curRow++) + { + if (ViewHandler.IsFilterQuery) + { + FilterItem curFile = (FilterItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, ItemType.FILTERITEM, results, curRow); + + ItemList.Add(curFile); + } + else + { + FilelinkItem curFile = (FilelinkItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, ItemType.FILELINKITEM, results, curRow); + ItemList.Add(curFile); + } + } + + } + catch (SQLiteException ex) + { + Log.Info("Filedatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } +} + + + public override void LaunchFile(FileItem curFile, bool MPGUIMode) { if (curFile is FilelinkItem) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -28,11 +28,11 @@ using GUIPrograms; using GUIPrograms.Database; -using GUIPrograms.FileItems; +using GUIPrograms.Items; using MediaPortal.GUI.Library; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { /// <summary> /// Summary description for ApplicationItemList. @@ -53,36 +53,6 @@ LoadAll(); } - static private ApplicationItem DBGetApp(SQLiteResultSet results, int recordIndex) - { - ApplicationItem newApp = appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType")); - newApp.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); - newApp.Enabled = ProgramUtils.GetBool(results, recordIndex, "enabled"); - newApp.AppID = ProgramUtils.GetIntDef(results, recordIndex, "applicationId", -1); - newApp.FatherID = ProgramUtils.GetIntDef(results, recordIndex, "fatherNodeId", -1); - newApp.Title = ProgramUtils.Get(results, recordIndex, "title"); - newApp.Filename = ProgramUtils.Get(results, recordIndex, "filename"); - newApp.Arguments = ProgramUtils.Get(results, recordIndex, "arguments"); - newApp.WindowStyle = ProgramUtils.GetProcessWindowStyle(results, recordIndex, "windowstyle"); - newApp.StartupDir = ProgramUtils.Get(results, recordIndex, "startupdir"); - newApp.UseShellExecute = ProgramUtils.GetBool(results, recordIndex, "useShellExecute"); - newApp.UseQuotes = ProgramUtils.GetBool(results, recordIndex, "useQuotes"); - newApp.SourceType = ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"); - newApp.Source = ProgramUtils.Get(results, recordIndex, "source"); - newApp.Imagefile = ProgramUtils.Get(results, recordIndex, "imagefile"); - newApp.FileDirectory = ProgramUtils.Get(results, recordIndex, "filedirectory"); - newApp.ImageDirectory = ProgramUtils.Get(results, recordIndex, "imagedirectory"); - newApp.ValidExtensions = ProgramUtils.Get(results, recordIndex, "validextensions"); - newApp.ImportValidImagesOnly = ProgramUtils.GetBool(results, recordIndex, "importvalidimagesonly"); - newApp.Position = ProgramUtils.GetIntDef(results, recordIndex, "iposition", 0); - newApp.RefreshGUIAllowed = ProgramUtils.GetBool(results, recordIndex, "refreshGUIAllowed"); - newApp.SystemDefault = ProgramUtils.Get(results, recordIndex, "systemdefault"); - newApp.WaitForExit = ProgramUtils.GetBool(results, recordIndex, "waitforexit"); - newApp.PreLaunch = ProgramUtils.Get(results, recordIndex, "preLaunch"); - newApp.PostLaunch = ProgramUtils.Get(results, recordIndex, "postLaunch"); - return newApp; - } - public List<ApplicationItem> AppsOfFatherID(int FatherID) { List<ApplicationItem> applicationItemList = new List<ApplicationItem>(); @@ -123,7 +93,7 @@ public ApplicationItem CloneAppItem(ApplicationItem sourceApp) { - ApplicationItem newApp = appFactory.GetApplicationItem(sqlDB, sourceApp.SourceType); + ApplicationItem newApp = (ApplicationItem)appFactory.GetApplicationItem(sqlDB, sourceApp.SourceType,null,0); newApp.Assign(sourceApp); newApp.AppID = -1; // to force a sql INSERT when written Add(newApp); @@ -165,7 +135,8 @@ return; for (int row = 0; row < results.Rows.Count; row++) { - ApplicationItem currentApplicationItem = DBGetApp(results, row); + ApplicationItem currentApplicationItem = (ApplicationItem) ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB,ProgramUtils.GetSourceType(results, row, "applicationItemType"),results, row ); + currentApplicationItem.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); Add(currentApplicationItem); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs 2007-07-20 14:43:12 UTC (rev 748) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -34,7 +34,7 @@ using GUIPrograms; using GUIPrograms.Imports; -namespace GUIPrograms.ApplicationItems +namespace GUIPrograms.Items { /// <summary> /// Summary description for ApplicationItemMame. @@ -85,7 +85,7 @@ return; if (this.AppID < 0) return; - if (this.SourceType != ApplicationType.MAMEDIRECT) + if (this.SourceType != ItemType.MAMEDIRECT) return; if (!File.Exists(this.Filename)) // no "mame.exe" return; Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/BaseItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/BaseItem.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/BaseItem.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -0,0 +1,165 @@ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Xml; +using SQLite.NET; + +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Ripper; +using MediaPortal.Util; + +using GUIPrograms; +using GUIPrograms.Database; +using GUIPrograms.Items; + +namespace GUIPrograms.Items +{ + public abstract class BaseItem + { + + public List<BaseItem> ItemList = new List<BaseItem>(); + protected static SQLiteClient sqlDB = null; + public ProgramViewHandler ViewHandler = ProgramViewHandler.Instance; + public string filePath = ""; + //s protected FilelinkItemList fileLinks = null; + + public BaseItem(SQLiteClient initSqlDB) + { + // constructor: save SQLiteDB object + sqlDB = initSqlDB; + //hackisch until?? + + + + } + + public virtual void OnClick(BaseItem baseItem, GUIPrograms guiPrograms) + { + //override + } + public int DisplayItemList(string filePath, List<BaseItem> dbItems, GUIFacadeControl facadeView) + { + int totalItems = 0; + + foreach (BaseItem baseItem in dbItems) + { + totalItems = totalItems + 1; + + if (baseItem is FileItem) + { + FileItem curFile = baseItem as FileItem; + GUIListItem gli = new GUIListItem(curFile.Title); + + gli.MusicTag = curFile; + gli.IsFolder = curFile.IsFolder; + gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); + } + if (baseItem is FilterItem) + { + FilterItem curFile = baseItem as FilterItem; + GUIListItem gli = new GUIListItem(curFile.Title); + gli.MusicTag = curFile; + gli.IsFolder = false; + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); + } + } + return totalItems; + } + + protected void OnRetrieveCoverArt(GUIListItem guiListItem) + { + if (guiListItem.MusicTag == null) return; + FileItem curFileItem = (FileItem)guiListItem.MusicTag; + if (curFileItem == null) return; + + string imgFile = String.Empty; + + if (DatabaseHandler.useMPsThumbDirectory) + imgFile = curFileItem.Imagefile; + else + imgFile = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + curFileItem.Title), + Path.GetFileNameWithoutExtension(curFileItem.Filename) + ); + + if (imgFile != "") + { + guiListItem.ThumbnailImage = curFileItem.Imagefile; + guiListItem.IconImageBig = curFileItem.Imagefile; + guiListItem.IconImage = curFileItem.Imagefile; + } + else + { + guiListItem.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + guiListItem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + guiListItem.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; + } + } + + protected void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIPrograms.ThumbnailPath = ""; + if (item.ThumbnailImage != "" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" + ) + { + // only show big thumb if there is really one.... + GUIPrograms.ThumbnailPath = item.ThumbnailImage; + } + } + + public virtual void ItemLoad(int appID, string pathSubfolders) + { + //Debugger.Launch(); + if (sqlDB == null) + return; + + try + { + ItemList.Clear(); + SQLiteResultSet results; + filePath = pathSubfolders; + string sqlQuery = ViewHandler.BuildQuery(appID, pathSubfolders); + // Log.Info("dw \n{0}", sqlQuery); + results = sqlDB.Execute(sqlQuery); + if (results.Rows.Count == 0) + return; + + + for (int curRow = 0; curRow < results.Rows.Count; curRow++) + { + if (ViewHandler.IsFilterQuery) + { + FilterItem curFile = (FilterItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, ItemType.FILTERITEM, results, curRow); + ItemList.Add(curFile); + } + else + { + FileItem curFile =(FileItem) ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB,ItemType.FILEITEM,results, curRow); + ItemList.Add(curFile); + } + } + + } + catch (SQLiteException ex) + { + Log.Info("Filedatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + + + } +} + + + + Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FileItem.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/FileItem.cs 2007-07-22 16:03:05 UTC (rev 749) @@ -0,0 +1,856 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using SQLite.NET; + +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; + +using GUIPrograms; +using GUIPrograms.Database; +using GUIPrograms.Items; +using GUIPrograms.Imports; + +namespace GUIPrograms.Items +{ + public class FileItem : BaseItem + { + #region Variables + + int fileID; + int appID; + string title; + string filename; + string imagefile; + string mainGenre; + int mainGenreId; + int subGenreId; + string subGenre; + string country; + string manufacturer; + int manufacturerId; + int year; + int rating; + string overview; + string platform; + int platformId; + DateTime lastTimeLaunched; + int launchCount; + string categoryData; + bool isFolder; + string gameInfoURL; + + List<FileItemInfo> fileItemInfoList = null; + FileItemInfo fileItemInfoFavourite = null; + + #endregion + + #region Constructor + + public FileItem(SQLiteClient initSqlDB) : base(initSqlDB) + { + // constructor: save SQLiteDB object + + Clear(); + } + + #endregion + + public virtual void Clear() + { + fileID = -1; + appID = -1; + title = ""; + filename = ""; + imagefile = ""; + mainGenreId = 1; + subGenreId = 1; + country = ""; + manufacturer = ""; + manufacturerId = 1; + year = -1; + rating = -1; + overview = ""; + platform = ""; + platformId = 1; + isFolder = false; + lastTimeLaunched = DateTime.MinValue; + launchCount = 0; + categoryData = ""; + gameInfoURL = string.Empty; + } + + public override void OnClick(BaseItem baseItem, GUIPrograms guiPrograms) + { + guiPrograms.selectedItemIndex = guiPrograms.GetSelectedItemNo(); + + if (guiPrograms.lastApp != null) + { + guiPrograms.mapSettings.LastAppID = guiPrograms.lastApp.AppID; + guiPrograms.lastFilepath = guiPrograms.lastApp.DefaultFilepath(); + guiPrograms.lastApp.LaunchFile(baseItem); + } + } + + #region Properties + + public int FileID + { + get + { + return fileID; + } + set + { + fileID = value; + } + } + public int AppID + { + get + { + return appID; + } + set + { + appID = value; + } + } + + public string Title + { + get + { + return title; + } + set + { + title = value; + } + } + + public string Filename + { + get + { + return filename; + } + set + { + filename = value; + } + } + + public string Imagefile + { + get + { + return imagefile; + } + set + { + imagefile = value; + } + } + + public string MainGenre + { + get + { + return mainGenre; + } + set + { + mainGenre = value; + } + } + + public int MainGenreId + { + get + { + return mainGenreId; + } + set + { + mainGenreId = value; + } + } + public int SubGenreId + { + get + { + return subGenreId; + } + set + { + subGenreId = value; + } + } + public string SubGenre + { + get + { + return subGenre; + } + set + { + subGenre = value; + } + } + public string Country + { + get + { + return country; + } + set + { + country = value; + } + } + public string Manufacturer + { + get + { + return manufacturer; + } + set + { + manufacturer = value; + } + } + public int ManufacturerId + { + get + { + return manufacturerId; + } + set + { + manufacturerId = value; + } + } + + public int Year + { + get + { + return year; + } + set + { + year = value; + } + } + public int Rating + { + get + { + return rating; + } + set + { + rating = value; + } + } + public string Overview + { + get + { + return overview; + } + set + { + overview = value; + } + } + public string Platform + { + get + { + return platform; + } + set + { + platform = value; + } + } + public int PlatformId + { + get + { + return platformId; + } + set + { + platformId = value; + } + } + public DateTime LastTimeLaunched + { + get + { + return lastTimeLaunched; + } + set + { + lastTimeLaunched = value; + } + } + public int LaunchCount + { + get + { + return launchCount; + } + set + { + launchCount = value; + } + } + + public string CategoryData + { + get + { + return categoryData; + } + set + { + categoryData = value; + } + } + public bool IsFolder + { + get + { + return isFolder; + } + set + { + isFolder = value; + } + } + public string GameInfoURL + { + get { return gameInfoURL; } + set { gameInfoURL = value; } + } + + + public List<FileItemInfo> FileInfoList + { + get + { + return fileItemInfoList; + } + } + public FileItemInfo FileInfoFavourite + { + get + { + return fileItemInfoFavourite; + } + set + { + fileItemInfoFavourite = value; + } + } + + #endregion + + private int CountQuotes(string strVal) + { + int at = 0; + int start = 0; + int nRes = 0; + while ((start < strVal.Length) && (at > -1)) + { + at = strVal.IndexOf("\"", start); + if (at == -1) + break; + nRes = nRes + 1; + start = at + 1; + } + return nRes; + } + + 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);*/ + //((GUIPropertyManager.SetProperty("#director", Director); + GUIPropertyManager.SetProperty("#maingenre", MainGenre); + GUIPropertyManager.SetProperty("#subgenre", SubGenre); + GUIPropertyManager.SetProperty("#manufacturer", Manufacturer); + GUIPropertyManager.SetProperty("#fname", Filename); + // GUIPropertyManager.SetProperty("#imdbnumber", IMDBNumber); + // GUIPropertyManager.SetProperty("#file", File); + GUIPropertyManager.SetProperty("#plot", Overview); + // GUIPropertyManager.SetProperty("#plotoutline", PlotOutline); + GUIPropertyManager.SetProperty("#rating", Rating.ToString()); + //GUIPropertyManager.SetProperty("#tagline", TagLine); + // GUIPropertyManager.SetProperty("#votes", Votes); + // GUIPropertyManager.SetProperty("#credits", WritingCredits); + GUIPropertyManager.SetProperty("#thumb", Imagefile); + GUIPropertyManager.SetProperty("#title", Title); + GUIPropertyManager.SetProperty("#year", Year.ToString()); + GUIPropertyManager.SetProperty("#platform", Platform); + /*GUIPropertyManager.SetProperty("#runtime", RunTime.ToString()); + GUIPropertyManager.SetProperty("#mpaarating", MPARating.ToString());*/ + /* string strValue = "no"; + if (Watched > 0) strValue = "yes"; + GUIPropertyManager.SetProperty("#iswatched", strValue);*/ + } + + private void Insert() + { + try + { + string strSQL = String.Format( + @" + INSERT INTO + tblFileItem + ( + fileid, + applicationId, + title, + filename, + imagefile, + mainGenreId, + subGenreId, + country, + manufacturerId, + year, + rating, + overview, + platformId, + lastTimeLaunched, + launchcount, + isfolder, + uppertitle, + categorydata, + gameInfoUrl + ) + + VALUES + ( + null, + '" + AppID + @"', + '" + ProgramUtils.Encode(Title) + @"', + '" + ProgramUtils.Encode(Filename) + @"', + '" + ProgramUtils.Encode(Imagefile) + @"', + " + MainGenreId + @", + '" + SubGenreId + @"', + '" + Country + @"', + '" + ManufacturerId + @"', + '" + Year.ToString() + @"', + '" + Rating + @"', + '" + ProgramUtils.Encode(Overview) + @"', + '" + PlatformId + @"', + '" + LastTimeLaunched.ToString() + @"', + '" + LaunchCount.ToString() + @"', + '" + ProgramUtils.BooleanToStr(IsFolder) + @"', + '" + ProgramUtils.Encode(Title.ToUpper()) + @"', + '" + ProgramUtils.Encode(CategoryData)) + @"', + '" + ProgramUtils.Encode(GameInfoURL) + @"' + )"; + // Log.Info("dw sql\n{0}", strSQL); + + sqlDB.Execute(strSQL); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + + + private void Update() + { + string strYear = ""; + if (Year > 0) + { + strYear = String.Format("{0}", Year); + } + else + { + strYear = "-1"; + } + + + + try + { + string strSQL = String.Format( + "UPDATE tblFileItem SET title = '{1}', filename = '{2}', imagefile = '{3}', mainGenreId = '{4}', subGenreId = '{5}', country = '{6}', manufacturerId = '{7}', year = '{8}', rating = '{9}', overview = '{10}', platformId = '{11}', uppertitle = '{12}', categorydata = '{13}', gameInfoURL = '" + ProgramUtils.Encode(GameInfoURL) + "' where fileid = {0}", FileID, ProgramUtils.Encode(Title), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Imagefile), MainGenreId, SubGenreId, ProgramUtils.Encode(Country), ManufacturerId, strYear, Rating, ProgramUtils.Encode(Overview), PlatformId, ProgramUtils.Encode(Title.ToUpper()), ProgramUtils.Encode(CategoryData)); + sqlDB.Execute(strSQL); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + public void UpdateLaunchInfo() + { + try + { + LastTimeLaunched = DateTime.Now; + LaunchCount = LaunchCount + 1; + string strSQL = String.Format("UPDATE tblFileItem SET lastTimeLaunched = '{0}', launchcount = {1} WHERE fileid = {2}", LastTimeLaunched, LaunchCount, FileID); + sqlDB.Execute(strSQL); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + public virtual void Write() + { + if (fileID == -1) + { + Insert(); + } + else + { + Update(); + } + } + + public virtual void Delete() + { + if (this.FileID >= 0) + { + try + { + string strSQL1 = String.Format("DELETE FROM tblFilterItem WHERE fileid = {0}", this.FileID); + string strSQL2 = String.Format("DELETE FROM tblFileItem WHERE fileid = {0}", this.FileID); + sqlDB.Execute(strSQL1); + sqlDB.Execute(strSQL2); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + } + + + + public bool FindFileInfo(ScraperType ScraperType) + { + int iRetries = 0; + bool bSuccess = false; + switch (ScraperType) + { + case ScraperType.ALLGAME: + { + AllGameScraper scraper = new AllGameScraper(); + // string strTitle = TitleNormalized; + while ((!bSuccess) && (iRetries < 5)) + { + // brute force! Try five times.... sometimes I get + // a ScrapeWebPage false result... don't know why! + bSuccess = scraper.FindGameinfo(Title); + if (!bSuccess) + { + iRetries++; + } + } + fileItemInfoList = scraper.GameList; + fileItemInfoFavourite = null; + } + break; + } + return bSuccess; + } + + public bool FindFileInfoDetail(ApplicationItem curApp, FileItemInfo curInfo, ScraperType scraperType, ScraperSaveType saveType) + { + int iRetries = 0; + bool bSuccess = false; + switch (scraperType) + { + case ScraperType.ALLGAME: + { + AllGameScraper scraper = new AllGameScraper(); + while ((!bSuccess) && (iRetries < 5)) + { + // brute force! Try five times.... sometimes I get + // a ScrapeWebPage false result... don't know why! + bSuccess = scraper.FindGameinfoDetail(curApp, this, curInfo, saveType); + if (!bSuccess) + { + iRetries++; + } + } + } + break; + } + return bSuccess; + } + + public void ToFileInfoFavourite() + { + FileInfoFavourite = new FileItemInfo(); + + FileInfoFavourite.Title = this.Title; + //FileInfoFavourite.GameURL = this.mGameURL; + FileInfoFavourite.MainGenreId = this.MainGenreId; + FileInfoFavourite.SubGenreId = this.SubGenreId; + FileInfoFavourite.ManufacturerId = this.ManufacturerId; + FileInfoFavourite.Year = this.Year.ToString(); + FileInfoFavourite.Overview = this.Overview; + FileInfoFavourite.Rating = this.Rating; + FileInfoFavourite.Platform = this.Platform; + FileInfoFavourite.PlatformId = this.PlatformId; + } + + public void SaveFromFileInfoFavourite() + { + if (this.FileInfoFavourite != null) + { + + + int LexiconId = DatabaseHandler.LexiconDataExists("tblGenre", "genre", FileInfoFavourite.MainGenre); + this.MainGenreId = LexiconId; + + LexiconId = DatabaseHandler.LexiconDataExists("tblGenre", "genre", FileInfoFavourite.SubGenre); + this.SubGenreId = LexiconId; + + LexiconId = DatabaseHandler.LexiconDataExists("tblManufacturer", "manufacturer", FileInfoFavourite.Manufacturer); + this.ManufacturerId = LexiconId; + + LexiconId = DatabaseHandler.LexiconDataExists("tblPlatform", "platform", FileInfoFavourite.Platform); + this.PlatformId = LexiconId; + + // DON'T overwrite title! this.Title = FileInfoFavourite.Title; + + this.MainGenre = FileInfoFavourite.MainGenre; + this.SubGenre = FileInfoFavourite.SubGenre; + this.Platform = FileInfoFavourite.Platform; + + this.Manufacturer = FileInfoFavourite.Manufacturer; + this.Year = ProgramUtils.StringToInteger(FileInfoFavourite.Year, -1); + this.Overview = FileInfoFavourite.Overview; + this.Rating = FileInfoFavourite.Rating; + + this.GameInfoURL = FileInfoFavourite.GameURL; + this.Write(); + } + } + + public string GetNewValidImageFile(ApplicationItem curApp, string strExtension) + { + if (curApp == null) + return ""; + if (curApp.imageDirs == null) + return ""; + if (curApp.imageDirs.Length == 0) + return ""; + if ((this.Imagefile == "") && (this.Filename == "")) + return ""; + + string strFolder = ""; + string strFileName = ""; + string strCand = ""; + int iImgIndex = -1; + bool bFound = false; + bool isWriteable = false; + + + //check that we have read access to any of the imagefolders + int i = 0; + while (!isWriteable && i < curApp.imageDirs.Length) + { + FileStream fs = null; + + try + { + fs = File.Create(curApp.imageDirs[i] + "... [truncated message content] |
From: <nor...@us...> - 2007-07-22 18:44:57
|
Revision: 750 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=750&view=rev Author: northern_sky Date: 2007-07-22 11:44:53 -0700 (Sun, 22 Jul 2007) Log Message: ----------- rem some old items Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs 2007-07-22 16:03:05 UTC (rev 749) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs 2007-07-22 18:44:53 UTC (rev 750) @@ -1,134 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; - -namespace GUIPrograms -{ - /// <summary> - /// Summary description for ProgramFilterItem. - /// </summary> - public class ProgramFilterItem - { - string title = ""; - string title2 = ""; - string genre = ""; - string country = ""; - string manufacturer = ""; - int year = -1; - int rating = 5; - - public ProgramFilterItem() - { - // - // TODO: Add constructor logic here - // - } - - public string Title - { - get - { - return title; - } - set - { - title = value; - } - } - - public string Title2 - { - get - { - return title2; - } - set - { - title2 = value; - } - } - - public string Genre - { - get - { - return genre; - } - set - { - genre = value; - } - } - - public string Country - { - get - { - return country; - } - set - { - country = value; - } - } - - public string Manufacturer - { - get - { - return manufacturer; - } - set - { - manufacturer = value; - } - } - - public int Year - { - get - { - return year; - } - set - { - year = value; - } - } - - public int Rating - { - get - { - return rating; - } - set - { - rating = value; - } - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-07-22 19:06:57
|
Revision: 752 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=752&view=rev Author: northern_sky Date: 2007-07-22 12:06:56 -0700 (Sun, 22 Jul 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ 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/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilterItem.cs Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-07-22 19:06:56 UTC (rev 752) @@ -0,0 +1,1149 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Xml; +using SQLite.NET; + +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Ripper; +using MediaPortal.Util; + +using GUIPrograms; +using GUIPrograms.Database; +using GUIPrograms.Items; + + +namespace GUIPrograms.Items +{ + public class ApplicationItem : BaseItem + { + #region Variables + + + + int appID; + int fatherID; + string title; + string filename; + + string arguments; + ProcessWindowStyle windowStyle; + string startupDir; + bool useQuotes; + bool useShellExecute; + bool waitForExit; + string preLaunch; + string postLaunch; + + bool enabled; + int appPosition; + + string currentView = ""; + + public bool filesAreLoaded = false; // load on demand.... + // protected FileItemList fileList = null; + + public bool linksAreLoaded = false; // load on demand.... + + + + bool importMamePlaychoice10 = false; + bool importMameMahjong = false; + bool refreshGUIAllowed = false; + + + + + + // more variables, maybe need some renaming or anything else + Process proc; + ItemType sourceType; + string sourceFile; + string imageFile; + string imageDirectories; // in one string for sqlite db field + public string[] imageDirs; // imageDirectories splitted + string fileDirectory; + string validExtensions; + bool importValidImagesOnly; + + string systemDefault; + + string launchErrorMsg; + // two magic image-slideshow counters + int thumbIndex = 0; + int thumbFolderIndex = -1; + + protected string lastFilepath = ""; // cached path + + //private DatabaseSorter dbPc = new DatabaseSorter(); + //private ProgramSort dbPc = new ProgramSort(ProgramSort.SortMethod.Name, true); + + #endregion + + #region Properties + // Helper Routines + + public SQLiteClient db + { + get { return sqlDB; } + } + + public int AppID + { + get { return appID; } + set { appID = value; } + } + public int FatherID + { + get { return fatherID; } + set { fatherID = value; } + } + public string Title + { + get { return title; } + set { title = value; } + } + + public string Filename + { + get { return filename; } + set { filename = value; } + } + public string Imagefile + { + get + { + if (File.Exists(imageFile)) + return imageFile; + else + return MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt"), + this.Title + ); + } + set { imageFile = value; } + } + + public string Arguments + { + get { return arguments; } + set { arguments = value; } + } + public ProcessWindowStyle WindowStyle + { + get { return windowStyle; } + set { windowStyle = value; } + } + public string StartupDir + { + get { return startupDir; } + set { startupDir = value; } + } + public bool UseQuotes + { + get { return useQuotes; } + set { useQuotes = value; } + } + public bool UseShellExecute + { + get { return useShellExecute; } + set { useShellExecute = value; } + } + public bool WaitForExit + { + get { return waitForExit; } + set { waitForExit = value; } + } + public string PreLaunch + { + get { return preLaunch; } + set { preLaunch = value; } + } + public string PostLaunch + { + get { return postLaunch; } + set { postLaunch = value; } + } + + public bool Enabled + { + get { return enabled; } + set { enabled = value; } + } + + public virtual bool RefreshGUIAllowed + { + get { return refreshGUIAllowed; } + set { refreshGUIAllowed = value; } + } + + public int Position + { + get { return appPosition; } + set { appPosition = value; } + } + + + public string CurrentView + { + get { return currentView; } + 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 + { + get { return fileDirectory; } + set { fileDirectory = value; } + } + public string ImageDirectory + { + get { return imageDirectories; } + set { SetImageDirectory(value); } + } + private void SetImageDirectory(string value) + { + imageDirectories = value; + imageDirs = imageDirectories.Split(';'); + for (int i = 0; i < imageDirs.Length; i++) + { + imageDirs[i] = imageDirs[i].Trim(); + // hack the \n away.... + // imageDirs[i] = imageDirs[i].TrimStart('\n'); + // hack trailing backslashes away + imageDirs[i] = imageDirs[i].TrimEnd('\\'); + } + } + public string Source + { + get { return sourceFile; } + set { sourceFile = value; } + } + public ItemType SourceType + { + get { return sourceType; } + set { sourceType = value; } + } + public string ValidExtensions + { + get { return validExtensions; } + set { validExtensions = value; } + } + public bool ImportValidImagesOnly + { + get { return importValidImagesOnly; } + set { importValidImagesOnly = value; } + } + + public string SystemDefault + { + get { return systemDefault; } + set { systemDefault = value; } + } + public string LaunchErrorMsg + { + get { return launchErrorMsg; } + set { launchErrorMsg = value; } + } + + #endregion + + #region Events + + 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; + + #endregion + + #region Constructor + + public ApplicationItem(SQLiteClient initSqlDb) : base(initSqlDb) + { + + // .. init member variables ... + appID = -1; + fatherID = -1; + title = ""; + filename = ""; + arguments = ""; + windowStyle = ProcessWindowStyle.Normal; + startupDir = "%FILEDIR%"; + useShellExecute = false; + useQuotes = true; + enabled = true; + sourceType = ItemType.UNKNOWN; + sourceFile = ""; + imageFile = ""; + fileDirectory = ""; + imageDirectories = ""; + validExtensions = ""; + appPosition = 0; + importValidImagesOnly = false; + systemDefault = ""; + waitForExit = true; + filesAreLoaded = false; + preLaunch = ""; + postLaunch = ""; + + } + + #endregion + + + + + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) + { + if (OnRefreshInfo != null) + { + OnRefreshInfo(informationMessage, progressBarCtr); + } + } + + protected int GetID = ProgramUtils.GetID; + + + + + 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> + /// <param name="guiListItem"></param> + public virtual void LaunchFile(BaseItem launchItem) + { + FileItem curFileItem = (FileItem)launchItem; + if (curFileItem == null) return; + + this.LaunchFile(curFileItem, true); + } + + public virtual void LaunchFile(FileItem curFileItem, bool mpGuiMode) + { + string curFilename = curFileItem.Filename; + if (curFilename == "") return; + + // Launch File by item + if (mpGuiMode) + curFileItem.UpdateLaunchInfo(); + + ProcessStartInfo procStart = new ProcessStartInfo(); + + if (this.Filename != "") + { // use the APPLICATION launcher and add current file information + + // filename of the application + procStart.FileName = this.Filename; + + // double quotes around the filename-argument..... + if (UseQuotes) + curFilename = "\"" + curFileItem.Filename + "\""; + + // set the arguments: one of the arguments is the fileitem-filename + if (this.Arguments.Contains("%FILEnoPATHnoEXT%")) + // ex. kawaks: + // winkawaks.exe alpham2 + // => filename without path and extension is necessary! + procStart.Arguments = " " + this.Arguments.Replace("%FILEnoPATHnoEXT%", Path.GetFileNameWithoutExtension(curFileItem.Filename)); + else if (this.Arguments.Contains("%FILE%")) + // placeholder found => replace the placeholder by the correct filename + procStart.Arguments = " " + this.Arguments.Replace("%FILE%", curFilename); + else + // no placeholder found => default handling: add the fileitem as the last argument + procStart.Arguments = " " + this.Arguments + " " + curFilename; + + // set WorkingDirectory + if (this.StartupDir.Contains("%FILEDIR%")) + procStart.WorkingDirectory = this.StartupDir.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); + else + procStart.WorkingDirectory = this.StartupDir; + } + else + { + // application has no launch-file + // => try to make a correct launch using the current FILE object + if (UseQuotes) + { + procStart.FileName = "\"" + curFileItem.Filename + "\""; + } + else + { + procStart.FileName = curFileItem.Filename; + } + + // set WorkingDirectory + if (this.StartupDir == "") + procStart.WorkingDirectory = Path.GetDirectoryName(curFileItem.Filename); + else if (this.StartupDir.Contains("%FILEDIR%")) + procStart.WorkingDirectory = this.StartupDir.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); + else + procStart.WorkingDirectory = this.StartupDir; + } + + // set UseShellExecute + procStart.UseShellExecute = this.UseShellExecute; + // set WindowStyle + procStart.WindowStyle = this.WindowStyle; + + this.LaunchErrorMsg = ""; + try + { + DoPreLaunch(); + + if (mpGuiMode) + { + AutoPlay.StopListening(); + if (g_Player.Playing) + g_Player.Stop(); + } + + //proc = new Process(); + /*proc.EnableRaisingEvents = true; + proc.Exited += new EventHandler(proc_Exited); + + proc.StartInfo = procStart; + ProgramUtils.StartProcess(proc, this.WaitForExit); + */Utils.StartProcess(procStart, this.WaitForExit); + + if (mpGuiMode) + { + GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); + AutoPlay.StartListening(); + } + } + catch (Exception ex) + { + string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", + procStart.FileName, + procStart.Arguments, + procStart.WorkingDirectory, + ex.Message, + ex.Source, + ex.StackTrace); + Log.Info(ErrorString); + this.LaunchErrorMsg = ErrorString; + } + finally + { + DoPostLaunch(); + } + } + + protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + this.OnLaunchFilelink(curLink, MPGUIMode); + } + + void proc_Exited(object sender, EventArgs e) + { + + if (proc != null) + { + proc.Dispose(); + proc = null; + } + } + + protected void DoPreLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(preLaunch); + } + } + + protected void DoPostLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(postLaunch); + } + } + + protected void LaunchCmd(string commands) + { + string results = ""; + string errors = ""; + string[] script; + string curLine; + Process p = new Process(); + StreamWriter sw; + StreamReader sr; + StreamReader err; + + script = commands.Split(';'); + if (script.Length > 0) + { + ProcessStartInfo psI = new ProcessStartInfo("cmd"); + psI.UseShellExecute = false; + psI.RedirectStandardInput = true; + psI.RedirectStandardOutput = true; + psI.RedirectStandardError = true; + psI.CreateNoWindow = true; + p.StartInfo = psI; + + p.Start(); + sw = p.StandardInput; + sr = p.StandardOutput; + err = p.StandardError; + + sw.AutoFlush = true; + + for (int i = 0; i < script.Length; i++) + { + curLine = script[i].Trim(); + curLine = curLine.TrimStart('\n'); + if (curLine != "") + sw.WriteLine(curLine); + } + sw.Close(); + + results += sr.ReadToEnd(); + errors += err.ReadToEnd(); + + if (errors.Trim() != "") + { + Log.Info("Application PrePost errors: {0}", errors); + } + } + } + + public virtual string DefaultFilepath() + { + return ""; // override this if the appitem can have subfolders + } + + public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) + { + int totalItems = 0; + if (filePath != lastFilepath) + { + ItemLoad(AppID, filePath); + //Filelinks.Load(AppID, filePath); + } + totalItems = totalItems + DisplayItemList(filePath, this.ItemList, facadeView); + // totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); + lastFilepath = filePath; + return totalItems; + } + + public override void OnClick(BaseItem baseItem,GUIPrograms guiPrograms) + { + ApplicationItem candidate = (ApplicationItem)baseItem; + guiPrograms.SaveItemIndex(guiPrograms.GetSelectedItemNo().ToString(), guiPrograms.lastApp, lastFilepath); + guiPrograms.lastApp = candidate; + guiPrograms.mapSettings.LastAppID = guiPrograms.lastApp.AppID; + guiPrograms.lastFilepath = guiPrograms.lastApp.DefaultFilepath(); + guiPrograms.ViewHandler.CurrentLevel = 0; + guiPrograms.lastApp.ViewHandler = guiPrograms.ViewHandler; + } + + protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) + { + int totalItems = 0; + //foreach (FileItem currentFileItem in dbItems) + foreach (object obj in dbItems) + { + totalItems = totalItems + 1; + if (obj is FileItem) + { + FileItem curFile = obj as FileItem; + GUIListItem gli = new GUIListItem(curFile.Title); + + gli.MusicTag = curFile; + gli.IsFolder = curFile.IsFolder; + gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); + } + } + return totalItems; + } + + + + + public virtual bool FileEditorAllowed() + { + return true; // otherwise, override this in child class + } + + public virtual bool FileAddAllowed() + { + return true; // otherwise, override this in child class + } + + public virtual bool FilesCanBeFavourites() + { + return true; // otherwise, override this in child class + } + + public virtual bool FileBrowseAllowed() + { + // set this to true, if SUBDIRECTORIES are allowed + // (example: possible for DIRECTORY-CACHE) + return false; // otherwise, override this in child class + } + + public virtual bool SubItemsAllowed() + { + return false; + } + + public virtual bool ProfileLoadingAllowed() + { + return false; + } + + public virtual void Refresh(bool mpGuiMode) + { + // descendant classes do that! + } + + #region Database stuff + + /// <summary> + /// get an unused SQL application KEY-number + /// </summary> + private int GetNewAppID() + { + if (sqlDB == null) return -1; + + // won't work in multiuser environment :) + SQLiteResultSet results; + int res = 0; + results = sqlDB.Execute("SELECT MAX(applicationId) FROM tblApplicationItem"); + SQLiteResultSet.Row arr = results.Rows[0]; + if (arr.fields[0] != null) + { + if (arr.fields[0] != "") + { + res = Int32.Parse(arr.fields[0]); + } + } + return res + 1; + } + + private void Insert() + { + if (sqlDB == null) return; + + string sql = ""; + + try + { + AppID = GetNewAppID(); // important to avoid subsequent inserts! + sql = String.Format(@" + INSERT INTO + tblApplicationItem + ( + applicationId, + fatherNodeId, + title, + filename, + arguments, + windowstyle, + startupdir, + useShellExecute, + useQuotes, + applicationItemType, + source, + imagefile, + filedirectory, + imagedirectory, + validExtensions, + importValidImagesOnly, + iposition, + enabled, + refreshGUIAllowed, + systemDefault, + waitForExit, + preLaunch, + postLaunch + ) + VALUES + ( + '"+ AppID + @"', + '"+ FatherID + @"', + '"+ ProgramUtils.Encode(Title) +@"', + '"+ ProgramUtils.Encode(Filename) +@"', + '"+ ProgramUtils.Encode(Arguments) + @"', + '"+ ProgramUtils.WindowStyleToStr(WindowStyle) +@"', + '"+ ProgramUtils.Encode(StartupDir) +@"', + '"+ ProgramUtils.BooleanToStr(UseShellExecute) +@"', + '"+ ProgramUtils.BooleanToStr(UseQuotes) +@"', + '"+ ProgramUtils.ApplicationTypeToString(SourceType) +@"', + '"+ ProgramUtils.Encode(Source) +@"', + '"+ ProgramUtils.Encode(Imagefile) +@"', + '"+ ProgramUtils.Encode(FileDirectory) +@"', + '"+ ProgramUtils.Encode(ImageDirectory)+@"', + '"+ ProgramUtils.Encode(ValidExtensions)+@"', + '"+ ProgramUtils.BooleanToStr(importValidImagesOnly)+@"', + '"+ Position+@"', + '"+ ProgramUtils.BooleanToStr(Enabled)+@"', + '" + ProgramUtils.BooleanToStr(RefreshGUIAllowed)+@"', + '"+ ProgramUtils.Encode(SystemDefault)+@"', + '"+ ProgramUtils.BooleanToStr(WaitForExit) +@"', + '"+ ProgramUtils.Encode(PreLaunch)+@"', + '"+ ProgramUtils.Encode(PostLaunch)+@"' + )" + + ); + sqlDB.Execute(sql); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + private void Update() + { + if (sqlDB == null) return; + if (AppID == -1) return; + + string sql = ""; + + try + { + sql = String.Format( + @"UPDATE + tblApplicationItem SET + + title = '" + ProgramUtils.Encode(Title) + @"', + filename = '" + ProgramUtils.Encode(Filename) + @"', + arguments = '" + ProgramUtils.Encode(Arguments) + @"', + windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + @"', + startupdir = '" + ProgramUtils.Encode(StartupDir) + @"', + useShellExecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + @"', + useQuotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + @"', + applicationItemType = '" + ProgramUtils.ApplicationTypeToString(SourceType) + @"', + source = '" + ProgramUtils.Encode(Source) + @"', + imagefile = '" + ProgramUtils.Encode(Imagefile) + @"', + filedirectory = '" + ProgramUtils.Encode(FileDirectory) + @"', + imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + @"', + validExtensions = '" + ProgramUtils.Encode(ValidExtensions) + @"', + importValidImagesOnly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + @"', + iposition = " + Position + @", + enabled = '" + ProgramUtils.BooleanToStr(Enabled) + @"', + fatherNodeId = '" + FatherID + @"', + refreshGUIAllowed = '" + ProgramUtils.BooleanToStr(RefreshGUIAllowed) +@"', + systemDefault = '" + ProgramUtils.Encode(SystemDefault) + @"', + waitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + @"', + preLaunch = '" + ProgramUtils.Encode(PreLaunch) + @"', + postLaunch = '" + ProgramUtils.Encode(PostLaunch) + @"' + + WHERE applicationId = " + AppID); + sqlDB.Execute(sql); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + Log.Info("sql \n{0}", sql); + } + } + + public void Delete() + { + if (sqlDB == null) return; + if (AppID == -1) return; + + try + { + DeleteFiles(); + DeleteFileLinks(); + sqlDB.Execute(String.Format("delete from tblApplicationItem where applicationId = {0}", AppID)); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + + protected void DeleteFiles() + { + if (sqlDB == null) return; + if (AppID == -1) return; + + try + { + sqlDB.Execute(String.Format("delete from tblFileItem where applicationId = {0}", AppID)); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + protected void DeleteFileLinks() + { + if (sqlDB == null) return; + if (AppID == -1) return; + + try + { + sqlDB.Execute(String.Format("delete from tblFilterItem where applicationId = {0} or grouperappid = {0}", AppID)); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + + public virtual void LoadFiles() + { + //linksAreLoaded = true; + if (sqlDB == null) return; + + lastFilepath = ""; + ItemLoad(AppID, ""); + filesAreLoaded = true; + } + + + + + + public void InsertOrUpdateSettings() + { + if (appID == -1) + Insert(); + else + Update(); + } + + #endregion + + protected virtual void FixFileLinks() + { + // after a import the appitem has completely new + // fileitems (new ids) and LINKS stored in filteritems + // are out of sync... fix this here! + + // query with data to fix + string sqlSelectDataToFix = String.Format("select fi.applicationId, fi.fileid as oldfileid, f.fileid as newfileid, fi.filename as filename from tblFilterItem fi, tblFileItem f where fi.applicationId = f.applicationId and fi.filename = f.filename and fi.applicationId = {0}", AppID); + + // update command to fix one single link + string sqlFixOneLink = "update tblFilterItem set fileID = {0}, tag = 0 where applicationId = {1} and filename = '{2}'"; + + SQLiteResultSet rows2fix; + + + try + { + // 1) initialize TAG + sqlDB.Execute(String.Format("update tblFilterItem set tag = 1234 where applicationId = {0}", AppID)); + + // 2) fix all fileids of the newly imported files + rows2fix = sqlDB.Execute(sqlSelectDataToFix); + int newFileID; + string filenameToFix; + if (rows2fix.Rows.Count == 0) return; + for (int row = 0; row < rows2fix.Rows.Count; row++) + { + newFileID = ProgramUtils.GetIntDef(rows2fix, row, "newfileid", -1); + filenameToFix = ProgramUtils.Get(rows2fix, row, "filename"); + sqlDB.Execute(String.Format(sqlFixOneLink, newFileID, AppID, ProgramUtils.Encode(filenameToFix))); + } + + // 3) delete untouched links ( they were not imported anymore ) + sqlDB.Execute(String.Format("delete from tblFilterItem where applicationId = {0} and tag = 1234", AppID)); + + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception (Application.FixFileLinks) err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + + } + + public virtual string CurrentFilePath() + { + return this.FileDirectory; + } + + public void Assign(ApplicationItem sourceApp) + { + this.Enabled = sourceApp.Enabled; + this.AppID = sourceApp.AppID; + this.FatherID = sourceApp.FatherID; + this.Title = sourceApp.Title; + this.Filename = sourceApp.Filename; + this.Arguments = sourceApp.Arguments; + this.WindowStyle = sourceApp.WindowStyle; + this.StartupDir = sourceApp.StartupDir; + this.UseShellExecute = sourceApp.UseShellExecute; + this.UseQuotes = sourceApp.UseQuotes; + this.SourceType = sourceApp.SourceType; + this.Source = sourceApp.Source; + this.Imagefile = sourceApp.Imagefile; + this.FileDirectory = sourceApp.FileDirectory; + this.ImageDirectory = sourceApp.ImageDirectory; + this.ValidExtensions = sourceApp.ValidExtensions; + this.ImportValidImagesOnly = sourceApp.ImportValidImagesOnly; + this.Position = sourceApp.Position; + this.WaitForExit = sourceApp.WaitForExit; + this.PreLaunch = sourceApp.PreLaunch; + this.PostLaunch = sourceApp.PostLaunch; + this.SystemDefault = sourceApp.SystemDefault; + + } + + #region imagedirectory stuff + + // get next imagedirectory that holds at least one image for a fileitem + // * m_pFile: the file we're looking images for + private void GetNextThumbFolderIndex(FileItem fileItem) + { + if (fileItem == null) return; + bool foundThumb = false; + while (!foundThumb) + { + thumbFolderIndex++; + if (thumbFolderIndex >= imageDirs.Length) + { + thumbFolderIndex = -1; + foundThumb = true; + } + else + { + string candFolder = imageDirs[thumbFolderIndex]; + string candThumb = candFolder + "\\" + fileItem.ExtractImageFileNoPath(); + if (candThumb.ToLower() != fileItem.Imagefile.ToLower()) + { + foundThumb = (System.IO.File.Exists(candThumb)); + } + else + { + // skip the initial directory, in case it's reentered as a search directory! + foundThumb = false; + } + } + } + } + + public virtual string GetCurThumb(GUIListItem item) + { + if (item.MusicTag == null) return ""; + + if (item.MusicTag is FileItem) + { + FileItem curFile = item.MusicTag as FileItem; + + if (DatabaseHandler.useMPsThumbDirectory) + return GetCurThumbFromThumbsDir(curFile); + else + return GetCurThumb(curFile); + } + else if (item.MusicTag is ApplicationItem) + { + ApplicationItem curApp = item.MusicTag as ApplicationItem; + + return curApp.Imagefile; + } + else return ""; + } + + public string GetCurThumb(FileItem fileItem) + { + string curThumb = ""; + + if (thumbFolderIndex == -1) + { + curThumb = fileItem.Imagefile; + } + else + { + string curFolder = imageDirs[thumbFolderIndex]; + curThumb = curFolder + "\\" + fileItem.ExtractImageFileNoPath(); + } + + if (thumbIndex > 0) + { + // try to find another thumb.... + // use the myGames convention: + // every thumb has the postfix "_1", "_2", etc with the same file extension + string curExtension = fileItem.ExtractImageExtension(); + if (curThumb != "") + { + string cand = curThumb.Replace(curExtension, "_" + thumbIndex.ToString() + curExtension); + if (System.IO.File.Exists(cand)) + { + // found another thumb => override the filename! + curThumb = cand; + } + else + { + thumbIndex = 0; // restart at the first thumb! + GetNextThumbFolderIndex(fileItem); + } + } + } + + return curThumb; + } + + public string GetCurThumbFromThumbsDir(FileItem fileItem) + { + string curThumb = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), + Path.GetFileNameWithoutExtension(fileItem.Filename) + ); + + if (File.Exists(curThumb)) + if (thumbIndex > 0) + { + // try to find another thumb.... + // use the myGames convention: + // every thumb has the postfix "_1", "_2", etc with the same file extension + string cand = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title), + Path.GetFileNameWithoutExtension(fileItem.Filename) + "_" + thumbIndex.ToString() + ); + + if (File.Exists(cand)) + curThumb = cand; + else + { + // restart at the first thumb! + thumbIndex = 0; + } + } + + return curThumb; + } + + public void ResetThumbs() + { + thumbIndex = 0; + thumbFolderIndex = -1; + } + + public void NextThumb() + { + thumbIndex++; + } + + #endregion + + public void LoadFromXmlProfile(XmlNode node) + { + + XmlNode titleNode = node.SelectSingleNode("title"); + if (titleNode != null) + { + this.Title = titleNode.InnerText; + } + + XmlNode launchingAppNode = node.SelectSingleNode("launchingApplication"); + if (launchingAppNode != null) + { + this.Filename = launchingAppNode.InnerText; + } + + XmlNode useShellExecuteNode = node.SelectSingleNode("useShellExecute"); + if (useShellExecuteNode != null) + { + this.UseShellExecute = ProgramUtils.StrToBoolean(useShellExecuteNode.InnerText); + } + + XmlNode argumentsNode = node.SelectSingleNode("arguments"); + if (argumentsNode != null) + { + this.Arguments = argumentsNode.InnerText; + } + + XmlNode windowStyleNode = node.SelectSingleNode("windowStyle"); + if (windowStyleNode != null) + { + this.WindowStyle = ProgramUtils.StringToWindowStyle(windowStyleNode.InnerText); + } + + XmlNode startupDirNode = node.SelectSingleNode("startupDir"); + if (startupDirNode != null) + { + this.StartupDir = startupDirNode.InnerText; + } + + XmlNode useQuotesNode = node.SelectSingleNode("useQuotes"); + if (useQuotesNode != null) + { + this.UseQuotes = ProgramUtils.StrToBoolean(useQuotesNode.InnerText); + } + + XmlNode fileExtensioneNode = node.SelectSingleNode("fileextensions"); + if (fileExtensioneNode != null) + { + this.ValidExtensions = fileExtensioneNode.InnerText; + } + } + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-07-22 19:06:56 UTC (rev 752) @@ -0,0 +1,315 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; +using SQLite.NET; + +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using MediaPortal.Util; + +using GUIPrograms; +using GUIPrograms.Database; +using GUIPrograms.Items; + +namespace GUIPrograms.Items +{ + /// <summary> + /// Summary description for ApplicationItemDirectoryCache. + /// </summary> + public class ApplicationItemDirectoryCache : ApplicationItem + { + GUIDialogProgress progressDialog = null; + + public ApplicationItemDirectoryCache(SQLiteClient initSqlDB) : base(initSqlDB) { } + + private void ShowProgressDialog() + { + progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + progressDialog.ShowWaitCursor = true; + progressDialog.SetHeading(GUILocalizeStrings.Get(13014)); + progressDialog.SetLine(0, GUILocalizeStrings.Get(13014)); + progressDialog.SetLine(1, ""); + progressDialog.SetLine(2, ""); + progressDialog.StartModal(GetID); + progressDialog.Progress(); + } + + private void CloseProgressDialog() + { + progressDialog.Close(); + } + + private string GetThumbsFile(FileInfo file, string fileTitle) + { + string thumbFolder = ""; + + if (imageDirs.Length > 0) + { + string mainImgFolder = ""; + + foreach (string imgFolder in imageDirs) + { + if (System.IO.Directory.Exists(imgFolder)) + { + mainImgFolder = imgFolder; + } + } + + if ("" != mainImgFolder) + { + string curDir = mainImgFolder + "\\"; + string filenameNoExtension = mainImgFolder + "\\" + file.Name; + filenameNoExtension = Path.ChangeExtension(filenameNoExtension, null); + filenameNoExtension = Path.GetFileNameWithoutExtension(filenameNoExtension); + + string[] exactMatchesJPG = Directory.GetFiles(curDir, filenameNoExtension + ".jpg"); + string[] exactMatchesGIF = Directory.GetFiles(curDir, filenameNoExtension + ".gif"); + string[] exactMatchesPNG = Directory.GetFiles(curDir, filenameNoExtension + ".png"); + if (exactMatchesJPG.Length > 0) + { + thumbFolder = exactMatchesJPG[0]; + } + else if (exactMatchesGIF.Length > 0) + { + thumbFolder = exactMatchesGIF[0]; + } + else if (exactMatchesPNG.Length > 0) + { + thumbFolder = exactMatchesPNG[0]; + } + else + { + string[] almostexactMatchesJPG = Directory.GetFiles(curDir, filenameNoExtension + "*.jpg"); + string[] almostexactMatchesGIF = Directory.GetFiles(curDir, filenameNoExtension + "*.gif"); + string[] almostexactMatchesPNG = Directory.GetFiles(curDir, filenameNoExtension + "*.png"); + if (almostexactMatchesJPG.Length > 0) + { + thumbFolder = almostexactMatchesJPG[0]; + } + else if (almostexactMatchesGIF.Length > 0) + { + thumbFolder = almostexactMatchesGIF[0]; + } + else if (almostexactMatchesPNG.Length > 0) + { + thumbFolder = almostexactMatchesPNG[0]; + } + else + { + // no exact match found! Redo with near matches! + string[] nearMatchesJPG = Directory.GetFiles(curDir, fileTitle + "*.jpg"); + string[] nearMatchesGIF = Directory.GetFiles(curDir, fileTitle + "*.gif"); + string[] nearMatchesPNG = Directory.GetFiles(curDir, fileTitle + "*.png"); + if (nearMatchesJPG.Length > 0) + { + thumbFolder = nearMatchesJPG[0]; + } + else if (nearMatchesGIF.Length > 0) + { + thumbFolder = nearMatchesGIF[0]; + } + else if (nearMatchesPNG.Length > 0) + { + thumbFolder = nearMatchesPNG[0]; + } + } + } + } + } + return thumbFolder; + } + + + + private void ImportFileItem(FileInfo fileInfo) + { + FileItem curFile = new FileItem(sqlDB); + curFile.FileID = -1; // to force an INSERT statement when writing the item + curFile.AppID = this.AppID; + curFile.Title = Path.GetFileNameWithoutExtension(fileInfo.Name); + curFile.Filename = fileInfo.FullName; + + curFile.Imagefile = GetThumbsFile(fileInfo, curFile.Title); + + // not imported properties => set default values + curFile.LastTimeLaunched = DateTime.MinValue; + curFile.LaunchCount = 0; + curFile.Write(); + } + + private void UpdateProgressDialog(FileInfo fileInfo ,bool mpGuiMode) + { + if (mpGuiMode) + { + progressDialog.SetLine(2, String.Format("{0} {1}", GUILocalizeStrings.Get(13005), fileInfo.Name)); // "last imported file {0}" + progressDialog.Progress(); + } + SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), fileInfo.Name), 0); + } + + private void DeleteOrphaned() + { + string TheFileName; + ItemLoad(AppID, ""); + foreach (FileItem DBfile in ItemList) + { + + TheFileName = DBfile.Filename; + + if (!DBfile.IsFolder) + { + if (!File.Exists(TheFileName)) { DBfile.Delete(); } + } + else + { + if (!Directory.Exists(TheFileName)) { DBfile.Delete(); } + + } + + } + } + + private void ImportFile(string dirPath,bool mpGuiMode) + { + + FileInfo fileInDir = null; + if (Directory.Exists(dirPath)) + { + DirectoryInfo directoryInfo = new DirectoryInfo(dirPath); + FileSystemInfo[] allUnderLyingFiles = directoryInfo.GetFileSystemInfos(); + + for (int i = 0; i < allUnderLyingFiles.Length; i++) + { + if (allUnderLyingFiles[i] is FileInfo) + { + Boolean FileExists = false; + + fileInDir = (FileInfo)allUnderLyingFiles[i]; + + foreach (FileItem DBfile in ItemList) + { + if (DBfile.Filename == fileInDir.FullName) + { + FileExists = true; + break;//ugly + } + } + if (!FileExists) + { + ImportFileItem(fileInDir); + UpdateProgressDialog(fileInDir, mpGuiMode); + } + }//if dir found,, recurse + else if (allUnderLyingFiles[i] is DirectoryInfo) + { + DirectoryInfo directory = (DirectoryInfo)allUnderLyingFiles[i]; + ImportFile(directory.FullName, mpGuiMode); + } + } + } + } + private void ImportDirectory(string[] fileDirPaths, bool mpGuiMode) + { + //get all maindirs + foreach (string dirPath in fileDirPaths) + { + ImportFile(dirPath,mpGuiMode); + } + } + + private void DoDirCacheImport(bool mpGuiMode) + { + if (sqlDB == null) + return; + if (this.AppID < 0) + return; + if (this.SourceType != ItemType.DIRCACHE) + return; + if (mpGuiMode) + { + ShowProgressDialog(); + } + try + { + ValidExtensions = ValidExtensions.Replace(" ", ""); + ItemLoad(AppID, ""); + + string[] fileDirPaths = this.FileDirectory.Split(';'); + ImportDirectory(fileDirPaths, mpGuiMode); + } + finally + { + if (mpGuiMode) + { + CloseProgressDialog(); + } + } + + } + + + override public string CurrentFilePath() + { + if (filePath != "") + { + return filePath; + } + else + { + return base.CurrentFilePath(); + } + } + + + override public string DefaultFilepath() + { + return this.FileDirectory; + } + + override public bool FileBrowseAllowed() + { + return true; + } + + override public bool ProfileLoadingAllowed() + { + return true; + } + + override public void Refresh(bool mpGuiMode) + { + base.Refresh(mpGuiMode); + DeleteOrphaned(); + DoDirCacheImport(mpGuiMode); + FixFileLinks(); + LoadFiles(); + } + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-07-22 19:06:56 UTC (rev 752) @@ -0,0 +1,192 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using SQLite.NET; +using System; +using GUIPrograms; + +namespace GUIPrograms.Items +{ + /// <summary> + /// Factory object that creates the matchin Application descendant class + /// depending on the sourceType parameter + /// Descendant classes differ in LOADING and REFRESHING filelists + /// </summary> + public class ApplicationItemFactory + { + static public ApplicationItemFactory AppFactory = new ApplicationItemFactory(); + + // singleton. Dont allow any instance of this class + private ApplicationItemFactory() { } + + static ApplicationItemFactory() + { + // nothing to create...... + } + + public BaseItem GetApplicationItem(SQLiteClient sqlDB, ItemType sourceType,SQLiteResultSet results, int iRecord) + { + BaseItem item = null; + switch (sourceType) + { + + case ItemType.DIRCACHE: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.DIRCACHE); + break; + case ItemType.MAMEDIRECT: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.MAMEDIRECT); + break; + case ItemType.GROUPER: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.GROUPER); + break; + case ItemType.GAMEBASE: + item = AppItemFactory(sqlDB, results, iRecord,ItemType.GAMEBASE); + break; + case ItemType.FILEITEM: + item = FileItemFactory(sqlDB,results, iRecord); + break; + case ItemType.FILELINKITEM: + item = FilelinkItemFactory(sqlDB, results, iRecord); + break; + case ItemType.FILTERITEM: + item = FilterItemFactory(sqlDB, results, iRecord); + break; + } + return item; + } + + private ApplicationItem AppItemFactory(SQLiteClient sqldb, SQLiteResultSet results, int recordIndex, ItemType sourceType) + { + ApplicationItem item = null;//= (ApplicationItem)appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"), null, 0); + + switch (sourceType) + { + case ItemType.DIRCACHE: + item = new ApplicationItemDirectoryCache(sqldb); + break; + case ItemType.MAMEDIRECT: + item = new ApplicationItemMame(sqldb); + break; + case ItemType.GROUPER: + item = new ApplicationItemGrouper(sqldb); + break; + case ItemType.GAMEBASE: + item = new ApplicationItemGameBase(sqldb); + break; + } + + //fetches from db,, + if (results != null) + { + item.Enabled = ProgramUtils.GetBool(results, recordIndex, "enabled"); + item.AppID = ProgramUtils.GetIntDef(results, recordIndex, "applicationId", -1); + item.FatherID = ProgramUtils.GetIntDef(results, recordIndex, "fatherNodeId", -1); + item.Title = ProgramUtils.Get(results, recordIndex, "title"); + item.Filename = ProgramUtils.Get(results, recordIndex, "filename"); + item.Arguments = ProgramUtils.Get(results, recordIndex, "arguments"); + item.WindowStyle = ProgramUtils.GetProcessWindowStyle(results, recordIndex, "windowstyle"); + item.StartupDir = ProgramUtils.Get(results, recordIndex, "startupdir"); + item.UseShellExecute = ProgramUtils.GetBool(results, recordIndex, "useShellExecute"); + item.UseQuotes = ProgramUtils.GetBool(results, recordIndex, "useQuotes"); + item.SourceType = ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"); + item.Source = ProgramUtils.Get(results, recordIndex, "source"); + item.Imagefile = ProgramUtils.Get(results, recordIndex, "imagefile"); + item.FileDirectory = ProgramUtils.Get(results, recordIndex, "filedirectory"); + item.ImageDirectory = ProgramUtils.Get(results, recordIndex, "imagedirectory"); + item.ValidExtensions = ProgramUtils.Get(results, recordIndex, "validextensions"); + item.ImportValidImagesOnly = ProgramUtils.GetBool(results, recordIndex, "importvalidimagesonly"); + item.Position = ProgramUtils.GetIntDef(results, recordIndex, "iposition", 0); + item.RefreshGUIAllowed = ProgramUtils.GetBool(results, recordIndex, "refreshGUIAllowed"); + item.SystemDefault = ProgramUtils.Get(results, recordIndex, "systemdefault"); + item.WaitForExit = ProgramUtils.GetBool(results, recordIndex, "waitforexit"); + item.PreLaunch = ProgramUtils.Get(results, recordIndex, "preLaunch"); + item.PostLaunch = ProgramUtils.Get(results, recordIndex, "postLaunch"); + } + return item; + } + + private FileItem FileItemFactory(SQLiteClient sqlDB,SQLiteResultSet results, int iRecord) + { + FileItem newFile = new FileItem(sqlDB); + newFile.FileID = ProgramUtils.GetIntDef(results, iRecord, "fileid", -1); + newFile.AppID = ProgramUtils.GetIntDef(results, iRecord, "applicationId", -1); + newFile.Title = ProgramUtils.Get(results, iRecord, "title"); + newFile.Filename = ProgramUtils.Get(results, iRecord, "filename"); + newFile.Imagefile = ProgramUtils.Get(results, iRecord, "imagefile"); + newFile.MainGenre = ProgramUtils.Get(results, iRecord, "mainGenre"); + newFile.MainGenreId = ProgramUtils.GetIntDef(results, iRecord, "mainGenreId", 1); + newFile.SubGenre = ProgramUtils.Get(results, iRecord, "subGenre"); + newFile.SubGenreId = ProgramUtils.GetIntDef(results, iRecord, "subGenreId", 1); + newFile.Country = ProgramUtils.Get(results, iRecord, "country"); + newFile.ManufacturerId = ProgramUtils.GetIntDef(results, iRecord, "manufacturerId", 1); + newFile.Manufacturer = ProgramUtils.Get(results, iRecord, "manufacturer"); + newFile.Year = ProgramUtils.GetIntDef(results, iRecord, "year", -1); + newFile.Rating = ProgramUtils.GetIntDef(results, iRecord, "rating", 5); + newFile.Overview = ProgramUtils.Get(results, iRecord, "overview"); + newFile.Platform = ProgramUtils.Get(results, iRecord, "platform"); + newFile.PlatformId = ProgramUtils.GetIntDef(results, iRecord, "platformId", 1); + + newFile.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); + newFile.CategoryData = ProgramUtils.Get(results, iRecord, "categorydata"); + newFile.GameInfoURL = ProgramUtils.Get(results, iRecord, "gameInfoUrl"); + return newFile; + } + + private FilterItem FilterItemFactory(SQLiteClient sqlDB,SQLiteResultSet results, int iRecord) + { + FilterItem filterItem = new FilterItem(sqlDB); + filterItem.Title = ProgramUtils.Get(results, iRecord, "title"); + // newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); + //newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); ; + return filterItem; + } + + + private FilelinkItem FilelinkItemFactory(SQLiteClient sqlDB, SQLiteResultSet results, int iRecord) + { + FilelinkItem newLink = new FilelinkItem(sqlDB); + newLink.FileID = ProgramUtils.GetIntDef(results, iRecord, "fileId", -1); + newLink.AppID = ProgramUtils.GetIntDef(results, iRecord, "grouperAppId", -1); + newLink.TargetAppID = ProgramUtils.GetIntDef(results, iRecord, "targetAppId", -1); + newLink.Title = ProgramUtils.Get(results, iRecord, "title"); + newLink.Filename = ProgramUtils.Get(results, iRecord, "filename"); + newLink.Imagefile = ProgramUtils.Get(results, iRecord, "imagefile"); + newLink.MainGenre = ProgramUtils.Get(results, iRecord, "mainGenre"); + newLink.SubGenre = ProgramUtils.Get(results, iRecord, "subGenre"); + newLink.Country = ProgramUtils.Get(results, iRecord, "country"); + newLink.ManufacturerId = ProgramUtils.GetIntDef(results, iRecord, "manufacturerId", 1); + newLink.Manufacturer = ProgramUtils.Get(results, iRecord, "manufacturer"); + newLink.Year = ProgramUtils.GetIntDef(results, iRecord, "year", -1); + newLink.Rating = ProgramUtils.GetIntDef(results, iRecord, "rating", 5); + newLink.Overview = ProgramUtils.Get(results, iRecord, "overview"); + newLink.Platform = ProgramUtils.Get(results, iRecord, "platform"); + newLink.PlatformId = ProgramUtils.GetIntDef(results, iRecord, "platformId", 1); + newLink.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); + newLink.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); + newLink.IsFolder = ProgramUtils.GetBool(results, iRecord, "isfolder"); + return newLink; + } + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-07-22 19:06:56 UTC (rev 752) @@ -0,0 +1,134 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.IO; +using SQLite.NET; + +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; + +using GUIPrograms; +using GUIPrograms.Database; +using GUIPrograms.Imports; + +namespace GUIPrograms.Items +{ + /// <summary> + /// Summary description for ApplicationItemGameBase. + /// </summary> + public class ApplicationItemGameBase : ApplicationItem + { + GUIDialogProgress guiDialogProgress = null; + + public ApplicationItemGameBase(SQLiteClient initSqlDB) + : base(initSqlDB) + { + // nothing to create here... + } + + private void ShowProgressDialog() + { + guiDialogProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + guiDialogProgress.ShowWaitCursor = true; + guiDialogProgress.SetHeading(GUILocalizeStrings.Get(13015)); + guiDialogProgress.SetLine(0, GUILocalizeStrings.Get(13015)); + guiDialogProgress.SetLine(1, ""); + guiDialogProgress.SetLine(2, ""); + guiDialogProgress.StartModal(GetID); + guiDialogProgress.ShowProgressBar(true); + guiDialogProgress.Progress(); + } + + private void DoGamebaseImport(bool bGUIMode) + { + if (sqlDB == null) + return; + if (this.AppID < 0) + return; + if ((this.SourceType != ItemType.GAMEBASE) || (Source == "") || (!File.Exists(Source))) + return; + // show progress dialog and run the import... + if (bGUIMode) + { + ShowProgressDialog(); + } + try + { + GamebaseImport objImporter = new GamebaseImport(this, sqlDB); + objImporter.OnReadNewFile += new GamebaseImport.MyEventHandler(ReadNewFile); + try + { + objImporter.Start(); + } + finally + { + objImporter.OnReadNewFile -= new GamebaseImport.MyEventHandler(ReadNewFile); + } + } + finally + { + if (bGUIMode) + { + guiDialogProgress.Close(); + } + } + } + void ReadNewFile(string informationMessage, int progressBarCtr) + { + if (guiDialogProgress != null) + { + guiDialogProgress.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); + }*/ + guiDialogProgress.Progress(); + } + SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); + } + + void DisplayText(string informationMessage, int progressBarCtr) + { + SendRefreshInfo(informationMessage, progressBarCtr); + } + + + override public bool ProfileLoadingAllowed() + { + return true; + } + + override public void Refresh(bool bGUIMode) + { + base.Refresh(bGUIMode); + DeleteFiles(); + DoGamebaseImport(bGUIMode); + FixFileLinks(); + LoadFiles(); + } + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-07-22 19:06:56 UTC (rev 752) @@ -0,0 +1,178 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free S... [truncated message content] |
From: <nor...@us...> - 2007-07-24 20:20:49
|
Revision: 758 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=758&view=rev Author: northern_sky Date: 2007-07-24 13:20:46 -0700 (Tue, 24 Jul 2007) Log Message: ----------- misc wip Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemList.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -44,7 +44,7 @@ public class DatabaseHandler { public static SQLiteClient sqlDB = null; - static ApplicationItemList dbHandlerApplicationItemList = null; + static List<ApplicationItem> globalApplicationItemList = new List<ApplicationItem>(); private const string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; public static bool useMPsThumbDirectory = false; @@ -76,22 +76,25 @@ sqlDB = new SQLiteClient(Config.GetFile(Config.Dir.Database, DATABASEFILE)); } + //globalApplicationItemList = new ApplicationItemList(sqlDB, new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink)); + LoadAllApplicationItems(); } catch (SQLiteException ex) { Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } - dbHandlerApplicationItemList = new ApplicationItemList(sqlDB, new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink)); + + } - static void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + /*static void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) { - ApplicationItem targetApp = dbHandlerApplicationItemList.GetAppByID(curLink.TargetAppID); + ApplicationItem targetApp = globalApplicationItemList.GetAppByID(curLink.TargetAppID); if (targetApp != null) { targetApp.LaunchFile(curLink, MPGUIMode); } - } + }*/ /// <summary> /// Create db tables etc,if not already exist @@ -401,12 +404,35 @@ - static public ApplicationItemList ApplicationItemList + static public List<ApplicationItem> ApplicationItemList { get { - return dbHandlerApplicationItemList; + return globalApplicationItemList; } } + + public static void LoadAllApplicationItems() + { + try + { + globalApplicationItemList.Clear(); + SQLiteResultSet results = sqlDB.Execute("select * from tblApplicationItem order by iposition"); + + if (results.Rows.Count == 0) + return; + + for (int row = 0; row < results.Rows.Count; row++) + { + ApplicationItem applicationItem = (ApplicationItem)ApplicationItemFactory.AppFactory.GetApplicationItem( ProgramUtils.GetSourceType(results, row, "applicationItemType"), results, row); + // applicationItem.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); + globalApplicationItemList.Add(applicationItem); + } + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -1,6 +1,6 @@ namespace GUIPrograms.Design { - partial class AppFilesImportProgress + partial class AppSettingsFilesImportProgress { /// <summary> /// Required designer variable. @@ -98,13 +98,13 @@ this.progressTextBox.Size = new System.Drawing.Size(477, 47); this.progressTextBox.TabIndex = 34; // - // AppFilesImportProgress + // AppSettingsFilesImportProgress // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.progressTextBox); this.Controls.Add(this.progressBar); - this.Name = "AppFilesImportProgress"; + this.Name = "AppSettingsFilesImportProgress"; this.Load += new System.EventHandler(this.AppFilesImportProgress_Load); this.Controls.SetChildIndex(this.prePostButton, 0); this.Controls.SetChildIndex(this.winTypeLabel, 0); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -36,14 +36,14 @@ namespace GUIPrograms.Design { - public partial class AppFilesImportProgress : AppSettingsBase + public partial class AppSettingsFilesImportProgress : AppSettingsBase { private bool isImportRunning; private ApplicationItem curApp; const string importStartedText = "=== import started..."; const string importFinishedText = "=== import finished."; - public AppFilesImportProgress() + public AppSettingsFilesImportProgress() { InitializeComponent(); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -1,6 +1,6 @@ namespace GUIPrograms.Design { - partial class AppFilesView + partial class AppSettingsFilesView { /// <summary> /// Required designer variable. @@ -29,7 +29,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppFilesView)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppSettingsFilesView)); this.fileListView = new System.Windows.Forms.ListView(); this.fileTitle = new System.Windows.Forms.ColumnHeader(); this.smallImageList = new System.Windows.Forms.ImageList(this.components); @@ -391,13 +391,13 @@ // this.openFileDialog.FileName = "openFileDialog1"; // - // AppFilesView + // AppSettingsFilesView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.FileSettingsGroupBox); this.Controls.Add(this.filesGroupBox); - this.Name = "AppFilesView"; + this.Name = "AppSettingsFilesView"; this.Size = new System.Drawing.Size(521, 574); this.Load += new System.EventHandler(this.AppFilesView_Load); this.contextFavouritesMenuStrip.ResumeLayout(false); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -38,14 +38,14 @@ namespace GUIPrograms.Design { - public partial class AppFilesView : UserControl + public partial class AppSettingsFilesView : UserControl { - private ApplicationItemList apps = DatabaseHandler.ApplicationItemList; + private List<ApplicationItem> apps = DatabaseHandler.ApplicationItemList; public event EventHandler OnRefreshClick; private ApplicationItem currentApplication = null; public event EventHandler OnImageFolderSearch; - public AppFilesView() + public AppSettingsFilesView() { InitializeComponent(); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -63,12 +63,6 @@ return true; } - public virtual bool Applist2Form(ApplicationItemList apps) - { - // virtual! - return true; - } - public virtual void FormToAppItem(ApplicationItem curApp) { if (curApp != null) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -1,3 +1,5 @@ +#region Imports + using System; using System.Collections.Generic; using System.ComponentModel; @@ -16,43 +18,122 @@ using GUIPrograms; using GUIPrograms.Items; +#endregion +//#region Enums +//#endregion +//#region Delegates +//#endregion + +//#region Events +//#endregion + + + + + +#region Properties +// Public Properties +#endregion + +#region Public Methods +#endregion + +#region Private Methods +#endregion + +#region <Base class> Overloads +#endregion + +#region <Interface> Implementations +// region for each interface +#endregion + namespace GUIPrograms.Design { public partial class SetupForm : Form { - private ApplicationItemList globalApplicationList = DatabaseHandler.ApplicationItemList; - private AppSettingsDirCache sectionDirCache = new AppSettingsDirCache(); - private AppSettingsMame sectionMameDirect = new AppSettingsMame(); - private AppSettingsGamebase appSettingsGameBase = new AppSettingsGamebase(); - private AppSettingsGrouper sectionGrouper = new AppSettingsGrouper(); - private ProgramViews programView = new ProgramViews(); - private AppSettingsRoot sectionRoot = new AppSettingsRoot(); - private AppFilesView filesView = new AppFilesView(); + #region Variables - private AppFilesImportProgress filesProgress = new AppFilesImportProgress(); + private List<ApplicationItem> globalApplicationList = DatabaseHandler.ApplicationItemList; + private AppSettingsDirCache appSettingsDirCache = new AppSettingsDirCache(); + private AppSettingsMame appSettingsMame = new AppSettingsMame(); + private AppSettingsGamebase appSettingsGameBase = new AppSettingsGamebase(); + private AppSettingsGrouper appSettingsGrouper = new AppSettingsGrouper(); + private ProgramViews appSettingsProgramView = new ProgramViews(); + private AppSettingsRoot appSettingsRoot = new AppSettingsRoot(); + private AppSettingsFilesView appSettingsFileEditView = new AppSettingsFilesView(); + private AppSettingsFilesImportProgress filesProgress = new AppSettingsFilesImportProgress(); private AppSettingsBase pageCurrentSettings = null; - private bool profilesLoaded = false; + private bool profilesIsLoaded = false; private const string ROOTNODENAME = "Applications"; private const int POSITIONHOLDER = 10; + #endregion + #region Constructors/Destructors + public SetupForm() { - - - InitializeComponent(); - filesView.OnRefreshClick += new EventHandler(this.RefreshClick); + + appSettingsFileEditView.OnRefreshClick += new EventHandler(this.RefreshClick); //when imagefolder was clicked on filesview... - filesView.OnImageFolderSearch += new EventHandler(this.ImageSearchClick); + appSettingsFileEditView.OnImageFolderSearch += new EventHandler(this.ImageSearchClick); } + #endregion + #region Private Methods + #region Treeview helper Methods + private void RemoveNodeAndUpdateTree(TreeNode treeNode) + { + //update sibling level + ApplicationItem application = GetTreeNodeApplicationItem(treeNode); + //get last node at same level as treenode + TreeNode tmpNode = treeNode.Parent.LastNode; + ApplicationItem tmpApplication = GetTreeNodeApplicationItem(tmpNode); + + + if (tmpNode != treeNode) + { + //remember where to stop updating.. + int stopPosition = application.Position; + + //remove node from tree + treeNode.Remove(); + + //start rearrangeposition + while ((tmpNode.PrevNode != null) && (tmpApplication.Position > stopPosition)) + { + application = GetTreeNodeApplicationItem(tmpNode); + application.Position = application.Position - POSITIONHOLDER; + application.InsertOrUpdateSettings(); + + tmpNode = tmpNode.PrevNode; + tmpApplication = GetTreeNodeApplicationItem(tmpNode); + + } + + //node under root + if (tmpNode.PrevNode == null) + { + application = GetTreeNodeApplicationItem(tmpNode); + application.Position = POSITIONHOLDER; + application.InsertOrUpdateSettings(); + } + } + else//is lastnode.just remove,, + { + treeNode.Remove(); + } + + } + /// <summary> /// Gets the path to selected treenode in format0;2;0 etc /// </summary> @@ -119,7 +200,7 @@ /// <param name="FatherID"></param> private void AttachChildNodes(TreeNode Parent, int FatherID) { - foreach (ApplicationItem applicationItem in globalApplicationList.AppsOfFatherID(FatherID)) + foreach (ApplicationItem applicationItem in AppsOfFatherID(FatherID)) { TreeNode currentNode = new TreeNode(applicationItem.Title); @@ -130,7 +211,20 @@ } + public List<ApplicationItem> AppsOfFatherID(int FatherID) + { + List<ApplicationItem> applicationItemList = new List<ApplicationItem>(); + foreach (ApplicationItem curApp in globalApplicationList) + { + if (curApp.FatherID == FatherID) + { + applicationItemList.Add(curApp); + } + } + return applicationItemList; + } + /// <summary> /// Updates the whole treeview /// </summary> @@ -247,19 +341,17 @@ #endregion Treeview helper Methods - - + private void AttachFilesView() { this.tabControl.TabPages["directoryTabPage"].Controls.Clear(); - this.tabControl.TabPages["directoryTabPage"].Controls.Add(filesView); - + this.tabControl.TabPages["directoryTabPage"].Controls.Add(appSettingsFileEditView); } private void AttachProgramsView() { this.tabControl.TabPages["viewTabPage"].Controls.Clear(); - this.tabControl.TabPages["viewTabPage"].Controls.Add(programView); + this.tabControl.TabPages["viewTabPage"].Controls.Add(appSettingsProgramView); } private void AttachImportRunningView() @@ -268,8 +360,8 @@ this.tabControl.TabPages["directoryTabPage"].Controls.Add(filesProgress); } + - private AppSettingsBase GetCurrentSettingsPage() { AppSettingsBase appSettings = null; @@ -280,13 +372,13 @@ switch (currentApplication.SourceType) { case ItemType.DIRCACHE: - appSettings = sectionDirCache; + appSettings = appSettingsDirCache; break; case ItemType.MAMEDIRECT: - appSettings = sectionMameDirect; + appSettings = appSettingsMame; break; case ItemType.GROUPER: - appSettings = sectionGrouper; + appSettings = appSettingsGrouper; break; case ItemType.GAMEBASE: appSettings = this.appSettingsGameBase; @@ -295,7 +387,7 @@ } else { - appSettings = sectionRoot; + appSettings = appSettingsRoot; } return appSettings; } @@ -319,7 +411,7 @@ { tabControl.Controls.Add(this.directoryTabPage); } - filesView.Refresh(curApp); + appSettingsFileEditView.Refresh(curApp); } private void AddViewsPage() @@ -399,8 +491,6 @@ } } - - private bool SaveAppItem() { bool success = true; @@ -413,11 +503,11 @@ { if (pageCurrentSettings.EntriesOK(currentApplication)) { - if (filesView.EntriesOK()) + if (appSettingsFileEditView.EntriesOK()) { pageCurrentSettings.FormToAppItem(currentApplication); - filesView.FillApplicationItem(currentApplication); + appSettingsFileEditView.FillApplicationItem(currentApplication); if (currentApplication != null) @@ -466,7 +556,7 @@ ApplicationItem currentApplication = GetTreeNodeApplicationItem(treeView.SelectedNode); if (currentApplication != null) { - deleteApplicationToolStripMenuItem.Enabled = (globalApplicationList.AppsOfFatherID(currentApplication.AppID).Count == 0); // groupitems are only deletable if no children exist + deleteApplicationToolStripMenuItem.Enabled = (AppsOfFatherID(currentApplication.AppID).Count == 0); // groupitems are only deletable if no children exist } } @@ -493,7 +583,7 @@ int id = 0; string titleNode = string.Empty; - if (!profilesLoaded) + if (!profilesIsLoaded) { this.emulatorSetupToolStripMenuItem.DropDownItems.Clear(); @@ -529,7 +619,7 @@ } } - profilesLoaded = true; + profilesIsLoaded = true; } } @@ -553,7 +643,7 @@ ApplicationItem tempApp = new ApplicationItem(curApp.db); tempApp.LoadFromXmlProfile(node); pageCurrentSettings.LoadFromAppItem(tempApp); - filesView.FileExtensionsText = tempApp.ValidExtensions; + appSettingsFileEditView.FileExtensionsText = tempApp.ValidExtensions; } } @@ -574,21 +664,33 @@ //ADD POSITION CHECK? - globalApplicationList.LoadAll(); + DatabaseHandler.LoadAllApplicationItems(); UpdateTree(); } } } + public int GetMaxPosition(int fatherID) + { + int res = 0; + foreach (ApplicationItem curApp in globalApplicationList) + { + if ((curApp.FatherID == fatherID) && (curApp.Position > res)) + { + res = curApp.Position; + } + } + return res; + } private void AddApplication(ItemType newSourceType) { if (SaveAppItem()) { - ApplicationItem newApplication = (ApplicationItem) ApplicationItemFactory.AppFactory.GetApplicationItem(DatabaseHandler.sqlDB, newSourceType,null,0); + ApplicationItem newApplication = (ApplicationItem)ApplicationItemFactory.AppFactory.GetApplicationItem(newSourceType, null, 0); globalApplicationList.Add(newApplication); newApplication.FatherID = GetTreeNodeApplicationItemId(); - newApplication.Position = globalApplicationList.GetMaxPosition(newApplication.FatherID) + 10; + newApplication.Position = GetMaxPosition(newApplication.FatherID) + 10; if (newApplication.Title == string.Empty) { @@ -596,7 +698,7 @@ } newApplication.SourceType = newSourceType; newApplication.InsertOrUpdateSettings(); - globalApplicationList.LoadAll(); + DatabaseHandler.LoadAllApplicationItems(); UpdateTree(); @@ -609,12 +711,26 @@ } } + private void BlockControls() + { + treeView.Enabled = false; + this.toolsStripMenuItem.Enabled = false; + } + + private void UnblockControls() + { + treeView.Enabled = true; + this.toolsStripMenuItem.Enabled = true; + } + + + #endregion Private Methods + #region Events private void SetupForm_Load(object sender, EventArgs e) { AttachFilesView(); - globalApplicationList.LoadAll(); // we need all globalApplicationList, whether enabled or not => reload with LoadALL AttachProgramsView(); UpdateTree(); FillProfileMenu(); @@ -671,8 +787,6 @@ DeleteApplication(); } - - private void treeView_DragEnter(object sender, DragEventArgs e) { e.Effect = e.AllowedEffect; @@ -687,50 +801,8 @@ } } - private void RemoveNodeAndUpdateTree(TreeNode treeNode) - { - //update sibling level - ApplicationItem application = GetTreeNodeApplicationItem(treeNode); - //get last node at same level as treenode - TreeNode tmpNode = treeNode.Parent.LastNode; - ApplicationItem tmpApplication = GetTreeNodeApplicationItem(tmpNode); + - - if (tmpNode != treeNode) - { - //remember where to stop updating.. - int stopPosition = application.Position; - - //remove node from tree - treeNode.Remove(); - - //start rearrangeposition - while ((tmpNode.PrevNode != null) && (tmpApplication.Position > stopPosition)) - { - application = GetTreeNodeApplicationItem(tmpNode); - application.Position = application.Position - POSITIONHOLDER; - application.InsertOrUpdateSettings(); - - tmpNode = tmpNode.PrevNode; - tmpApplication = GetTreeNodeApplicationItem(tmpNode); - - } - - //node under root - if (tmpNode.PrevNode == null) - { - application = GetTreeNodeApplicationItem(tmpNode); - application.Position = POSITIONHOLDER; - application.InsertOrUpdateSettings(); - } - } - else//is lastnode.just remove,, - { - treeNode.Remove(); - } - - } - private void treeView_DragDrop(object sender, DragEventArgs e) { // Retrieve the client coordinates of the drop location. @@ -833,7 +905,7 @@ } } - globalApplicationList.LoadAll(); + DatabaseHandler.LoadAllApplicationItems(); UpdateTree(); } } @@ -857,7 +929,7 @@ // save current applicationItem if switching to file-tab if (tabControl.SelectedIndex == 1) { - filesView.SetupFileView(); + appSettingsFileEditView.SetupFileView(); if (!SaveAppItem()) { tabControl.SelectedIndex = 0; @@ -868,7 +940,6 @@ if (tabControl.SelectedIndex == 0) { SaveAppItem(); - } } @@ -880,7 +951,6 @@ { if (pageCurrentSettings.EntriesOK(currentApplication)) { - pageCurrentSettings.FormToAppItem(currentApplication); if (currentApplication != null) { @@ -890,20 +960,9 @@ } } - #endregion Events + - private void BlockControls() - { - treeView.Enabled = false; - this.toolsStripMenuItem.Enabled = false; - } - - private void UnblockControls() - { - treeView.Enabled = true; - this.toolsStripMenuItem.Enabled = true; - } - + private void DoRefresh() { bool DoIt = false; @@ -926,7 +985,7 @@ { AttachImportRunningView(); BlockControls(); - filesView.FillApplicationItem(currentApplication); + appSettingsFileEditView.FillApplicationItem(currentApplication); filesProgress.CurApp = currentApplication; filesProgress.RunImport(); } @@ -957,6 +1016,9 @@ toolsStripMenuItem.Enabled = true; } } + + #endregion Events + private void UpdateComboBoxes() { FillComboBox("tblPlatform", "platform", removePlatformComboBox); @@ -964,33 +1026,6 @@ FillComboBox("tblGenre", "genre", removeGenreComboBox); } - - public class ListItem - { - private string text; - - public string Text - { - get { return text; } - set { text = value; } - } - private int value; - - public int Value - { - get { return this.value; } - set { this.value = value; } - } - - public ListItem(string label, int data) - { - text = label; - value = data; - } - - - } - private void FillComboBox(string tableName, string orderBy, ComboBox comboBox) { @@ -1131,18 +1166,12 @@ try { - // - DatabaseHandler.sqlDB.Execute(sqlStmt); - - } catch (Exception exception) { throw exception; } - - } @@ -1158,9 +1187,6 @@ AND " + column + @" <> 1 "; - - - try { DatabaseHandler.sqlDB.Execute(sqlStmt); @@ -1176,8 +1202,28 @@ UpdateComboBoxes(); } + public class ListItem + { + private string text; + public string Text + { + get { return text; } + set { text = value; } + } + private int value; + public int Value + { + get { return this.value; } + set { this.value = value; } + } + public ListItem(string label, int data) + { + text = label; + value = data; + } + } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -407,7 +407,6 @@ public GUIPrograms() { GetID = (int)Window.WINDOW_FILES; - applicationList = DatabaseHandler.ApplicationItemList; LoadSettings(); skipInit = true; } @@ -433,6 +432,7 @@ void InitMyPrograms() { LoadFolderSettings(""); + if (skipInit) { mapSettings.LastAppID = -1; @@ -441,7 +441,7 @@ { LoadLastAppIDFromSettings(); // hacky load back the last applicationItem id, otherwise this can get lost from dx resets.... } - lastApp = applicationList.GetAppByID(mapSettings.LastAppID); + lastApp = GetAppByID(mapSettings.LastAppID); if (lastApp != null) { lastFilepath = lastApp.DefaultFilepath(); @@ -469,7 +469,7 @@ bool currentSortAsc = true; ProgramViewHandler viewHandler = ProgramViewHandler.Instance; - static ApplicationItemList applicationList = DatabaseHandler.ApplicationItemList; + List<ApplicationItem> allApplicationsList = DatabaseHandler.ApplicationItemList; public MapSettings mapSettings = new MapSettings(); DirectoryHistory itemHistory = new DirectoryHistory(); public ApplicationItem lastApp = null; @@ -494,7 +494,6 @@ get { return viewHandler; } set { viewHandler = value; } } - public static string ThumbnailPath { @@ -597,11 +596,9 @@ protected override void OnPageLoad() { - //string view = CurrentView; - base.OnPageLoad(); - if (btnSortBy != null) + if (btnSortBy != null) btnSortBy.SortChanged += new SortEventHandler(SortChanged); InitMyPrograms(); @@ -667,6 +664,7 @@ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); + if (control == btnViewAs) { mapSettings.SwitchToNextViewLayout(); @@ -709,7 +707,6 @@ { OnShowSort(); } - else if (control == facadeView) { // application or file-item was clicked.... @@ -765,7 +762,7 @@ RenderThumbnail(timePassed); } - + #endregion #region Display @@ -785,7 +782,6 @@ btnRefresh.IsVisible = lastApp.RefreshGUIAllowed; } - facadeView.IsVisible = true; GUIControl.FocusControl(GetID, facadeView.GetID); @@ -870,7 +866,6 @@ screenShotImage.Visible = false; break; } - facadeView.SelectedListItemIndex = itemIndex; UpdateButtonStates(); } @@ -910,7 +905,6 @@ // only show big thumb if there is really one.... ThumbnailPath = appWithImg.GetCurThumb(item); // some modes look for thumbs differently } - appWithImg.NextThumb(); // try to find a next thumbnail slideTime = (DateTime.Now.Ticks / 10000); // reset timer! } @@ -946,19 +940,18 @@ // Refresh FileList if view has changed, while this appItem was not active if (lastApp.CurrentView != this.CurrentView) { - lastApp.LoadFiles(); lastApp.CurrentView = this.CurrentView; } - int totalFiles = lastApp.DisplayFiles(this.lastFilepath, facadeView); + int totalFiles = lastApp.DisplayFiles(lastApp.FileDirectory, facadeView); return (totalFiles); } int DisplayApps() { int totalApps = 0; - foreach (ApplicationItem applicationItem in applicationList.AppsOfFatherID(GetCurrentFatherID())) + foreach (ApplicationItem applicationItem in AppsOfFatherID(GetCurrentFatherID())) { if (applicationItem.Enabled) { @@ -999,7 +992,7 @@ return String.Format("applicationItem{0}#level{1}#sub_{2}", appID, viewLevel, pathSub); } - public void SaveItemIndex(string value, ApplicationItem app, string pathSub) + public void SaveItemIndex(string value, ApplicationItem app, string pathSub) { string key = BuildHistoryKey(app, ViewHandler.CurrentLevel, pathSub); itemHistory.Set(value, key); @@ -1035,7 +1028,7 @@ } else { - if (ViewHandler.RemoveFilterItem()) + if (ViewHandler.RemoveFilterItem()) { FilterItem curFilter; // force reload, this will load the next filter-level..... @@ -1064,7 +1057,7 @@ { // back item in application list clicked // go to father item - lastApp = applicationList.GetAppByID(lastApp.FatherID); + lastApp = GetAppByID(lastApp.FatherID); if (lastApp != null) { mapSettings.LastAppID = lastApp.AppID; @@ -1091,8 +1084,67 @@ } + public List<ApplicationItem> AppsOfFatherID(int FatherID) + { + List<ApplicationItem> applicationItemList = new List<ApplicationItem>(); + foreach (ApplicationItem curApp in allApplicationsList) + { + if (curApp.FatherID == FatherID) + { + applicationItemList.Add(curApp); + } + } + return applicationItemList; + } + public List<ApplicationItem> AppsOfFather(ApplicationItem father) + { + if (father == null) + { + return AppsOfFatherID(-1); // return children of root node! + } + else + { + return AppsOfFatherID(father.AppID); + } + } + + public int GetMaxPosition(int fatherID) + { + int res = 0; + foreach (ApplicationItem curApp in allApplicationsList) + { + if ((curApp.FatherID == fatherID) && (curApp.Position > res)) + { + res = curApp.Position; + } + } + return res; + } + + public ApplicationItem GetAppByID(int targetAppID) + { + foreach (ApplicationItem curApp in allApplicationsList) + { + if (curApp.AppID == targetAppID) + { + return curApp; + } + } + return null; + } + + /* public ApplicationItem CloneAppItem(ApplicationItem sourceApp) + { + ApplicationItem newApp = (ApplicationItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, sourceApp.SourceType, null, 0); + newApp.Assign(sourceApp); + newApp.AppID = -1; // to force a sql INSERT when written + Add(newApp); + return newApp; + }*/ + + void ScrapeFileInfo(FileItem curFile) { int minRelevance = 30; @@ -1199,16 +1251,15 @@ if (item.MusicTag != null) { - ((BaseItem)item.MusicTag).OnClick((BaseItem) item.MusicTag,this); - UpdateButtonStates(); - UpdateListControl(); + ((BaseItem)item.MusicTag).OnClick((BaseItem)item.MusicTag, this); + UpdateButtonStates(); + UpdateListControl(); } else if (item.Label.Equals(ProgramUtils.cBackLabel)) { // folder-item clicked.... selectedItemIndex = -1; BackItemClicked(); UpdateButtonStates(); - } } @@ -1269,9 +1320,6 @@ UpdateButtonStates(); } - - - protected void OnInfo() { @@ -1300,11 +1348,9 @@ { try { - for (int i = 0; i < facadeView.Count; ++i) { GUIListItem item = facadeView[i]; - ViewHandler.SetLabel(item.MusicTag as FileItem, ref item); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-07-24 20:20:46 UTC (rev 758) @@ -143,7 +143,6 @@ <Compile Include="Items\ApplicationItemFactory.cs" /> <Compile Include="Items\ApplicationItemGameBase.cs" /> <Compile Include="Items\ApplicationItemGrouper.cs" /> - <Compile Include="Items\ApplicationItemList.cs" /> <Compile Include="Items\ApplicationItemMame.cs" /> <Compile Include="Items\BaseItem.cs" /> <Compile Include="Items\FileItem.cs" /> Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -336,6 +336,16 @@ + protected void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + /*ApplicationItem targetApp = GetAppByID(curLink.TargetAppID); + if (targetApp != null) + { + targetApp.LaunchFile(curLink, MPGUIMode); + }*/ + } + + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) { if (OnRefreshInfo != null) @@ -496,10 +506,6 @@ } } - protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) - { - this.OnLaunchFilelink(curLink, MPGUIMode); - } void proc_Exited(object sender, EventArgs e) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -26,6 +26,7 @@ using SQLite.NET; using System; using GUIPrograms; +using GUIPrograms.Database; namespace GUIPrograms.Items { @@ -46,54 +47,54 @@ // nothing to create...... } - public BaseItem GetApplicationItem(SQLiteClient sqlDB, ItemType sourceType,SQLiteResultSet results, int iRecord) + public BaseItem GetApplicationItem(ItemType sourceType,SQLiteResultSet results, int iRecord) { BaseItem item = null; switch (sourceType) { case ItemType.DIRCACHE: - item = AppItemFactory(sqlDB, results, iRecord,ItemType.DIRCACHE); + item = AppItemFactory(results, iRecord,ItemType.DIRCACHE); break; case ItemType.MAMEDIRECT: - item = AppItemFactory(sqlDB, results, iRecord,ItemType.MAMEDIRECT); + item = AppItemFactory(results, iRecord,ItemType.MAMEDIRECT); break; case ItemType.GROUPER: - item = AppItemFactory(sqlDB, results, iRecord,ItemType.GROUPER); + item = AppItemFactory(results, iRecord,ItemType.GROUPER); break; case ItemType.GAMEBASE: - item = AppItemFactory(sqlDB, results, iRecord,ItemType.GAMEBASE); + item = AppItemFactory(results, iRecord,ItemType.GAMEBASE); break; case ItemType.FILEITEM: - item = FileItemFactory(sqlDB,results, iRecord); + item = FileItemFactory(results, iRecord); break; case ItemType.FILELINKITEM: - item = FilelinkItemFactory(sqlDB, results, iRecord); + item = FilelinkItemFactory(results, iRecord); break; case ItemType.FILTERITEM: - item = FilterItemFactory(sqlDB, results, iRecord); + item = FilterItemFactory(results, iRecord); break; } return item; } - private ApplicationItem AppItemFactory(SQLiteClient sqldb, SQLiteResultSet results, int recordIndex, ItemType sourceType) + private ApplicationItem AppItemFactory(SQLiteResultSet results, int recordIndex, ItemType sourceType) { ApplicationItem item = null;//= (ApplicationItem)appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"), null, 0); switch (sourceType) { case ItemType.DIRCACHE: - item = new ApplicationItemDirectoryCache(sqldb); + item = new ApplicationItemDirectoryCache(DatabaseHandler.sqlDB); break; case ItemType.MAMEDIRECT: - item = new ApplicationItemMame(sqldb); + item = new ApplicationItemMame(DatabaseHandler.sqlDB); break; case ItemType.GROUPER: - item = new ApplicationItemGrouper(sqldb); + item = new ApplicationItemGrouper(DatabaseHandler.sqlDB); break; case ItemType.GAMEBASE: - item = new ApplicationItemGameBase(sqldb); + item = new ApplicationItemGameBase(DatabaseHandler.sqlDB); break; } @@ -127,9 +128,9 @@ return item; } - private FileItem FileItemFactory(SQLiteClient sqlDB,SQLiteResultSet results, int iRecord) + private FileItem FileItemFactory(SQLiteResultSet results, int iRecord) { - FileItem newFile = new FileItem(sqlDB); + FileItem newFile = new FileItem(DatabaseHandler.sqlDB); newFile.FileID = ProgramUtils.GetIntDef(results, iRecord, "fileid", -1); newFile.AppID = ProgramUtils.GetIntDef(results, iRecord, "applicationId", -1); newFile.Title = ProgramUtils.Get(results, iRecord, "title"); @@ -154,9 +155,9 @@ return newFile; } - private FilterItem FilterItemFactory(SQLiteClient sqlDB,SQLiteResultSet results, int iRecord) + private FilterItem FilterItemFactory(SQLiteResultSet results, int iRecord) { - FilterItem filterItem = new FilterItem(sqlDB); + FilterItem filterItem = new FilterItem(DatabaseHandler.sqlDB); filterItem.Title = ProgramUtils.Get(results, iRecord, "title"); // newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); //newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); ; @@ -164,9 +165,9 @@ } - private FilelinkItem FilelinkItemFactory(SQLiteClient sqlDB, SQLiteResultSet results, int iRecord) + private FilelinkItem FilelinkItemFactory( SQLiteResultSet results, int iRecord) { - FilelinkItem newLink = new FilelinkItem(sqlDB); + FilelinkItem newLink = new FilelinkItem(DatabaseHandler.sqlDB); newLink.FileID = ProgramUtils.GetIntDef(results, iRecord, "fileId", -1); newLink.AppID = ProgramUtils.GetIntDef(results, iRecord, "grouperAppId", -1); newLink.TargetAppID = ProgramUtils.GetIntDef(results, iRecord, "targetAppId", -1); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -143,13 +143,13 @@ { if (ViewHandler.IsFilterQuery) { - FilterItem curFile = (FilterItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, ItemType.FILTERITEM, results, curRow); + FilterItem curFile = (FilterItem)ApplicationItemFactory.AppFactory.GetApplicationItem( ItemType.FILTERITEM, results, curRow); ItemList.Add(curFile); } else { - FilelinkItem curFile = (FilelinkItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, ItemType.FILELINKITEM, results, curRow); + FilelinkItem curFile = (FilelinkItem)ApplicationItemFactory.AppFactory.GetApplicationItem( ItemType.FILELINKITEM, results, curRow); ItemList.Add(curFile); } } Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemList.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemList.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemList.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -1,149 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System.Collections.Generic; -using SQLite.NET; - -using GUIPrograms; -using GUIPrograms.Database; -using GUIPrograms.Items; - -using MediaPortal.GUI.Library; - -namespace GUIPrograms.Items -{ - /// <summary> - /// Summary description for ApplicationItemList. - /// </summary> - public class ApplicationItemList : List<ApplicationItem> - { - public static SQLiteClient sqlDB = null; - - static ApplicationItemFactory appFactory = ApplicationItemFactory.AppFactory; - - static public event ApplicationItem.FilelinkLaunchEventHandler OnLaunchFilelink = null; - - public ApplicationItemList(SQLiteClient initSqlDB, ApplicationItem.FilelinkLaunchEventHandler curHandler) - { - // constructor: save SQLiteDB object and load list from DB - sqlDB = initSqlDB; - OnLaunchFilelink += curHandler; - LoadAll(); - } - - public List<ApplicationItem> AppsOfFatherID(int FatherID) - { - List<ApplicationItem> applicationItemList = new List<ApplicationItem>(); - foreach (ApplicationItem curApp in this) - { - if (curApp.FatherID == FatherID) - { - applicationItemList.Add(curApp); - } - } - return applicationItemList; - } - - public List<ApplicationItem> AppsOfFather(ApplicationItem father) - { - if (father == null) - { - return AppsOfFatherID(-1); // return children of root node! - } - else - { - return AppsOfFatherID(father.AppID); - } - } - - - public ApplicationItem GetAppByID(int targetAppID) - { - foreach (ApplicationItem curApp in this) - { - if (curApp.AppID == targetAppID) - { - return curApp; - } - } - return null; - } - - public ApplicationItem CloneAppItem(ApplicationItem sourceApp) - { - ApplicationItem newApp = (ApplicationItem)appFactory.GetApplicationItem(sqlDB, sourceApp.SourceType,null,0); - newApp.Assign(sourceApp); - newApp.AppID = -1; // to force a sql INSERT when written - Add(newApp); - return newApp; - } - - - static void LaunchFilelink(FilelinkItem curLink, bool mpGuiMode) - { - OnLaunchFilelink(curLink, mpGuiMode); - } - - - public int GetMaxPosition(int fatherID) - { - int res = 0; - foreach (ApplicationItem curApp in this) - { - if ((curApp.FatherID == fatherID) && (curApp.Position > res)) - { - res = curApp.Position; - } - } - return res; - } - - public void LoadAll() - { - if (sqlDB == null) - return; - try - { - Clear(); - if (null == sqlDB) - return; - SQLiteResultSet results; - results = sqlDB.Execute("select * from tblApplicationItem order by iposition"); - if (results.Rows.Count == 0) - return; - for (int row = 0; row < results.Rows.Count; row++) - { - ApplicationItem currentApplicationItem = (ApplicationItem) ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB,ProgramUtils.GetSourceType(results, row, "applicationItemType"),results, row ); - currentApplicationItem.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); - Add(currentApplicationItem); - } - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - } - } - } -} Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -64,7 +64,12 @@ set { importOriginalsOnly = value; } } + public override string CurrentFilePath() + { + return this.FileDirectory; + } + override public bool ProfileLoadingAllowed() { return true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-07-24 14:24:00 UTC (rev 757) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-07-24 20:20:46 UTC (rev 758) @@ -138,12 +138,12 @@ { if (ViewHandler.IsFilterQuery) { - FilterItem curFile = (FilterItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, ItemType.FILTERITEM, results, curRow); + FilterItem curFile = (FilterItem)ApplicationItemFactory.AppFactory.GetApplicationItem(ItemType.FILTERITEM, results, curRow); ItemList.Add(curFile); } else { - FileItem curFile =(FileItem) ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB,ItemType.FILEITEM,results, curRow); + FileItem curFile =(FileItem) ApplicationItemFactory.AppFactory.GetApplicationItem(ItemType.FILEITEM,results, curRow); ItemList.Add(curFile); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-08-03 11:34:01
|
Revision: 787 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=787&view=rev Author: chef_koch Date: 2007-08-03 04:33:59 -0700 (Fri, 03 Aug 2007) Log Message: ----------- first change to use a new tabPage for GlobalSettings instead of using AppSettingsBase, improvements to this and a fix for the msgBox will follow this weekend Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs 2007-08-03 08:07:10 UTC (rev 786) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs 2007-08-03 11:33:59 UTC (rev 787) @@ -1,139 +0,0 @@ -namespace GUIPrograms.Design -{ - partial class AppSettingsRoot - { - /// <summary> - /// Required designer variable. - /// </summary> - private System.ComponentModel.IContainer components = null; - - /// <summary> - /// Clean up any resources being used. - /// </summary> - /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component 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.button1 = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // enabledCheckbox - // - this.toolTip.SetToolTip(this.enabledCheckbox, "Only enabled items will appear in MediaPortal"); - // - // titleLabel - // - this.titleLabel.Size = new System.Drawing.Size(92, 20); - // - // titleTextBox - // - this.toolTip.SetToolTip(this.titleTextBox, "This text will appear in the listitem of MediaPortal\r\n(mandatory)"); - // - // applicationExeButton - // - this.applicationExeButton.Location = new System.Drawing.Point(359, 70); - // - // shellexecuteCheckBox - // - this.toolTip.SetToolTip(this.shellexecuteCheckBox, "Enable this if you want to run a program that is associated with a specific file-" + - "extension.\r\nYou can omit the \"Launching Application\" in this case."); - // - // applicationArgumentsLabel - // - this.toolTip.SetToolTip(this.applicationArgumentsLabel, "Optional arguments that are needed to launch the program \r\n\r\n(advanced hint: Use " + - "%FILE% if the filename needs to be placed in some specific place between several" + - " arguments)"); - // - // applicationImageTextBox - // - this.toolTip.SetToolTip(this.applicationImageTextBox, "Optional filename for an image to display in MediaPortal"); - // - // winStyleComboBox - // - this.toolTip.SetToolTip(this.winStyleComboBox, "Appearance of the launched program. \r\nTry HIDDEN or MINIMIZED for a seamless inte" + - "gration in MediaPortal"); - // - // startupDirTextBox - // - this.toolTip.SetToolTip(this.startupDirComboBox, "Optional path that is passed as the launch-directory \r\n\r\n(advanced hint: Use %FIL" + - "EDIR% if you want to use the directory where the launched file is stored)"); - // - // quoteCheckBox - // - this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + - "le quotes though!"); - // - // applicationImageButton - // - this.applicationImageButton.Location = new System.Drawing.Point(356, 97); - // - // allowRefreshCheckBox - // - this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + - ""); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(427, 43); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(44, 23); - this.button1.TabIndex = 32; - this.button1.Text = "Reset"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // AppSettingsRoot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.button1); - this.Name = "AppSettingsRoot"; - this.Load += new System.EventHandler(this.AppSettingsRoot_Load); - this.Controls.SetChildIndex(this.button1, 0); - this.Controls.SetChildIndex(this.prePostButton, 0); - this.Controls.SetChildIndex(this.applicationImageButton, 0); - this.Controls.SetChildIndex(this.applicationExeButton, 0); - this.Controls.SetChildIndex(this.winTypeLabel, 0); - this.Controls.SetChildIndex(this.enabledCheckbox, 0); - this.Controls.SetChildIndex(this.titleLabel, 0); - this.Controls.SetChildIndex(this.applicationExeLabel, 0); - this.Controls.SetChildIndex(this.shellexecuteCheckBox, 0); - this.Controls.SetChildIndex(this.waitExitCheckBox, 0); - this.Controls.SetChildIndex(this.applicationExeTextBox, 0); - this.Controls.SetChildIndex(this.applicationImageLabel, 0); - this.Controls.SetChildIndex(this.applicationArgumentsLabel, 0); - this.Controls.SetChildIndex(this.applicationImageTextBox, 0); - this.Controls.SetChildIndex(this.applicationArgumentsTextBox, 0); - this.Controls.SetChildIndex(this.winStyleLabel, 0); - this.Controls.SetChildIndex(this.winStyleComboBox, 0); - this.Controls.SetChildIndex(this.startupDirComboBox, 0); - this.Controls.SetChildIndex(this.startupDirLabel, 0); - this.Controls.SetChildIndex(this.quoteCheckBox, 0); - this.Controls.SetChildIndex(this.startupDirButton, 0); - this.Controls.SetChildIndex(this.allowRefreshCheckBox, 0); - this.Controls.SetChildIndex(this.informationLabel, 0); - this.Controls.SetChildIndex(this.titleTextBox, 0); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button button1; - } -} \ No newline at end of file Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs 2007-08-03 08:07:10 UTC (rev 786) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs 2007-08-03 11:33:59 UTC (rev 787) @@ -1,121 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; - -namespace GUIPrograms.Design -{ - public partial class AppSettingsRoot : AppSettingsBase - { - bool Loaded = false; - - public AppSettingsRoot() - { - InitializeComponent(); - } - - private void AppSettingsRoot_Load(object sender, EventArgs e) - { - AppItemToForm(null); - Loaded = true; - - enabledCheckbox.Visible = false; - winTypeLabel.Text = "my Programs Alt."; - titleLabel.Text = "Plugin title"; - titleTextBox.Text = " My Programs Alt."; - - applicationExeLabel.Visible = false; - applicationExeTextBox.Visible = false; - applicationExeButton.Visible = false; - - applicationImageLabel.Visible = false; - applicationImageTextBox.Visible = false; - applicationImageButton.Visible = false; - - applicationArgumentsTextBox.Visible = false; - applicationArgumentsLabel.Visible = false; - - winStyleLabel.Visible = false; - winStyleComboBox.Visible = false; - - startupDirButton.Visible = false; - startupDirLabel.Visible = false; - startupDirComboBox.Visible = false; - - - quoteCheckBox.Visible = false; - allowRefreshCheckBox.Visible = false; - waitExitCheckBox.Visible = false; - shellexecuteCheckBox.Visible = false; - informationLabel.Visible = false; - - this.prePostButton.Visible = false; - - } - - public override bool AppItemToForm(ApplicationItem curApp) - { - base.AppItemToForm(curApp); - titleTextBox.Text = DatabaseHandler.ReadSetting(ProgramUtils.cPLUGINTITLE); - if (titleTextBox.Text == "") - { - // PluginTitle.Text = GUILocalizeStrings.Get(0); - titleTextBox.Text = "My Programs Alt."; - } - return true; - } - - public override void FormToAppItem(ApplicationItem curApp) - { - // currentApplication is null! - if (Loaded) - { - if ((titleTextBox.Text != "")) - { - DatabaseHandler.WriteSetting(ProgramUtils.cPLUGINTITLE, titleTextBox.Text); - } - else - { - DatabaseHandler.DeleteSetting(ProgramUtils.cPLUGINTITLE); - } - } - } - - private void button1_Click(object sender, EventArgs e) - { - titleTextBox.Text = "My Programs Alt."; - } - } -} \ No newline at end of file Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx 2007-08-03 08:07:10 UTC (rev 786) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx 2007-08-03 11:33:59 UTC (rev 787) @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" use="required" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>313, 17</value> - </metadata> - <metadata name="folderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>150, 17</value> - </metadata> - <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> - </metadata> -</root> \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-03 08:07:10 UTC (rev 786) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-03 11:33:59 UTC (rev 787) @@ -28,440 +28,514 @@ /// </summary> private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode( "Applications" ); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.applicationWithFiledirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addGroupnodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.extendedApplicationItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.mameImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importGamebaseItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.premadeConfigurationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.emulatorSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.treeView = new System.Windows.Forms.TreeView(); - this.tabControl = new System.Windows.Forms.TabControl(); - this.detailsTabPage = new System.Windows.Forms.TabPage(); - this.directoryTabPage = new System.Windows.Forms.TabPage(); - this.viewTabPage = new System.Windows.Forms.TabPage(); - this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); - this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); - this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); - this.removePlatformLabel = new System.Windows.Forms.Label(); - this.removePlatformButton = new System.Windows.Forms.Button(); - this.addPlatformLabel = new System.Windows.Forms.Label(); - this.addPlatformTextBox = new System.Windows.Forms.TextBox(); - this.addPlatformButton = new System.Windows.Forms.Button(); - this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); - this.removeManufacturerLabel = new System.Windows.Forms.Label(); - this.removeManufacturerButton = new System.Windows.Forms.Button(); - this.addManufacturerLabel = new System.Windows.Forms.Label(); - this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); - this.addManufacturerButton = new System.Windows.Forms.Button(); - this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); - this.removeGenreLabel = new System.Windows.Forms.Label(); - this.removeGenreButton = new System.Windows.Forms.Button(); - this.addGenreLabel = new System.Windows.Forms.Label(); - this.addGenreTextBox = new System.Windows.Forms.TextBox(); - this.addGenreButton = new System.Windows.Forms.Button(); - this.menuStrip.SuspendLayout(); - this.tabControl.SuspendLayout(); - this.dbOptionsTabPage.SuspendLayout(); - this.generalFileItemOptionsGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip - // - this.menuStrip.Items.AddRange( new System.Windows.Forms.ToolStripItem[] { + System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Applications"); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.applicationWithFiledirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addGroupnodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.extendedApplicationItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mameImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importGamebaseItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.premadeConfigurationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.emulatorSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.treeView = new System.Windows.Forms.TreeView(); + this.tabControl = new System.Windows.Forms.TabControl(); + this.detailsTabPage = new System.Windows.Forms.TabPage(); + this.directoryTabPage = new System.Windows.Forms.TabPage(); + this.settingsTabPage = new System.Windows.Forms.TabPage(); + this.button2 = new System.Windows.Forms.Button(); + this.titleTextBox = new System.Windows.Forms.TextBox(); + this.titleLabel = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.checkBoxUseThumbsDir = new System.Windows.Forms.CheckBox(); + this.viewTabPage = new System.Windows.Forms.TabPage(); + this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); + this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); + this.removePlatformLabel = new System.Windows.Forms.Label(); + this.removePlatformButton = new System.Windows.Forms.Button(); + this.addPlatformLabel = new System.Windows.Forms.Label(); + this.addPlatformTextBox = new System.Windows.Forms.TextBox(); + this.addPlatformButton = new System.Windows.Forms.Button(); + this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.removeManufacturerLabel = new System.Windows.Forms.Label(); + this.removeManufacturerButton = new System.Windows.Forms.Button(); + this.addManufacturerLabel = new System.Windows.Forms.Label(); + this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); + this.addManufacturerButton = new System.Windows.Forms.Button(); + this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); + this.removeGenreLabel = new System.Windows.Forms.Label(); + this.removeGenreButton = new System.Windows.Forms.Button(); + this.addGenreLabel = new System.Windows.Forms.Label(); + this.addGenreTextBox = new System.Windows.Forms.TextBox(); + this.addGenreButton = new System.Windows.Forms.Button(); + this.menuStrip.SuspendLayout(); + this.tabControl.SuspendLayout(); + this.settingsTabPage.SuspendLayout(); + this.dbOptionsTabPage.SuspendLayout(); + this.generalFileItemOptionsGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip + // + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addDeleteApplicationsToolStripMenuItem, - this.toolsStripMenuItem} ); - this.menuStrip.Location = new System.Drawing.Point( 0, 0 ); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.menuStrip.Size = new System.Drawing.Size( 747, 24 ); - this.menuStrip.TabIndex = 0; - this.menuStrip.Text = "menuStrip"; - // - // addDeleteApplicationsToolStripMenuItem - // - this.addDeleteApplicationsToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.toolsStripMenuItem}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.menuStrip.Size = new System.Drawing.Size(747, 24); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "menuStrip"; + // + // addDeleteApplicationsToolStripMenuItem + // + this.addDeleteApplicationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addApplicationToolStripMenuItem, - this.deleteApplicationToolStripMenuItem} ); - this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; - this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size( 132, 20 ); - this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; - // - // addApplicationToolStripMenuItem - // - this.addApplicationToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.deleteApplicationToolStripMenuItem}); + this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; + this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(132, 20); + this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; + // + // addApplicationToolStripMenuItem + // + this.addApplicationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.applicationWithFiledirectoryToolStripMenuItem, this.addGroupnodeToolStripMenuItem, - this.extendedApplicationItemToolStripMenuItem} ); - this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; - this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.addApplicationToolStripMenuItem.Text = "Add application"; - // - // applicationWithFiledirectoryToolStripMenuItem - // - this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; - this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); - this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; - this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler( this.applicationWithFiledirectoryToolStripMenuItem_Click ); - // - // addGroupnodeToolStripMenuItem - // - this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; - this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); - this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; - this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler( this.addGroupnodeToolStripMenuItem_Click ); - // - // extendedApplicationItemToolStripMenuItem - // - this.extendedApplicationItemToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.extendedApplicationItemToolStripMenuItem}); + this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; + this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.addApplicationToolStripMenuItem.Text = "Add application"; + // + // applicationWithFiledirectoryToolStripMenuItem + // + this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; + this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; + this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler(this.applicationWithFiledirectoryToolStripMenuItem_Click); + // + // addGroupnodeToolStripMenuItem + // + this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; + this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; + this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler(this.addGroupnodeToolStripMenuItem_Click); + // + // extendedApplicationItemToolStripMenuItem + // + this.extendedApplicationItemToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mameImportToolStripMenuItem, - this.importGamebaseItemToolStripMenuItem} ); - this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; - this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); - this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; - // - // mameImportToolStripMenuItem - // - this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; - this.mameImportToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.mameImportToolStripMenuItem.Text = "Import Mame"; - this.mameImportToolStripMenuItem.Click += new System.EventHandler( this.mameImportToolStripMenuItem_Click ); - // - // importGamebaseItemToolStripMenuItem - // - this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; - this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; - this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler( this.importGamebaseItemToolStripMenuItem_Click ); - // - // deleteApplicationToolStripMenuItem - // - this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; - this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; - this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.deleteApplicationToolStripMenuItem.Text = "Delete application"; - this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler( this.deleteApplicationToolStripMenuItem_Click ); - // - // toolsStripMenuItem - // - this.toolsStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { - this.premadeConfigurationsToolStripMenuItem} ); - this.toolsStripMenuItem.Name = "toolsStripMenuItem"; - this.toolsStripMenuItem.Size = new System.Drawing.Size( 44, 20 ); - this.toolsStripMenuItem.Text = "Tools"; - // - // premadeConfigurationsToolStripMenuItem - // - this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { - this.emulatorSetupToolStripMenuItem} ); - this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; - this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size( 155, 22 ); - this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; - // - // emulatorSetupToolStripMenuItem - // - this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; - this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size( 158, 22 ); - this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; - // - // treeView - // - this.treeView.AllowDrop = true; - this.treeView.HideSelection = false; - this.treeView.HotTracking = true; - this.treeView.LabelEdit = true; - this.treeView.Location = new System.Drawing.Point( 0, 27 ); - this.treeView.Name = "treeView"; - treeNode1.Name = "applicationNode"; - treeNode1.Text = "Applications"; - this.treeView.Nodes.AddRange( new System.Windows.Forms.TreeNode[] { - treeNode1} ); - this.treeView.Size = new System.Drawing.Size( 224, 576 ); - this.treeView.TabIndex = 8; - this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler( this.treeView_DragDrop ); - this.treeView.DragOver += new System.Windows.Forms.DragEventHandler( this.treeView_DragOver ); - this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler( this.treeView_AfterLabelEdit ); - this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler( this.treeView_AfterSelect ); - this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler( this.treeView_NodeMouseClick ); - this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler( this.treeView_DragEnter ); - this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler( this.treeView_BeforeLabelEdit ); - this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler( this.treeView_BeforeSelect ); - this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler( this.treeView_ItemDrag ); - // - // tabControl - // - this.tabControl.Controls.Add( this.detailsTabPage ); - this.tabControl.Controls.Add( this.directoryTabPage ); - this.tabControl.Controls.Add( this.viewTabPage ); - this.tabControl.Controls.Add( this.dbOptionsTabPage ); - this.tabControl.Location = new System.Drawing.Point( 230, 27 ); - this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 0; - this.tabControl.ShowToolTips = true; - this.tabControl.Size = new System.Drawing.Size( 505, 577 ); - this.tabControl.TabIndex = 2; - this.tabControl.Click += new System.EventHandler( this.dbOptionsTabPage_Click ); - this.tabControl.SelectedIndexChanged += new System.EventHandler( this.tabControl_SelectedIndexChanged ); - // - // detailsTabPage - // - this.detailsTabPage.BackColor = System.Drawing.SystemColors.Control; - this.detailsTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.detailsTabPage.Name = "detailsTabPage"; - this.detailsTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.detailsTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.detailsTabPage.TabIndex = 0; - this.detailsTabPage.Text = "Details"; - // - // directoryTabPage - // - this.directoryTabPage.BackColor = System.Drawing.SystemColors.Control; - this.directoryTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.directoryTabPage.Name = "directoryTabPage"; - this.directoryTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.directoryTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.directoryTabPage.TabIndex = 1; - this.directoryTabPage.Text = "Files"; - // - // viewTabPage - // - this.viewTabPage.BackColor = System.Drawing.SystemColors.Control; - this.viewTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.viewTabPage.Name = "viewTabPage"; - this.viewTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.viewTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.viewTabPage.TabIndex = 2; - this.viewTabPage.Text = "Views"; - // - // dbOptionsTabPage - // - this.dbOptionsTabPage.Controls.Add( this.generalFileItemOptionsGroupBox ); - this.dbOptionsTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.dbOptionsTabPage.Name = "dbOptionsTabPage"; - this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.dbOptionsTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.dbOptionsTabPage.TabIndex = 3; - this.dbOptionsTabPage.Text = "DB options"; - this.dbOptionsTabPage.UseVisualStyleBackColor = true; - this.dbOptionsTabPage.Click += new System.EventHandler( this.dbOptionsTabPage_Click ); - // - // generalFileItemOptionsGroupBox - // - this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformComboBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformTextBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerComboBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerTextBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreComboBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreTextBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreButton ); - this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point( 3, 6 ); - this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; - this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size( 488, 496 ); - this.generalFileItemOptionsGroupBox.TabIndex = 79; - this.generalFileItemOptionsGroupBox.TabStop = false; - // - // removePlatformComboBox - // - this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removePlatformComboBox.FormattingEnabled = true; - this.removePlatformComboBox.Location = new System.Drawing.Point( 99, 249 ); - this.removePlatformComboBox.Name = "removePlatformComboBox"; - this.removePlatformComboBox.Size = new System.Drawing.Size( 306, 21 ); - this.removePlatformComboBox.TabIndex = 92; - // - // removePlatformLabel - // - this.removePlatformLabel.AutoSize = true; - this.removePlatformLabel.Location = new System.Drawing.Point( 6, 252 ); - this.removePlatformLabel.Name = "removePlatformLabel"; - this.removePlatformLabel.Size = new System.Drawing.Size( 87, 13 ); - this.removePlatformLabel.TabIndex = 91; - this.removePlatformLabel.Text = "Remove platform"; - // - // removePlatformButton - // - this.removePlatformButton.Location = new System.Drawing.Point( 411, 249 ); - this.removePlatformButton.Name = "removePlatformButton"; - this.removePlatformButton.Size = new System.Drawing.Size( 62, 23 ); - this.removePlatformButton.TabIndex = 90; - this.removePlatformButton.Text = "Remove.."; - this.removePlatformButton.UseVisualStyleBackColor = true; - this.removePlatformButton.Click += new System.EventHandler( this.removePlatformButton_Click ); - // - // addPlatformLabel - // - this.addPlatformLabel.AutoSize = true; - this.addPlatformLabel.Location = new System.Drawing.Point( 6, 216 ); - this.addPlatformLabel.Name = "addPlatformLabel"; - this.addPlatformLabel.Size = new System.Drawing.Size( 72, 13 ); - this.addPlatformLabel.TabIndex = 87; - this.addPlatformLabel.Text = "Add platform.."; - // - // addPlatformTextBox - // - this.addPlatformTextBox.Location = new System.Drawing.Point( 99, 213 ); - this.addPlatformTextBox.Name = "addPlatformTextBox"; - this.addPlatformTextBox.Size = new System.Drawing.Size( 306, 20 ); - this.addPlatformTextBox.TabIndex = 88; - // - // addPlatformButton - // - this.addPlatformButton.Location = new System.Drawing.Point( 411, 213 ); - this.addPlatformButton.Name = "addPlatformButton"; - this.addPlatformButton.Size = new System.Drawing.Size( 62, 23 ); - this.addPlatformButton.TabIndex = 89; - this.addPlatformButton.Text = "Add.."; - this.addPlatformButton.UseVisualStyleBackColor = true; - this.addPlatformButton.Click += new System.EventHandler( this.addPlatformButton_Click ); - // - // removeManufacturerComboBox - // - this.removeManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removeManufacturerComboBox.FormattingEnabled = true; - this.removeManufacturerComboBox.Location = new System.Drawing.Point( 99, 165 ); - this.removeManufacturerComboBox.Name = "removeManufacturerComboBox"; - this.removeManufacturerComboBox.Size = new System.Drawing.Size( 306, 21 ); - this.removeManufacturerComboBox.TabIndex = 86; - // - // removeManufacturerLabel - // - this.removeManufacturerLabel.Location = new System.Drawing.Point( 6, 157 ); - this.removeManufacturerLabel.Name = "removeManufacturerLabel"; - this.removeManufacturerLabel.Size = new System.Drawing.Size( 82, 29 ); - this.removeManufacturerLabel.TabIndex = 85; - this.removeManufacturerLabel.Text = "Remove Manufacturer"; - // - // removeManufacturerButton - // - this.removeManufacturerButton.Location = new System.Drawing.Point( 411, 165 ); - this.removeManufacturerButton.Name = "removeManufacturerButton"; - this.removeManufacturerButton.Size = new System.Drawing.Size( 62, 23 ); - this.removeManufacturerButton.TabIndex = 84; - this.removeManufacturerButton.Text = "Remove.."; - this.removeManufacturerButton.UseVisualStyleBackColor = true; - this.removeManufacturerButton.Click += new System.EventHandler( this.removeManufacturerButton_Click ); - // - // addManufacturerLabel - // - this.addManufacturerLabel.Location = new System.Drawing.Point( 6, 121 ); - this.addManufacturerLabel.Name = "addManufacturerLabel"; - this.addManufacturerLabel.Size = new System.Drawing.Size( 82, 36 ); - this.addManufacturerLabel.TabIndex = 81; - this.addManufacturerLabel.Text = "Add Manufacturer.."; - // - // addManufacturerTextBox - // - this.addManufacturerTextBox.Location = new System.Drawing.Point( 99, 129 ); - this.addManufacturerTextBox.Name = "addManufacturerTextBox"; - this.addManufacturerTextBox.Size = new System.Drawing.Size( 306, 20 ); - this.addManufacturerTextBox.TabIndex = 82; - // - // addManufacturerButton - // - this.addManufacturerButton.Location = new System.Drawing.Point( 411, 129 ); - this.addManufacturerButton.Name = "addManufacturerButton"; - this.addManufacturerButton.Size = new System.Drawing.Size( 62, 23 ); - this.addManufacturerButton.TabIndex = 83; - this.addManufacturerButton.Text = "Add.."; - this.addManufacturerButton.UseVisualStyleBackColor = true; - this.addManufacturerButton.Click += new System.EventHandler( this.addManufacturerButton_Click ); - // - // removeGenreComboBox - // - this.removeGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removeGenreComboBox.FormattingEnabled = true; - this.removeGenreComboBox.Location = new System.Drawing.Point( 99, 70 ); - this.removeGenreComboBox.Name = "removeGenreComboBox"; - this.removeGenreComboBox.Size = new System.Drawing.Size( 306, 21 ); - this.removeGenreComboBox.TabIndex = 80; - // - // removeGenreLabel - // - this.removeGenreLabel.AutoSize = true; - this.removeGenreLabel.Location = new System.Drawing.Point( 6, 73 ); - this.removeGenreLabel.Name = "removeGenreLabel"; - this.removeGenreLabel.Size = new System.Drawing.Size( 77, 13 ); - this.removeGenreLabel.TabIndex = 79; - this.removeGenreLabel.Text = "Remove genre"; - // - // removeGenreButton - // - this.removeGenreButton.Location = new System.Drawing.Point( 411, 70 ); - this.removeGenreButton.Name = "removeGenreButton"; - this.removeGenreButton.Size = new System.Drawing.Size( 62, 23 ); - this.removeGenreButton.TabIndex = 78; - this.removeGenreButton.Text = "Remove.."; - this.removeGenreButton.UseVisualStyleBackColor = true; - this.removeGenreButton.Click += new System.EventHandler( this.removeGenreButton_Click ); - // - // addGenreLabel - // - this.addGenreLabel.AutoSize = true; - this.addGenreLabel.Location = new System.Drawing.Point( 6, 37 ); - this.addGenreLabel.Name = "addGenreLabel"; - this.addGenreLabel.Size = new System.Drawing.Size( 62, 13 ); - this.addGenreLabel.TabIndex = 74; - this.addGenreLabel.Text = "Add genre.."; - // - // addGenreTextBox - // - this.addGenreTextBox.Location = new System.Drawing.Point( 99, 34 ); - this.addGenreTextBox.Name = "addGenreTextBox"; - this.addGenreTextBox.Size = new System.Drawing.Size( 306, 20 ); - this.addGenreTextBox.TabIndex = 75; - // - // addGenreButton - // - this.addGenreButton.Location = new System.Drawing.Point( 411, 34 ); - this.addGenreButton.Name = "addGenreButton"; - this.addGenreButton.Size = new System.Drawing.Size( 62, 23 ); - this.addGenreButton.TabIndex = 76; - this.addGenreButton.Text = "Add.."; - this.addGenreButton.UseVisualStyleBackColor = true; - this.addGenreButton.Click += new System.EventHandler( this.addGenreButton_Click ); - // - // SetupForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F ); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size( 747, 609 ); - this.Controls.Add( this.tabControl ); - this.Controls.Add( this.treeView ); - this.Controls.Add( this.menuStrip ); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MainMenuStrip = this.menuStrip; - this.Name = "SetupForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "SetupForm"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler( this.SetupForm_FormClosed ); - this.Load += new System.EventHandler( this.SetupForm_Load ); - this.menuStrip.ResumeLayout( false ); - this.menuStrip.PerformLayout(); - this.tabControl.ResumeLayout( false ); - this.dbOptionsTabPage.ResumeLayout( false ); - this.generalFileItemOptionsGroupBox.ResumeLayout( false ); - this.generalFileItemOptionsGroupBox.PerformLayout(); - this.ResumeLayout( false ); - this.PerformLayout(); + this.importGamebaseItemToolStripMenuItem}); + this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; + this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; + // + // mameImportToolStripMenuItem + // + this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; + this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.mameImportToolStripMenuItem.Text = "Import Mame"; + this.mameImportToolStripMenuItem.Click += new System.EventHandler(this.mameImportToolStripMenuItem_Click); + // + // importGamebaseItemToolStripMenuItem + // + this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; + this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; + this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler(this.importGamebaseItemToolStripMenuItem_Click); + // + // deleteApplicationToolStripMenuItem + // + this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; + this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; + this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.deleteApplicationToolStripMenuItem.Text = "Delete application"; + this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler(this.deleteApplicationToolStripMenuItem_Click); + // + // toolsStripMenuItem + // + this.toolsStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.premadeConfigurationsToolStripMenuItem}); + this.toolsStripMenuItem.Name = "toolsStripMenuItem"; + this.toolsStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.toolsStripMenuItem.Text = "Tools"; + // + // premadeConfigurationsToolStripMenuItem + // + this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.emulatorSetupToolStripMenuItem}); + this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; + this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(155, 22); + this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; + // + // emulatorSetupToolStripMenuItem + // + this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; + this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(158, 22); + this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; + // + // treeView + // + this.treeView.AllowDrop = true; + this.treeView.HideSelection = false; + this.treeView.HotTracking = true; + this.treeView.LabelEdit = true; + this.treeView.Location = new System.Drawing.Point(0, 27); + this.treeView.Name = "treeView"; + treeNode3.Name = "applicationNode"; + treeNode3.Text = "Applications"; + this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { + treeNode3}); + this.treeView.Size = new System.Drawing.Size(224, 576); + this.treeView.TabIndex = 8; + this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_AfterLabelEdit); + this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); + this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); + this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter); + this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); + this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_BeforeLabelEdit); + this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeSelect); + this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag); + this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); + // + // tabControl + // + this.tabControl.Controls.Add(this.detailsTabPage); + this.tabControl.Controls.Add(this.directoryTabPage); + this.tabControl.Controls.Add(this.settingsTabPage); + this.tabControl.Controls.Add(this.viewTabPage); + this.tabControl.Controls.Add(this.dbOptionsTabPage); + this.tabControl.Location = new System.Drawing.Point(230, 27); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.ShowToolTips = true; + this.tabControl.Size = new System.Drawing.Size(505, 577); + this.tabControl.TabIndex = 2; + this.tabControl.Click += new System.EventHandler(this.dbOptionsTabPage_Click); + this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); + // + // detailsTabPage + // + this.detailsTabPage.BackColor = System.Drawing.Color.Transparent; + this.detailsTabPage.Location = new System.Drawing.Point(4, 22); + this.detailsTabPage.Name = "detailsTabPage"; + this.detailsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.detailsTabPage.Size = new System.Drawing.Size(497, 551); + this.detailsTabPage.TabIndex = 0; + this.detailsTabPage.Text = "Details"; + this.detailsTabPage.UseVisualStyleBackColor = true; + // + // directoryTabPage + // + this.directoryTabPage.BackColor = System.Drawing.Color.Transparent; + this.directoryTabPage.Location = new System.Drawing.Point(4, 22); + this.directoryTabPage.Name = "directoryTabPage"; + this.directoryTabPage.Padding = new System.Windows.Forms.Padding(3); + this.directoryTabPage.Size = new System.Drawing.Size(497, 551); + this.directoryTabPage.TabIndex = 1; + this.directoryTabPage.Text = "Files"; + this.directoryTabPage.UseVisualStyleBackColor = true; + // + // settingsTabPage + // + this.settingsTabPage.Controls.Add(this.button2); + this.settingsTabPage.Controls.Add(this.titleTextBox); + this.settingsTabPage.Controls.Add(this.titleLabel); + this.settingsTabPage.Controls.Add(this.button1); + this.settingsTabPage.Controls.Add(this.checkBoxUseThumbsDir); + this.settingsTabPage.Location = new System.Drawing.Point(4, 22); + this.settingsTabPage.Name = "settingsTabPage"; + this.settingsTabPage.Size = new System.Drawing.Size(497, 551); + this.settingsTabPage.TabIndex = 4; + this.settingsTabPage.Text = "Settings"; + this.settingsTabPage.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(172, 230); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 42; + this.button2.Text = "save"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // titleTextBox + // + this.titleTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.titleTextBox.Location = new System.Drawing.Point(102, 34); + this.titleTextBox.Name = "titleTextBox"; + this.titleTextBox.Size = new System.Drawing.Size(325, 21); + this.titleTextBox.TabIndex = 41; + // + // titleLabel + // + this.titleLabel.Location = new System.Drawing.Point(11, 34); + this.titleLabel.Name = "titleLabel"; + this.titleLabel.Size = new System.Drawing.Size(93, 20); + this.titleLabel.TabIndex = 40; + this.titleLabel.Text = "Title:"; + this.titleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(433, 34); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(44, 23); + this.button1.TabIndex = 38; + this.button1.Text = "Reset"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // checkBoxUseThumbsDir + // + this.checkBoxUseThumbsDir.AutoSize = true; + this.checkBoxUseThumbsDir.Location = new System.Drawing.Point(14, 104); + this.checkBoxUseThumbsDir.Name = "checkBoxUseThumbsDir"; + this.checkBoxUseThumbsDir.Size = new System.Drawing.Size(129, 17); + this.checkBoxUseThumbsDir.TabIndex = 39; + this.checkBoxUseThumbsDir.Text = "usw thumbs directory"; + this.checkBoxUseThumbsDir.UseVisualStyleBackColor = true; + // + // viewTabPage + // + this.viewTabPage.BackColor = System.Drawing.Color.Transparent; + this.viewTabPage.Location = new System.Drawing.Point(4, 22); + this.viewTabPage.Name = "viewTabPage"; + this.viewTabPage.Padding = new System.Windows.Forms.Padding(3); + this.viewTabPage.Size = new System.Drawing.Size(497, 551); + this.viewTabPage.TabIndex = 2; + this.viewTabPage.Text = "Views"; + this.viewTabPage.UseVisualStyleBackColor = true; + // + // dbOptionsTabPage + // + this.dbOptionsTabPage.Controls.Add(this.generalFileItemOptionsGroupBox); + this.dbOptionsTabPage.Location = new System.Drawing.Point(4, 22); + this.dbOptionsTabPage.Name = "dbOptionsTabPage"; + this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.dbOptionsTabPage.Size = new System.Drawing.Size(497, 551); + this.dbOptionsTabPage.TabIndex = 3; + this.dbOptionsTabPage.Text = "DB options"; + this.dbOptionsTabPage.UseVisualStyleBackColor = true; + this.dbOptionsTabPage.Click += new System.EventHandler(this.dbOptionsTabPage_Click); + // + // generalFileItemOptionsGroupBox + // + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); + this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(3, 6); + this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; + this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(488, 496); + this.generalFileItemOptionsGroupBox.TabIndex = 79; + this.generalFileItemOptionsGroupBox.TabStop = false; + // + // removePlatformComboBox + // + this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removePlatformComboBox.FormattingEnabled = true; + this.removePlatformComboBox.Location = new System.Drawing.Point(99, 249); + this.removePlatformComboBox.Name = "removePlatformComboBox"; + this.removePlatformComboBox.Size = new System.Drawing.Size(306, 21); + this.removePlatformComboBox.TabIndex ... [truncated message content] |
From: <che...@us...> - 2007-08-04 01:48:19
|
Revision: 789 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=789&view=rev Author: chef_koch Date: 2007-08-03 18:48:16 -0700 (Fri, 03 Aug 2007) Log Message: ----------- reverted last change, need to spent more time on it Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs 2007-08-04 01:48:16 UTC (rev 789) @@ -0,0 +1,139 @@ +namespace GUIPrograms.Design +{ + partial class AppSettingsRoot + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component 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.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // enabledCheckbox + // + this.toolTip.SetToolTip(this.enabledCheckbox, "Only enabled items will appear in MediaPortal"); + // + // titleLabel + // + this.titleLabel.Size = new System.Drawing.Size(92, 20); + // + // titleTextBox + // + this.toolTip.SetToolTip(this.titleTextBox, "This text will appear in the listitem of MediaPortal\r\n(mandatory)"); + // + // applicationExeButton + // + this.applicationExeButton.Location = new System.Drawing.Point(359, 70); + // + // shellexecuteCheckBox + // + this.toolTip.SetToolTip(this.shellexecuteCheckBox, "Enable this if you want to run a program that is associated with a specific file-" + + "extension.\r\nYou can omit the \"Launching Application\" in this case."); + // + // applicationArgumentsLabel + // + this.toolTip.SetToolTip(this.applicationArgumentsLabel, "Optional arguments that are needed to launch the program \r\n\r\n(advanced hint: Use " + + "%FILE% if the filename needs to be placed in some specific place between several" + + " arguments)"); + // + // applicationImageTextBox + // + this.toolTip.SetToolTip(this.applicationImageTextBox, "Optional filename for an image to display in MediaPortal"); + // + // winStyleComboBox + // + this.toolTip.SetToolTip(this.winStyleComboBox, "Appearance of the launched program. \r\nTry HIDDEN or MINIMIZED for a seamless inte" + + "gration in MediaPortal"); + // + // startupDirTextBox + // + this.toolTip.SetToolTip(this.startupDirComboBox, "Optional path that is passed as the launch-directory \r\n\r\n(advanced hint: Use %FIL" + + "EDIR% if you want to use the directory where the launched file is stored)"); + // + // quoteCheckBox + // + this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + + "le quotes though!"); + // + // applicationImageButton + // + this.applicationImageButton.Location = new System.Drawing.Point(356, 97); + // + // allowRefreshCheckBox + // + this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + + ""); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(427, 43); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(44, 23); + this.button1.TabIndex = 32; + this.button1.Text = "Reset"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // AppSettingsRoot + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.button1); + this.Name = "AppSettingsRoot"; + this.Load += new System.EventHandler(this.AppSettingsRoot_Load); + this.Controls.SetChildIndex(this.button1, 0); + this.Controls.SetChildIndex(this.prePostButton, 0); + this.Controls.SetChildIndex(this.applicationImageButton, 0); + this.Controls.SetChildIndex(this.applicationExeButton, 0); + this.Controls.SetChildIndex(this.winTypeLabel, 0); + this.Controls.SetChildIndex(this.enabledCheckbox, 0); + this.Controls.SetChildIndex(this.titleLabel, 0); + this.Controls.SetChildIndex(this.applicationExeLabel, 0); + this.Controls.SetChildIndex(this.shellexecuteCheckBox, 0); + this.Controls.SetChildIndex(this.waitExitCheckBox, 0); + this.Controls.SetChildIndex(this.applicationExeTextBox, 0); + this.Controls.SetChildIndex(this.applicationImageLabel, 0); + this.Controls.SetChildIndex(this.applicationArgumentsLabel, 0); + this.Controls.SetChildIndex(this.applicationImageTextBox, 0); + this.Controls.SetChildIndex(this.applicationArgumentsTextBox, 0); + this.Controls.SetChildIndex(this.winStyleLabel, 0); + this.Controls.SetChildIndex(this.winStyleComboBox, 0); + this.Controls.SetChildIndex(this.startupDirComboBox, 0); + this.Controls.SetChildIndex(this.startupDirLabel, 0); + this.Controls.SetChildIndex(this.quoteCheckBox, 0); + this.Controls.SetChildIndex(this.startupDirButton, 0); + this.Controls.SetChildIndex(this.allowRefreshCheckBox, 0); + this.Controls.SetChildIndex(this.informationLabel, 0); + this.Controls.SetChildIndex(this.titleTextBox, 0); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs 2007-08-04 01:48:16 UTC (rev 789) @@ -0,0 +1,121 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using GUIPrograms; +using GUIPrograms.Items; +using GUIPrograms.Database; + +namespace GUIPrograms.Design +{ + public partial class AppSettingsRoot : AppSettingsBase + { + bool Loaded = false; + + public AppSettingsRoot() + { + InitializeComponent(); + } + + private void AppSettingsRoot_Load(object sender, EventArgs e) + { + AppItemToForm(null); + Loaded = true; + + enabledCheckbox.Visible = false; + winTypeLabel.Text = "my Programs Alt."; + titleLabel.Text = "Plugin title"; + titleTextBox.Text = " My Programs Alt."; + + applicationExeLabel.Visible = false; + applicationExeTextBox.Visible = false; + applicationExeButton.Visible = false; + + applicationImageLabel.Visible = false; + applicationImageTextBox.Visible = false; + applicationImageButton.Visible = false; + + applicationArgumentsTextBox.Visible = false; + applicationArgumentsLabel.Visible = false; + + winStyleLabel.Visible = false; + winStyleComboBox.Visible = false; + + startupDirButton.Visible = false; + startupDirLabel.Visible = false; + startupDirComboBox.Visible = false; + + + quoteCheckBox.Visible = false; + allowRefreshCheckBox.Visible = false; + waitExitCheckBox.Visible = false; + shellexecuteCheckBox.Visible = false; + informationLabel.Visible = false; + + this.prePostButton.Visible = false; + + } + + public override bool AppItemToForm(ApplicationItem curApp) + { + base.AppItemToForm(curApp); + titleTextBox.Text = DatabaseHandler.ReadSetting(ProgramUtils.cPLUGINTITLE); + if (titleTextBox.Text == "") + { + // PluginTitle.Text = GUILocalizeStrings.Get(0); + titleTextBox.Text = "My Programs Alt."; + } + return true; + } + + public override void FormToAppItem(ApplicationItem curApp) + { + // currentApplication is null! + if (Loaded) + { + if ((titleTextBox.Text != "")) + { + DatabaseHandler.WriteSetting(ProgramUtils.cPLUGINTITLE, titleTextBox.Text); + } + else + { + DatabaseHandler.DeleteSetting(ProgramUtils.cPLUGINTITLE); + } + } + } + + private void button1_Click(object sender, EventArgs e) + { + titleTextBox.Text = "My Programs Alt."; + } + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx 2007-08-04 01:48:16 UTC (rev 789) @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>313, 17</value> + </metadata> + <metadata name="folderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>150, 17</value> + </metadata> + <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-03 16:49:07 UTC (rev 788) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-04 01:48:16 UTC (rev 789) @@ -28,514 +28,440 @@ /// </summary> private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Applications"); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.applicationWithFiledirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addGroupnodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.extendedApplicationItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.mameImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importGamebaseItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.premadeConfigurationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.emulatorSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.treeView = new System.Windows.Forms.TreeView(); - this.tabControl = new System.Windows.Forms.TabControl(); - this.detailsTabPage = new System.Windows.Forms.TabPage(); - this.directoryTabPage = new System.Windows.Forms.TabPage(); - this.settingsTabPage = new System.Windows.Forms.TabPage(); - this.button2 = new System.Windows.Forms.Button(); - this.titleTextBox = new System.Windows.Forms.TextBox(); - this.titleLabel = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.checkBoxUseThumbsDir = new System.Windows.Forms.CheckBox(); - this.viewTabPage = new System.Windows.Forms.TabPage(); - this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); - this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); - this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); - this.removePlatformLabel = new System.Windows.Forms.Label(); - this.removePlatformButton = new System.Windows.Forms.Button(); - this.addPlatformLabel = new System.Windows.Forms.Label(); - this.addPlatformTextBox = new System.Windows.Forms.TextBox(); - this.addPlatformButton = new System.Windows.Forms.Button(); - this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); - this.removeManufacturerLabel = new System.Windows.Forms.Label(); - this.removeManufacturerButton = new System.Windows.Forms.Button(); - this.addManufacturerLabel = new System.Windows.Forms.Label(); - this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); - this.addManufacturerButton = new System.Windows.Forms.Button(); - this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); - this.removeGenreLabel = new System.Windows.Forms.Label(); - this.removeGenreButton = new System.Windows.Forms.Button(); - this.addGenreLabel = new System.Windows.Forms.Label(); - this.addGenreTextBox = new System.Windows.Forms.TextBox(); - this.addGenreButton = new System.Windows.Forms.Button(); - this.menuStrip.SuspendLayout(); - this.tabControl.SuspendLayout(); - this.settingsTabPage.SuspendLayout(); - this.dbOptionsTabPage.SuspendLayout(); - this.generalFileItemOptionsGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip - // - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode( "Applications" ); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.applicationWithFiledirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addGroupnodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.extendedApplicationItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mameImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importGamebaseItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.premadeConfigurationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.emulatorSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.treeView = new System.Windows.Forms.TreeView(); + this.tabControl = new System.Windows.Forms.TabControl(); + this.detailsTabPage = new System.Windows.Forms.TabPage(); + this.directoryTabPage = new System.Windows.Forms.TabPage(); + this.viewTabPage = new System.Windows.Forms.TabPage(); + this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); + this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); + this.removePlatformLabel = new System.Windows.Forms.Label(); + this.removePlatformButton = new System.Windows.Forms.Button(); + this.addPlatformLabel = new System.Windows.Forms.Label(); + this.addPlatformTextBox = new System.Windows.Forms.TextBox(); + this.addPlatformButton = new System.Windows.Forms.Button(); + this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.removeManufacturerLabel = new System.Windows.Forms.Label(); + this.removeManufacturerButton = new System.Windows.Forms.Button(); + this.addManufacturerLabel = new System.Windows.Forms.Label(); + this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); + this.addManufacturerButton = new System.Windows.Forms.Button(); + this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); + this.removeGenreLabel = new System.Windows.Forms.Label(); + this.removeGenreButton = new System.Windows.Forms.Button(); + this.addGenreLabel = new System.Windows.Forms.Label(); + this.addGenreTextBox = new System.Windows.Forms.TextBox(); + this.addGenreButton = new System.Windows.Forms.Button(); + this.menuStrip.SuspendLayout(); + this.tabControl.SuspendLayout(); + this.dbOptionsTabPage.SuspendLayout(); + this.generalFileItemOptionsGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip + // + this.menuStrip.Items.AddRange( new System.Windows.Forms.ToolStripItem[] { this.addDeleteApplicationsToolStripMenuItem, - this.toolsStripMenuItem}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.menuStrip.Size = new System.Drawing.Size(747, 24); - this.menuStrip.TabIndex = 0; - this.menuStrip.Text = "menuStrip"; - // - // addDeleteApplicationsToolStripMenuItem - // - this.addDeleteApplicationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolsStripMenuItem} ); + this.menuStrip.Location = new System.Drawing.Point( 0, 0 ); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.menuStrip.Size = new System.Drawing.Size( 747, 24 ); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "menuStrip"; + // + // addDeleteApplicationsToolStripMenuItem + // + this.addDeleteApplicationsToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { this.addApplicationToolStripMenuItem, - this.deleteApplicationToolStripMenuItem}); - this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; - this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(132, 20); - this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; - // - // addApplicationToolStripMenuItem - // - this.addApplicationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.deleteApplicationToolStripMenuItem} ); + this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; + this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size( 132, 20 ); + this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; + // + // addApplicationToolStripMenuItem + // + this.addApplicationToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { this.applicationWithFiledirectoryToolStripMenuItem, this.addGroupnodeToolStripMenuItem, - this.extendedApplicationItemToolStripMenuItem}); - this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; - this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.addApplicationToolStripMenuItem.Text = "Add application"; - // - // applicationWithFiledirectoryToolStripMenuItem - // - this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; - this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(207, 22); - this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; - this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler(this.applicationWithFiledirectoryToolStripMenuItem_Click); - // - // addGroupnodeToolStripMenuItem - // - this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; - this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(207, 22); - this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; - this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler(this.addGroupnodeToolStripMenuItem_Click); - // - // extendedApplicationItemToolStripMenuItem - // - this.extendedApplicationItemToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.extendedApplicationItemToolStripMenuItem} ); + this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; + this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); + this.addApplicationToolStripMenuItem.Text = "Add application"; + // + // applicationWithFiledirectoryToolStripMenuItem + // + this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; + this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); + this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; + this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler( this.applicationWithFiledirectoryToolStripMenuItem_Click ); + // + // addGroupnodeToolStripMenuItem + // + this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; + this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); + this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; + this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler( this.addGroupnodeToolStripMenuItem_Click ); + // + // extendedApplicationItemToolStripMenuItem + // + this.extendedApplicationItemToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { this.mameImportToolStripMenuItem, - this.importGamebaseItemToolStripMenuItem}); - this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; - this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(207, 22); - this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; - // - // mameImportToolStripMenuItem - // - this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; - this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.mameImportToolStripMenuItem.Text = "Import Mame"; - this.mameImportToolStripMenuItem.Click += new System.EventHandler(this.mameImportToolStripMenuItem_Click); - // - // importGamebaseItemToolStripMenuItem - // - this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; - this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; - this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler(this.importGamebaseItemToolStripMenuItem_Click); - // - // deleteApplicationToolStripMenuItem - // - this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; - this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; - this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.deleteApplicationToolStripMenuItem.Text = "Delete application"; - this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler(this.deleteApplicationToolStripMenuItem_Click); - // - // toolsStripMenuItem - // - this.toolsStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.premadeConfigurationsToolStripMenuItem}); - this.toolsStripMenuItem.Name = "toolsStripMenuItem"; - this.toolsStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.toolsStripMenuItem.Text = "Tools"; - // - // premadeConfigurationsToolStripMenuItem - // - this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.emulatorSetupToolStripMenuItem}); - this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; - this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(155, 22); - this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; - // - // emulatorSetupToolStripMenuItem - // - this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; - this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(158, 22); - this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; - // - // treeView - // - this.treeView.AllowDrop = true; - this.treeView.HideSelection = false; - this.treeView.HotTracking = true; - this.treeView.LabelEdit = true; - this.treeView.Location = new System.Drawing.Point(0, 27); - this.treeView.Name = "treeView"; - treeNode3.Name = "applicationNode"; - treeNode3.Text = "Applications"; - this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode3}); - this.treeView.Size = new System.Drawing.Size(224, 576); - this.treeView.TabIndex = 8; - this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_AfterLabelEdit); - this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); - this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); - this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter); - this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); - this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_BeforeLabelEdit); - this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeSelect); - this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag); - this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); - // - // tabControl - // - this.tabControl.Controls.Add(this.detailsTabPage); - this.tabControl.Controls.Add(this.directoryTabPage); - this.tabControl.Controls.Add(this.settingsTabPage); - this.tabControl.Controls.Add(this.viewTabPage); - this.tabControl.Controls.Add(this.dbOptionsTabPage); - this.tabControl.Location = new System.Drawing.Point(230, 27); - this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 0; - this.tabControl.ShowToolTips = true; - this.tabControl.Size = new System.Drawing.Size(505, 577); - this.tabControl.TabIndex = 2; - this.tabControl.Click += new System.EventHandler(this.dbOptionsTabPage_Click); - this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); - // - // detailsTabPage - // - this.detailsTabPage.BackColor = System.Drawing.Color.Transparent; - this.detailsTabPage.Location = new System.Drawing.Point(4, 22); - this.detailsTabPage.Name = "detailsTabPage"; - this.detailsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.detailsTabPage.Size = new System.Drawing.Size(497, 551); - this.detailsTabPage.TabIndex = 0; - this.detailsTabPage.Text = "Details"; - this.detailsTabPage.UseVisualStyleBackColor = true; - // - // directoryTabPage - // - this.directoryTabPage.BackColor = System.Drawing.Color.Transparent; - this.directoryTabPage.Location = new System.Drawing.Point(4, 22); - this.directoryTabPage.Name = "directoryTabPage"; - this.directoryTabPage.Padding = new System.Windows.Forms.Padding(3); - this.directoryTabPage.Size = new System.Drawing.Size(497, 551); - this.directoryTabPage.TabIndex = 1; - this.directoryTabPage.Text = "Files"; - this.directoryTabPage.UseVisualStyleBackColor = true; - // - // settingsTabPage - // - this.settingsTabPage.Controls.Add(this.button2); - this.settingsTabPage.Controls.Add(this.titleTextBox); - this.settingsTabPage.Controls.Add(this.titleLabel); - this.settingsTabPage.Controls.Add(this.button1); - this.settingsTabPage.Controls.Add(this.checkBoxUseThumbsDir); - this.settingsTabPage.Location = new System.Drawing.Point(4, 22); - this.settingsTabPage.Name = "settingsTabPage"; - this.settingsTabPage.Size = new System.Drawing.Size(497, 551); - this.settingsTabPage.TabIndex = 4; - this.settingsTabPage.Text = "Settings"; - this.settingsTabPage.UseVisualStyleBackColor = true; - // - // button2 - // - this.button2.Location = new System.Drawing.Point(172, 230); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(75, 23); - this.button2.TabIndex = 42; - this.button2.Text = "save"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // titleTextBox - // - this.titleTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.titleTextBox.Location = new System.Drawing.Point(102, 34); - this.titleTextBox.Name = "titleTextBox"; - this.titleTextBox.Size = new System.Drawing.Size(325, 21); - this.titleTextBox.TabIndex = 41; - // - // titleLabel - // - this.titleLabel.Location = new System.Drawing.Point(11, 34); - this.titleLabel.Name = "titleLabel"; - this.titleLabel.Size = new System.Drawing.Size(93, 20); - this.titleLabel.TabIndex = 40; - this.titleLabel.Text = "Title:"; - this.titleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(433, 34); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(44, 23); - this.button1.TabIndex = 38; - this.button1.Text = "Reset"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // checkBoxUseThumbsDir - // - this.checkBoxUseThumbsDir.AutoSize = true; - this.checkBoxUseThumbsDir.Location = new System.Drawing.Point(14, 104); - this.checkBoxUseThumbsDir.Name = "checkBoxUseThumbsDir"; - this.checkBoxUseThumbsDir.Size = new System.Drawing.Size(129, 17); - this.checkBoxUseThumbsDir.TabIndex = 39; - this.checkBoxUseThumbsDir.Text = "usw thumbs directory"; - this.checkBoxUseThumbsDir.UseVisualStyleBackColor = true; - // - // viewTabPage - // - this.viewTabPage.BackColor = System.Drawing.Color.Transparent; - this.viewTabPage.Location = new System.Drawing.Point(4, 22); - this.viewTabPage.Name = "viewTabPage"; - this.viewTabPage.Padding = new System.Windows.Forms.Padding(3); - this.viewTabPage.Size = new System.Drawing.Size(497, 551); - this.viewTabPage.TabIndex = 2; - this.viewTabPage.Text = "Views"; - this.viewTabPage.UseVisualStyleBackColor = true; - // - // dbOptionsTabPage - // - this.dbOptionsTabPage.Controls.Add(this.generalFileItemOptionsGroupBox); - this.dbOptionsTabPage.Location = new System.Drawing.Point(4, 22); - this.dbOptionsTabPage.Name = "dbOptionsTabPage"; - this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.dbOptionsTabPage.Size = new System.Drawing.Size(497, 551); - this.dbOptionsTabPage.TabIndex = 3; - this.dbOptionsTabPage.Text = "DB options"; - this.dbOptionsTabPage.UseVisualStyleBackColor = true; - this.dbOptionsTabPage.Click += new System.EventHandler(this.dbOptionsTabPage_Click); - // - // generalFileItemOptionsGroupBox - // - this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); - this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(3, 6); - this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; - this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(488, 496); - this.generalFileItemOptionsGroupBox.TabIndex = 79; - this.generalFileItemOptionsGroupBox.TabStop = false; - // - // removePlatformComboBox - // - this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removePlatformComboBox.FormattingEnabled = true; - this.removePlatformComboBox.Location = new System.Drawing.Point(99, 249); - this.removePlatformComboBox.Name = "removePlatformComboBox"; - this.removePlatformComboBox.Size = new System.Drawing.Size(306, 21); - this.removePlatformComboBox.TabIndex = 92; - // - // removePlatformLabel - // - this.removePlatformLabel.AutoSize = true; - this.removePlatformLabel.Location = new System.Drawing.Point(6, 252); - this.removePlatformLabel.Name = "removePlatformLabel"; - this.removePlatformLabel.Size = new System.Drawing.Size(89, 13); - this.removePlatformLabel.TabIndex = 91; - this.removePlatformLabel.Text = "Remove platform"; - // - // removePlatformButton - // - this.removePlatformButton.Location = new System.Drawing.Point(411, 249); - this.removePlatformButton.Name = "removePlatformButton"; - this.removePlatformButton.Size = new System.Drawing.Size(62, 23); - this.removePlatformButton.TabIndex = 90; - this.removePlatformButton.Text = "Remove.."; - this.removePlatformButton.UseVisualStyleBackColor = true; - this.removePlatformButton.Click += new System.EventHandler(this.removePlatformButton_Click); - // - // addPlatformLabel - // - this.addPlatformLabel.AutoSize = true; - this.addPlatformLabel.Location = new System.Drawing.Point(6, 216); - this.addPlatformLabel.Name = "addPlatformLabel"; - this.addPlatformLabel.Size = new System.Drawing.Size(77, 13); - this.addPlatformLabel.TabIndex = 87; - this.addPlatformLabel.Text = "Add platform.."; - // - // addPlatformTextBox - // - this.addPlatformTextBox.Location = new System.Drawing.Point(99, 213); - this.addPlatformTextBox.Name = "addPlatformTextBox"; - this.addPlatformTextBox.Size = new System.Drawing.Size(306, 21); - this.addPlatformTextBox.TabIndex = 88; - // - // addPlatformButton - // - this.addPlatformButton.Location = new System.Drawing.Point(411, 213); - this.addPlatformButton.Name = "addPlatformButton"; - this.addPlatformButton.Size = new System.Drawing.Size(62, 23); - this.addPlatformButton.TabIndex = 89; - this.addPlatformButton.Text = "Add.."; - this.addPlatformButton.UseVisualStyleBackColor = true; - this.addPlatformButton.Click += new System.EventHandler(this.addPlatformButton_Click); - // - // removeManufacturerComboBox - // - this.removeManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removeManufacturerComboBox.FormattingEnabled = true; - this.removeManufacturerComboBox.Location = new System.Drawing.Point(99, 165); - this.removeManufacturerComboBox.Name = "removeManufacturerComboBox"; - this.removeManufacturerComboBox.Size = new System.Drawing.Size(306, 21); - this.removeManufacturerComboBox.TabIndex = 86; - // - // removeManufacturerLabel - // - this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); - this.removeManufacturerLabel.Name = "removeManufacturerLabel"; - this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); - this.removeManufacturerLabel.TabIndex = 85; - this.removeManufacturerLabel.Text = "Remove Manufacturer"; - // - // removeManufacturerButton - // - this.removeManufacturerButton.Location = new System.Drawing.Point(411, 165); - this.removeManufacturerButton.Name = "removeManufacturerButton"; - this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); - this.removeManufacturerButton.TabIndex = 84; - this.removeManufacturerButton.Text = "Remove.."; - this.removeManufacturerButton.UseVisualStyleBackColor = true; - this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); - // - // addManufacturerLabel - // - this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); - this.addManufacturerLabel.Name = "addManufacturerLabel"; - this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); - this.addManufacturerLabel.TabIndex = 81; - this.addManufacturerLabel.Text = "Add Manufacturer.."; - // - // addManufacturerTextBox - // - this.addManufacturerTextBox.Location = new System.Drawing.Point(99, 129); - this.addManufacturerTextBox.Name = "addManufacturerTextBox"; - this.addManufacturerTextBox.Size = new System.Drawing.Size(306, 21); - this.addManufacturerTextBox.TabIndex = 82; - // - // addManufacturerButton - // - this.addManufacturerButton.Location = new System.Drawing.Point(411, 129); - this.addManufacturerButton.Name = "addManufacturerButton"; - this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); - this.addManufacturerButton.TabIndex = 83; - this.addManufacturerButton.Text = "Add.."; - this.addManufacturerButton.UseVisualStyleBackColor = true; - this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); - // - // removeGenreComboBox - // - this.removeGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removeGenreComboBox.FormattingEnabled = true; - this.removeGenreComboBox.Location = new System.Drawing.Point(99, 70); - this.removeGenreComboBox.Name = "removeGenreComboBox"; - this.removeGenreComboBox.Size = new System.Drawing.Size(306, 21); - this.removeGenreComboBox.TabIndex = 80; - // - // removeGenreLabel - // - this.removeGenreLabel.AutoSize = true; - this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); - this.removeGenreLabel.Name = "removeGenreLabel"; - this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); - this.removeGenreLabel.TabIndex = 79; - this.removeGenreLabel.Text = "Remove genre"; - // - // removeGenreButton - // - this.removeGenreButton.Location = new System.Drawing.Point(411, 70); - this.removeGenreButton.Name = "removeGenreButton"; - this.removeGenreButton.Size = new System.Drawing.Size(62, 23); - this.removeGenreButton.TabIndex = 78; - this.removeGenreButton.Text = "Remove.."; - this.removeGenreButton.UseVisualStyleBackColor = true; - this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); - // - // addGenreLabel - // - this.addGenreLabel.AutoSize = true; - this.addGenreLabel.Location = new System.Drawing.Point(6, 37); - this.addGenreLabel.Name = "addGenreLabel"; - this.addGenreLabel.Size = new System.Drawing.Size(65, 13); - this.addGenreLabel.TabIndex = 74; - this.addGenreLabel.Text = "Add genre.."; - // - // addGenreTextBox - // - this.addGenreTextBox.Location = new System.Drawing.Point(99, 34); - this.addGenreTextBox.Name = "addGenreTextBox"; - this.addGenreTextBox.Size = new System.Drawing.Size(306, 21); - this.addGenreTextBox.TabIndex = 75; - // - // addGenreButton - // - this.addGenreButton.Location = new System.Drawing.Point(411, 34); - this.addGenreButton.Name = "addGenreButton"; - this.addGenreButton.Size = new System.Drawing.Size(62, 23); - this.addGenreButton.TabIndex = 76; - this.addGenreButton.Text = "Add.."; - this.addGenreButton.UseVisualStyleBackColor = true; - this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); - // - // SetupForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(747, 609); - this.Controls.Add(this.tabControl); - this.Controls.Add(this.treeView); - this.Controls.Add(this.menuStrip); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MainMenuStrip = this.menuStrip; - this.Name = "SetupForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "SetupForm"; - this.Load += new System.EventHandler(this.SetupForm_Load); - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SetupForm_FormClosed); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - this.tabControl.ResumeLayout(false); - this.settingsTabPage.ResumeLayout(false); - this.settingsTabPage.PerformLayout(); - this.dbOptionsTabPage.ResumeLayout(false); - this.generalFileItemOptionsGroupBox.ResumeLayout(false); - this.generalFileItemOptionsGroupBox.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + this.importGamebaseItemToolStripMenuItem} ); + this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; + this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); + this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; + // + // mameImportToolStripMenuItem + // + this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; + this.mameImportToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); + this.mameImportToolStripMenuItem.Text = "Import Mame"; + this.mameImportToolStripMenuItem.Click += new System.EventHandler( this.mameImportToolStripMenuItem_Click ); + // + // importGamebaseItemToolStripMenuItem + // + this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; + this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); + this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; + this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler( this.importGamebaseItemToolStripMenuItem_Click ); + // + // deleteApplicationToolStripMenuItem + // + this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; + this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; + this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); + this.deleteApplicationToolStripMenuItem.Text = "Delete application"; + this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler( this.deleteApplicationToolStripMenuItem_Click ); + // + // toolsStripMenuItem + // + this.toolsStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.premadeConfigurationsToolStripMenuItem} ); + this.toolsStripMenuItem.Name = "toolsStripMenuItem"; + this.toolsStripMenuItem.Size = new System.Drawing.Size( 44, 20 ); + this.toolsStripMenuItem.Text = "Tools"; + // + // premadeConfigurationsToolStripMenuItem + // + this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.emulatorSetupToolStripMenuItem} ); + this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; + this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size( 155, 22 ); + this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; + // + // emulatorSetupToolStripMenuItem + // + this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; + this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size( 158, 22 ); + this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; + // + // treeView + // + this.treeView.AllowDrop = true; + this.treeView.HideSelection = false; + this.treeView.HotTracking = true; + this.treeView.LabelEdit = true; + this.treeView.Location = new System.Drawing.Point( 0, 27 ); + this.treeView.Name = "treeView"; + treeNode1.Name = "applicationNode"; + treeNode1.Text = "Applications"; + this.treeView.Nodes.AddRange( new System.Windows.Forms.TreeNode[] { + treeNode1} ); + this.treeView.Size = new System.Drawing.Size( 224, 576 ); + this.treeView.TabIndex = 8; + this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler( this.treeView_DragDrop ); + this.treeView.DragOver += new System.Windows.Forms.DragEventHandler( this.treeView_DragOver ); + this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler( this.treeView_AfterLabelEdit ); + this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler( this.treeView_AfterSelect ); + this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler( this.treeView_NodeMouseClick ); + this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler( this.treeView_DragEnter ); + this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler( this.treeView_BeforeLabelEdit ); + this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler( this.treeView_BeforeSelect ); + this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler( this.treeView_ItemDrag ); + // + // tabControl + // + this.tabControl.Controls.Add( this.detailsTabPage ); + this.tabControl.Controls.Add( this.directoryTabPage ); + this.tabControl.Controls.Add( this.viewTabPage ); + this.tabControl.Controls.Add( this.dbOptionsTabPage ); + this.tabControl.Location = new System.Drawing.Point( 230, 27 ); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.ShowToolTips = true; + this.tabControl.Size = new System.Drawing.Size( 505, 577 ); + this.tabControl.TabIndex = 2; + this.tabControl.Click += new System.EventHandler( this.dbOptionsTabPage_Click ); + this.tabControl.SelectedIndexChanged += new System.EventHandler( this.tabControl_SelectedIndexChanged ); + // + // detailsTabPage + // + this.detailsTabPage.BackColor = System.Drawing.SystemColors.Control; + this.detailsTabPage.Location = new System.Drawing.Point( 4, 22 ); + this.detailsTabPage.Name = "detailsTabPage"; + this.detailsTabPage.Padding = new System.Windows.Forms.Padding( 3 ); + this.detailsTabPage.Size = new System.Drawing.Size( 497, 551 ); + this.detailsTabPage.TabIndex = 0; + this.detailsTabPage.Text = "Details"; + // + // directoryTabPage + // + this.directoryTabPage.BackColor = System.Drawing.SystemColors.Control; + this.directoryTabPage.Location = new System.Drawing.Point( 4, 22 ); + this.directoryTabPage.Name = "directoryTabPage"; + this.directoryTabPage.Padding = new System.Windows.Forms.Padding( 3 ); + this.directoryTabPage.Size = new System.Drawing.Size( 497, 551 ); + this.directoryTabPage.TabIndex = 1; + this.directoryTabPage.Text = "Files"; + // + // viewTabPage + // + this.viewTabPage.BackColor = System.Drawing.SystemColors.Control; + this.viewTabPage.Location = new System.Drawing.Point( 4, 22 ); + this.viewTabPage.Name = "viewTabPage"; + this.viewTabPage.Padding = new System.Windows.Forms.Padding( 3 ); + this.viewTabPage.Size = new System.Drawing.Size( 497, 551 ); + this.viewTabPage.TabIndex = 2; + this.viewTabPage.Text = "Views"; + // + // dbOptionsTabPage + // + this.dbOptionsTabPage.Controls.Add( this.generalFileItemOptionsGroupBox ); + this.dbOptionsTabPage.Location = new System.Drawing.Point( 4, 22 ); + this.dbOptionsTabPage.Name = "dbOptionsTabPage"; + this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding( 3 ); + this.dbOptionsTabPage.Size = new System.Drawing.Size( 497, 551 ); + this.dbOptionsTabPage.TabIndex = 3; + this.dbOptionsTabPage.Text = "DB options"; + this.dbOptionsTabPage.UseVisualStyleBackColor = true; + this.dbOptionsTabPage.Click += new System.EventHandler( this.dbOptionsTabPage_Click ); + // + // generalFileItemOptionsGroupBox + // + this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformComboBox ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformLabel ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformButton ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformLabel ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformTextBox ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformButton ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerComboBox ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerLabel ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerButton ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerLabel ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerTextBox ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerButton ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreComboBox ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreLabel ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreButton ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreLabel ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreTextBox ); + this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreButton ); + this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point( 3, 6 ); + this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; + this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size( 488, 496 ); + this.generalFileItemOptionsGroupBox.TabIndex = 79; + this.generalFileItemOptionsGroupBox.TabStop = false; + // + // removePlatformComboBox + // + this.removePlat... [truncated message content] |
From: <che...@us...> - 2007-08-05 10:09:26
|
Revision: 792 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=792&view=rev Author: chef_koch Date: 2007-08-05 03:09:23 -0700 (Sun, 05 Aug 2007) Log Message: ----------- added new class SettingsBase - SettingsRoot & AppSettingsBase depend on it -> easier to use the designer and add new options Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-05 08:48:44 UTC (rev 791) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-05 10:09:23 UTC (rev 792) @@ -40,19 +40,44 @@ namespace GUIPrograms.Design { - public partial class AppSettingsBase : UserControl + public partial class AppSettingsBase : SettingsBase { string preLaunch = string.Empty; string postLaunch = string.Empty; + protected bool useThumbsDir = true; - protected ConditionChecker conditionChecker = new ConditionChecker(); - public AppSettingsBase() { InitializeComponent(); InitDefault(); } + public override void LoadSettings(ApplicationItem curApp) + { + base.LoadSettings(curApp); + + AppItemToForm(curApp); + + if (DatabaseHandler.KeyExists(ProgramUtils.cUSE_MP_THUMBS_DIR)) + useThumbsDir = bool.Parse(DatabaseHandler.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR)); + else + useThumbsDir = true; + } + + public override void SaveSettings(ApplicationItem curApp) + { + base.SaveSettings(curApp); + + FormToAppItem(curApp); + } + + + + + + + + public virtual bool AppItemToForm(ApplicationItem curApp) { if (curApp != null) @@ -72,16 +97,6 @@ } } - public virtual bool EntriesOK(ApplicationItem curApp) - { - return true; - } - - public virtual void LoadFromAppItem(ApplicationItem tempApp) - { - // virtual! - } - protected void SetWindowStyle(ProcessWindowStyle val) { switch (val) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-05 08:48:44 UTC (rev 791) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-05 10:09:23 UTC (rev 792) @@ -63,10 +63,10 @@ private AppSettingsGamebase appSettingsGameBase = new AppSettingsGamebase(); private AppSettingsGrouper appSettingsGrouper = new AppSettingsGrouper(); private ProgramViews appSettingsProgramView = new ProgramViews(); - private AppSettingsRoot appSettingsRoot = new AppSettingsRoot(); + private SettingsRoot appSettingsRoot = new SettingsRoot(); private AppSettingsFilesView appSettingsFileEditView = new AppSettingsFilesView(); private AppSettingsFilesImportProgress filesProgress = new AppSettingsFilesImportProgress(); - private AppSettingsBase pageCurrentSettings = null; + private SettingsBase pageCurrentSettings = null; private bool profilesIsLoaded = false; private const string ROOTNODENAME = "Applications"; private const int POSITIONHOLDER = 10; @@ -363,34 +363,24 @@ - private AppSettingsBase GetCurrentSettingsPage() + private SettingsBase GetCurrentSettingsPage() { - AppSettingsBase appSettings = null; ApplicationItem currentApplication = GetTreeNodeApplicationItem(treeView.SelectedNode); + if (currentApplication == null) return appSettingsRoot; - if (currentApplication != null) + switch (currentApplication.SourceType) { - switch (currentApplication.SourceType) - { - case ItemType.DIRCACHE: - appSettings = appSettingsDirCache; - break; - case ItemType.MAMEDIRECT: - appSettings = appSettingsMame; - break; - case ItemType.GROUPER: - appSettings = appSettingsGrouper; - break; - case ItemType.GAMEBASE: - appSettings = this.appSettingsGameBase; - break; - } + case ItemType.DIRCACHE: + return appSettingsDirCache; + case ItemType.MAMEDIRECT: + return appSettingsMame; + case ItemType.GROUPER: + return appSettingsGrouper; + case ItemType.GAMEBASE: + return appSettingsGameBase; + default: + return appSettingsRoot; } - else - { - appSettings = appSettingsRoot; - } - return appSettings; } bool TabIsDisplayed(TabPage view) @@ -458,38 +448,38 @@ } - private void SyncPanel(AppSettingsBase pageSettings) + private void SyncPanel() { this.tabControl.TabPages["detailsTabPage"].Controls.Clear(); - if (pageSettings != null) - { - this.tabControl.TabPages["detailsTabPage"].Controls.Add(pageSettings); + pageCurrentSettings = GetCurrentSettingsPage(); + if (pageCurrentSettings == null) return; - ApplicationItem currentApplication = GetTreeNodeApplicationItem(treeView.SelectedNode); - pageSettings.AppItemToForm(currentApplication); + this.tabControl.TabPages["detailsTabPage"].Controls.Add(pageCurrentSettings); - if (currentApplication != null) + ApplicationItem currentApplication = GetTreeNodeApplicationItem(treeView.SelectedNode); + pageCurrentSettings.LoadSettings(currentApplication); + + if (currentApplication != null) + { + RemoveViewsPage(); + RemoveDBOptionsPage(); + if (currentApplication.FileEditorAllowed()) { - RemoveViewsPage(); - RemoveDBOptionsPage(); - if (currentApplication.FileEditorAllowed()) - { - AddFilesPage(currentApplication); - } - else - { - RemoveFilesPage(); - } + AddFilesPage(currentApplication); } else { - // special treatment for root node RemoveFilesPage(); - AddViewsPage(); - AddDBOptionsPage(); } } + else + { + // special treatment for root node + RemoveFilesPage(); + AddViewsPage(); + AddDBOptionsPage(); + } } private bool SaveAppItem() @@ -499,40 +489,37 @@ // currentApplication can be NULL for the root Element..... so don't catch this! pageCurrentSettings = GetCurrentSettingsPage(); - - if (pageCurrentSettings != null) + if (pageCurrentSettings == null) { - if (pageCurrentSettings.EntriesOK(currentApplication)) + Log.Debug("SetupForm: SaveAppItem() pageCurrentSettings == null"); + return false; + } + + if (pageCurrentSettings.EntriesOK(currentApplication)) + { + if (appSettingsFileEditView.EntriesOK()) { - if (appSettingsFileEditView.EntriesOK()) + pageCurrentSettings.SaveSettings(currentApplication); + appSettingsFileEditView.FillApplicationItem(currentApplication); + if (currentApplication != null) { - - pageCurrentSettings.FormToAppItem(currentApplication); - appSettingsFileEditView.FillApplicationItem(currentApplication); - - - if (currentApplication != null) - { - currentApplication.InsertOrUpdateSettings(); - treeView.SelectedNode.Text = currentApplication.Title;// +" " + currentApplication.Position; - success = true; - } + currentApplication.InsertOrUpdateSettings(); + treeView.SelectedNode.Text = currentApplication.Title;// +" " + currentApplication.Position; + success = true; } } - else - { + } + else + { // some of the entries are invalid success = false; - } } return success; } private void SyncDetails() { - pageCurrentSettings = GetCurrentSettingsPage(); - - SyncPanel(pageCurrentSettings); + SyncPanel(); SyncButtons(); } @@ -952,7 +939,7 @@ { if (pageCurrentSettings.EntriesOK(currentApplication)) { - pageCurrentSettings.FormToAppItem(currentApplication); + pageCurrentSettings.SaveSettings(currentApplication); if (currentApplication != null) { currentApplication.InsertOrUpdateSettings(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-05 08:48:44 UTC (rev 791) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-05 10:09:23 UTC (rev 792) @@ -98,11 +98,11 @@ <Compile Include="Design\AppSettingsMame.Designer.cs"> <DependentUpon>AppSettingsMame.cs</DependentUpon> </Compile> - <Compile Include="Design\AppSettingsRoot.cs"> + <Compile Include="Design\SettingsRoot.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="Design\AppSettingsRoot.Designer.cs"> - <DependentUpon>AppSettingsRoot.cs</DependentUpon> + <Compile Include="Design\SettingsRoot.Designer.cs"> + <DependentUpon>SettingsRoot.cs</DependentUpon> </Compile> <Compile Include="Design\FileInfoScraperForm.cs"> <SubType>Form</SubType> @@ -122,6 +122,12 @@ <Compile Include="Design\AppSettingsPrePost.Designer.cs"> <DependentUpon>AppSettingsPrePost.cs</DependentUpon> </Compile> + <Compile Include="Design\SettingsBase.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Design\SettingsBase.Designer.cs"> + <DependentUpon>SettingsBase.cs</DependentUpon> + </Compile> <Compile Include="Design\SetupForm.cs"> <SubType>Form</SubType> </Compile> @@ -195,8 +201,8 @@ <DependentUpon>AppSettingsMame.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> - <EmbeddedResource Include="Design\AppSettingsRoot.resx"> - <DependentUpon>AppSettingsRoot.cs</DependentUpon> + <EmbeddedResource Include="Design\SettingsRoot.resx"> + <DependentUpon>SettingsRoot.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="Design\FileInfoScraperForm.resx"> @@ -211,6 +217,10 @@ <SubType>Designer</SubType> <DependentUpon>AppSettingsPrePost.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="Design\SettingsBase.resx"> + <DependentUpon>SettingsBase.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="Design\SetupForm.resx"> <DependentUpon>SetupForm.cs</DependentUpon> <SubType>Designer</SubType> Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 08:48:44 UTC (rev 791) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 10:09:23 UTC (rev 792) @@ -97,14 +97,17 @@ public const int GetID = (int)GUIWindow.Window.WINDOW_FILES; public const int ProgramInfoID = 1206; // some magic number, sync with DialogAppInfo.xml public const string cBackLabel = ".."; + public const string cDefaultPluginTitle = "My Programs Alt."; public const string cMAMEDIRECT = "MAME_DIRECT"; public const string cDIRCACHE = "DIR_CACHE"; public const string cGROUPER = "GROUPER"; public const string cGAMEBASE = "GAMEBASE"; - public const string cSLIDESPEED = "SLIDESPEED"; + // Settings public const string cPLUGINTITLE = "PLUGINTITLE"; + public const string cSLIDESPEED = "SLIDESPEED"; + public const string cUSE_MP_THUMBS_DIR = "USE_MP_THUMBS_DIR"; #endregion Variables This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-08-05 11:25:46
|
Revision: 793 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=793&view=rev Author: chef_koch Date: 2007-08-05 04:25:44 -0700 (Sun, 05 Aug 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -51,8 +51,6 @@ static List<ApplicationItem> globalApplicationItemList = new List<ApplicationItem>(); private const string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; - public static bool useMPsThumbDirectory = false; - // singleton. Dont allow any instance of this class private DatabaseHandler() { } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -331,7 +331,7 @@ public bool FirstImageDirectoryValid() { - if (DatabaseHandler.useMPsThumbDirectory) return true; + if (ProgramUtils.UseThumbsDir()) return true; if (this.imageDirsTextBox.Text.Length == 0) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -55,6 +55,8 @@ this.applicationExeTextBox = new System.Windows.Forms.TextBox(); this.prePostButton = new System.Windows.Forms.Button(); this.startupDirComboBox = new System.Windows.Forms.ComboBox(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // // winTypeLabel @@ -72,7 +74,7 @@ this.enabledCheckbox.AutoSize = true; this.enabledCheckbox.Location = new System.Drawing.Point(427, 17); this.enabledCheckbox.Name = "enabledCheckbox"; - this.enabledCheckbox.Size = new System.Drawing.Size(65, 17); + this.enabledCheckbox.Size = new System.Drawing.Size(64, 17); this.enabledCheckbox.TabIndex = 1; this.enabledCheckbox.Text = "Enabled"; this.enabledCheckbox.UseVisualStyleBackColor = true; @@ -100,8 +102,9 @@ this.titleTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.titleTextBox.Location = new System.Drawing.Point(94, 44); this.titleTextBox.Name = "titleTextBox"; - this.titleTextBox.Size = new System.Drawing.Size(325, 20); + this.titleTextBox.Size = new System.Drawing.Size(325, 21); this.titleTextBox.TabIndex = 4; + this.titleTextBox.TextChanged += new System.EventHandler(this.titleTextBox_TextChanged); // // applicationExeButton // @@ -118,7 +121,7 @@ this.shellexecuteCheckBox.AutoSize = true; this.shellexecuteCheckBox.Location = new System.Drawing.Point(7, 322); this.shellexecuteCheckBox.Name = "shellexecuteCheckBox"; - this.shellexecuteCheckBox.Size = new System.Drawing.Size(88, 17); + this.shellexecuteCheckBox.Size = new System.Drawing.Size(87, 17); this.shellexecuteCheckBox.TabIndex = 7; this.shellexecuteCheckBox.Text = "ShellExecute"; this.shellexecuteCheckBox.UseVisualStyleBackColor = true; @@ -129,7 +132,7 @@ this.waitExitCheckBox.AutoSize = true; this.waitExitCheckBox.Location = new System.Drawing.Point(7, 368); this.waitExitCheckBox.Name = "waitExitCheckBox"; - this.waitExitCheckBox.Size = new System.Drawing.Size(82, 17); + this.waitExitCheckBox.Size = new System.Drawing.Size(86, 17); this.waitExitCheckBox.TabIndex = 8; this.waitExitCheckBox.Text = "Wait for exit"; this.waitExitCheckBox.UseVisualStyleBackColor = true; @@ -157,15 +160,17 @@ this.applicationImageTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.applicationImageTextBox.Location = new System.Drawing.Point(94, 97); this.applicationImageTextBox.Name = "applicationImageTextBox"; - this.applicationImageTextBox.Size = new System.Drawing.Size(325, 20); + this.applicationImageTextBox.Size = new System.Drawing.Size(325, 21); this.applicationImageTextBox.TabIndex = 13; + this.applicationImageTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.applicationImageTextBox.TextChanged += new System.EventHandler(this.applicationImageTextBox_TextChanged); // // applicationArgumentsTextBox // this.applicationArgumentsTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.applicationArgumentsTextBox.Location = new System.Drawing.Point(94, 123); this.applicationArgumentsTextBox.Name = "applicationArgumentsTextBox"; - this.applicationArgumentsTextBox.Size = new System.Drawing.Size(325, 20); + this.applicationArgumentsTextBox.Size = new System.Drawing.Size(325, 21); this.applicationArgumentsTextBox.TabIndex = 14; // // winStyleLabel @@ -206,7 +211,7 @@ this.quoteCheckBox.AutoSize = true; this.quoteCheckBox.Location = new System.Drawing.Point(7, 299); this.quoteCheckBox.Name = "quoteCheckBox"; - this.quoteCheckBox.Size = new System.Drawing.Size(102, 17); + this.quoteCheckBox.Size = new System.Drawing.Size(104, 17); this.quoteCheckBox.TabIndex = 19; this.quoteCheckBox.Text = "Quote filenames"; this.quoteCheckBox.UseVisualStyleBackColor = true; @@ -236,7 +241,7 @@ this.allowRefreshCheckBox.AutoSize = true; this.allowRefreshCheckBox.Location = new System.Drawing.Point(7, 345); this.allowRefreshCheckBox.Name = "allowRefreshCheckBox"; - this.allowRefreshCheckBox.Size = new System.Drawing.Size(154, 17); + this.allowRefreshCheckBox.Size = new System.Drawing.Size(159, 17); this.allowRefreshCheckBox.TabIndex = 30; this.allowRefreshCheckBox.Text = "Allow refresh in mediaportal"; this.allowRefreshCheckBox.UseVisualStyleBackColor = true; @@ -257,7 +262,7 @@ this.applicationExeTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.applicationExeTextBox.Location = new System.Drawing.Point(94, 71); this.applicationExeTextBox.Name = "applicationExeTextBox"; - this.applicationExeTextBox.Size = new System.Drawing.Size(325, 20); + this.applicationExeTextBox.Size = new System.Drawing.Size(325, 21); this.applicationExeTextBox.TabIndex = 32; this.applicationExeTextBox.TextChanged += new System.EventHandler(this.applicationExeTextBox_TextChanged); // @@ -279,10 +284,21 @@ this.startupDirComboBox.Size = new System.Drawing.Size(325, 21); this.startupDirComboBox.TabIndex = 36; // + // pictureBox + // + this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBox.Location = new System.Drawing.Point(324, 203); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(170, 170); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox.TabIndex = 37; + this.pictureBox.TabStop = false; + // // AppSettingsBase // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pictureBox); this.Controls.Add(this.startupDirComboBox); this.Controls.Add(this.prePostButton); this.Controls.Add(this.applicationExeTextBox); @@ -307,7 +323,7 @@ this.Controls.Add(this.enabledCheckbox); this.Controls.Add(this.winTypeLabel); this.Name = "AppSettingsBase"; - this.Size = new System.Drawing.Size(497, 550); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -341,5 +357,6 @@ protected System.Windows.Forms.TextBox applicationExeTextBox; protected System.Windows.Forms.Button prePostButton; protected System.Windows.Forms.ComboBox startupDirComboBox; + private System.Windows.Forms.PictureBox pictureBox; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -37,6 +37,7 @@ using GUIPrograms; using GUIPrograms.Items; using GUIPrograms.Database; +using MediaPortal.Configuration; namespace GUIPrograms.Design { @@ -44,7 +45,6 @@ { string preLaunch = string.Empty; string postLaunch = string.Empty; - protected bool useThumbsDir = true; public AppSettingsBase() { @@ -57,11 +57,6 @@ base.LoadSettings(curApp); AppItemToForm(curApp); - - if (DatabaseHandler.KeyExists(ProgramUtils.cUSE_MP_THUMBS_DIR)) - useThumbsDir = bool.Parse(DatabaseHandler.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR)); - else - useThumbsDir = true; } public override void SaveSettings(ApplicationItem curApp) @@ -85,6 +80,16 @@ preLaunch = curApp.PreLaunch; postLaunch = curApp.PostLaunch; } + + if (ProgramUtils.UseThumbsDir()) + applicationImageTextBox.Text = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt"), + titleTextBox.Text); + else + applicationImageTextBox.Text = curApp.Imagefile; + applicationImageTextBox.ReadOnly = ProgramUtils.UseThumbsDir(); + applicationImageButton.Visible = !ProgramUtils.UseThumbsDir(); + return true; } @@ -95,6 +100,9 @@ curApp.PreLaunch = preLaunch; curApp.PostLaunch = postLaunch; } + + if (!ProgramUtils.UseThumbsDir()) + curApp.Imagefile = applicationImageTextBox.Text; } protected void SetWindowStyle(ProcessWindowStyle val) @@ -231,9 +239,22 @@ startupDirComboBox.Items.Add(Path.GetDirectoryName(applicationExeTextBox.Text)); } + private void titleTextBox_TextChanged(object sender, EventArgs e) + { + if (ProgramUtils.UseThumbsDir()) + applicationImageTextBox.Text = MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt"), + titleTextBox.Text); + } + private void applicationImageTextBox_TextChanged(object sender, EventArgs e) + { + pictureBox.ImageLocation = applicationImageTextBox.Text; + } + + } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -58,11 +58,12 @@ shellexecuteCheckBox.Checked = curApp.UseShellExecute; quoteCheckBox.Checked = curApp.UseQuotes; waitExitCheckBox.Checked = (curApp.WaitForExit); - applicationImageTextBox.Text = curApp.Imagefile; allowRefreshCheckBox.Checked = curApp.RefreshGUIAllowed; - if(curApp.PlatformId != 0){ - platformComboBox.SelectedValue = curApp.PlatformId; - } + if (curApp.PlatformId != 0) + { + platformComboBox.SelectedValue = curApp.PlatformId; + } + return true; } @@ -79,10 +80,8 @@ curApp.UseQuotes = quoteCheckBox.Checked; curApp.WaitForExit = waitExitCheckBox.Checked; curApp.SourceType = ItemType.DIRCACHE; - curApp.Imagefile = applicationImageTextBox.Text; curApp.RefreshGUIAllowed = (allowRefreshCheckBox.Checked); curApp.PlatformId =(int) platformComboBox.SelectedValue; - } public override bool EntriesOK(ApplicationItem curApp) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -70,7 +70,6 @@ this.quoteCheckBox.Checked = true; //(curApp.UseQuotes); this.waitExitCheckBox.Checked = (curApp.WaitForExit); SetWindowStyle(curApp.WindowStyle); - this.applicationImageTextBox.Text = curApp.Imagefile; this.allowRefreshCheckBox.Checked = curApp.RefreshGUIAllowed; @@ -90,7 +89,6 @@ curApp.UseQuotes = this.quoteCheckBox.Checked; curApp.WaitForExit = this.waitExitCheckBox.Checked; curApp.SourceType = ItemType.GAMEBASE; - curApp.Imagefile = this.applicationImageTextBox.Text; curApp.RefreshGUIAllowed = this.allowRefreshCheckBox.Checked; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -77,7 +77,6 @@ curApp.Enabled = enabledCheckbox.Checked; curApp.Title = titleTextBox.Text; curApp.SourceType = ItemType.GROUPER; - curApp.Imagefile = applicationImageTextBox.Text; } @@ -86,7 +85,6 @@ base.AppItemToForm(curApp); this.enabledCheckbox.Checked = curApp.Enabled; titleTextBox.Text = curApp.Title; - applicationImageTextBox.Text = curApp.Imagefile; return true; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -54,7 +54,6 @@ this.applicationExeTextBox.Text = curApp.Filename; this.applicationArgumentsTextBox.Text = curApp.Arguments; SetWindowStyle(curApp.WindowStyle); - this.applicationImageTextBox.Text = curApp.Imagefile; return true; } @@ -69,7 +68,6 @@ curApp.Arguments = this.applicationArgumentsTextBox.Text; curApp.WindowStyle = GetSelectedWindowStyle(); curApp.SourceType = ItemType.MAMEDIRECT; - curApp.Imagefile = this.applicationImageTextBox.Text; curApp.RefreshGUIAllowed = true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -1075,7 +1075,7 @@ { FileItem curFile = item.MusicTag as FileItem; - if ( DatabaseHandler.useMPsThumbDirectory ) + if ( ProgramUtils.UseThumbsDir() ) return GetCurThumbFromThumbsDir( curFile ); else return GetCurThumb( curFile ); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -72,7 +72,7 @@ string imgFile = String.Empty; - if (DatabaseHandler.useMPsThumbDirectory) + if (ProgramUtils.UseThumbsDir()) imgFile = curFileItem.Imagefile; else imgFile = MediaPortal.Util.Utils.GetCoverArtName( Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -351,7 +351,7 @@ // imageUrl contains a full URL with one picture to download i++; - if (DatabaseHandler.useMPsThumbDirectory) + if (ProgramUtils.UseThumbsDir()) strFile = curFile.GetNewValidImageFileFromThumbsDir(curApp, Path.GetExtension(imageUrl)); else strFile = curFile.GetNewValidImageFile(curApp, Path.GetExtension(imageUrl)); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 10:09:23 UTC (rev 792) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 11:25:44 UTC (rev 793) @@ -393,5 +393,13 @@ comboBox.DisplayMember = "Text"; } + + public static bool UseThumbsDir() + { + if (DatabaseHandler.KeyExists(ProgramUtils.cUSE_MP_THUMBS_DIR)) + return bool.Parse(DatabaseHandler.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR)); + else + return true; + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-08-05 17:23:44
|
Revision: 794 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=794&view=rev Author: chef_koch Date: 2007-08-05 10:23:42 -0700 (Sun, 05 Aug 2007) Log Message: ----------- added methods to ProgramUtils for loading and parsing: slideSpeed/SleepTime and UseThumbsDir -> no parsing in each LoadSettings of configForm or in GUIPrograms is needed Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-05 11:25:44 UTC (rev 793) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-05 17:23:42 UTC (rev 794) @@ -311,13 +311,8 @@ void LoadSettings() { - string _slideSpeed = DatabaseHandler.ReadSetting(ProgramUtils.cSLIDESPEED); + slideSpeed = ProgramUtils.GetSleepTime(); - if ((_slideSpeed != "") && (_slideSpeed != null)) - { - slideSpeed = int.Parse(_slideSpeed); - } - using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string curText = ""; @@ -935,29 +930,39 @@ int DisplayApps() { int totalApps = 0; + foreach (ApplicationItem applicationItem in AppsOfFatherID(GetCurrentFatherID())) { - if (applicationItem.Enabled) + if (!applicationItem.Enabled) continue; + + totalApps++; + GUIListItem item = new GUIListItem(applicationItem.Title); + + // check whether to use thumbsdir or not + string imgFile = String.Empty; + if (ProgramUtils.UseThumbsDir()) + imgFile = ProgramUtils.GetApplicationImage(applicationItem.Title); + else + imgFile = applicationItem.Imagefile; + + // use skin default image if file does not exist + if (File.Exists(imgFile)) { - totalApps = totalApps + 1; - GUIListItem item = new GUIListItem(applicationItem.Title); - if (applicationItem.Imagefile != "") - { - item.ThumbnailImage = applicationItem.Imagefile; - item.IconImageBig = applicationItem.Imagefile; - item.IconImage = applicationItem.Imagefile; - } - else - { - item.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - item.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - item.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; - } - item.MusicTag = applicationItem; - //item.IsFolder = true; // pseudo-folder.... - item.OnItemSelected += new GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(item); + item.ThumbnailImage = imgFile; + item.IconImageBig = imgFile; + item.IconImage = imgFile; } + else + { + item.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + item.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + item.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; + } + + item.MusicTag = applicationItem; + //item.IsFolder = true; // pseudo-folder.... + item.OnItemSelected += new GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(item); } return (totalApps); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-05 11:25:44 UTC (rev 793) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-05 17:23:42 UTC (rev 794) @@ -125,16 +125,7 @@ } public string Imagefile { - get - { - if ( File.Exists( imageFile ) ) - return imageFile; - else - return MediaPortal.Util.Utils.GetCoverArtName( - Config.GetSubFolder( Config.Dir.Thumbs, @"MyProgramsAlt" ), - this.Title - ); - } + get { return imageFile; } set { imageFile = value; } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 11:25:44 UTC (rev 793) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 17:23:42 UTC (rev 794) @@ -47,6 +47,7 @@ using MediaPortal.Util; using GUIPrograms.Database; +using MediaPortal.Configuration; namespace GUIPrograms { @@ -98,6 +99,7 @@ public const int ProgramInfoID = 1206; // some magic number, sync with DialogAppInfo.xml public const string cBackLabel = ".."; public const string cDefaultPluginTitle = "My Programs Alt."; + public const int cDefaultSleepTime = 3000; public const string cMAMEDIRECT = "MAME_DIRECT"; public const string cDIRCACHE = "DIR_CACHE"; @@ -394,12 +396,38 @@ } + #region Thumb/Image stuff + + public static int GetSleepTime() + { + int sleepTime; + + if (int.TryParse(DatabaseHandler.ReadSetting(ProgramUtils.cSLIDESPEED), out sleepTime)) + return sleepTime; + else + return cDefaultSleepTime; + } + public static bool UseThumbsDir() { - if (DatabaseHandler.KeyExists(ProgramUtils.cUSE_MP_THUMBS_DIR)) - return bool.Parse(DatabaseHandler.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR)); + bool useThumbsDir; + + if (bool.TryParse(DatabaseHandler.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR), out useThumbsDir)) + return useThumbsDir; else return true; } + + public static string GetPluginThumbFolder() + { + return Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt"); + } + + public static string GetApplicationImage(string applicationTitle) + { + return MediaPortal.Util.Utils.GetCoverArtName(GetPluginThumbFolder(), applicationTitle); + } + + #endregion } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-08-05 22:22:00
|
Revision: 795 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=795&view=rev Author: chef_koch Date: 2007-08-05 15:21:57 -0700 (Sun, 05 Aug 2007) Log Message: ----------- added many fixes/changes/improvements when using thumbsDirectory, most should be fine now Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -72,21 +72,19 @@ public void Refresh(ApplicationItem curApp) { - if (curApp != null) + if (curApp == null) return; + + currentApplication = curApp; + if (!currentApplication.filesAreLoaded) { - currentApplication = curApp; - if (!currentApplication.filesAreLoaded) - { - currentApplication.LoadFiles(); - } - SyncListView(); + currentApplication.LoadFiles(); } + SyncListView(); } private void SyncListView() { - if (currentApplication == null) - return; + if (currentApplication == null) return; fileListView.BeginUpdate(); try @@ -172,8 +170,15 @@ { this.fileDirTextBox.Text = currentApplication.FileDirectory; - string imageDirectorys = string.Join(";", currentApplication.imageDirs); - this.imageDirsTextBox.Text = imageDirectorys; + if (ProgramUtils.UseThumbsDir()) + { + ProgramUtils.GetApplicationImageFolder(currentApplication); + } + else + { + string imageDirectorys = string.Join(";", currentApplication.imageDirs); + this.imageDirsTextBox.Text = imageDirectorys; + } this.fileExtensionsTextBox.Text = currentApplication.ValidExtensions; // filePathsLabel.Text = currentApplication.CurrentFilePath().Replace("&", "&&"); @@ -181,15 +186,8 @@ public string FileExtensionsText { - - get - { - return fileExtensionsTextBox.Text; - } - set - { - fileExtensionsTextBox.Text = value; - } + get { return fileExtensionsTextBox.Text; } + set { fileExtensionsTextBox.Text = value; } } public bool EntriesOK() @@ -349,118 +347,111 @@ return System.IO.Directory.Exists(firstDirectory); } } - } //scans all files in the fileviewlist //and look for matching imagenames in the imagefolders(if any) private void scanImageDirsButton_Click(object sender, EventArgs e) { - if (FirstImageDirectoryValid()) + if (!FirstImageDirectoryValid()) { + MessageBox.Show("Please set the first imagedirectory before rescanning folders for images!", "Missing or Invalid Imagedirectory"); + return; + } - SetEnabledComponents(false); - scanImageDirsButton.Enabled = false; - scanImageDirsButton.Text = "Scanning for images.."; - Application.DoEvents(); - List<string> imageDirsList = new List<string>(); - if (this.OnImageFolderSearch != null) - { + SetEnabledComponents(false); + scanImageDirsButton.Enabled = false; + scanImageDirsButton.Text = "Scanning for images.."; + Application.DoEvents(); + List<string> imageDirsList = new List<string>(); + if (this.OnImageFolderSearch != null) + { + OnImageFolderSearch(this, null); + } + //get all imagedirs + /* for (int i = 0; i < currentApplication.imageDirs.Length; i++) + { + if (!currentApplication.imageDirs[i].ToString().Equals("")) + { + imageDirsList.Add(currentApplication.imageDirs[i]); + } - OnImageFolderSearch(this, null); + } + */ - } + if (this.imageDirsTextBox.Text != string.Empty) + { + string[] imageDirs = this.imageDirsTextBox.Text.Split(';'); //get all imagedirs - /* for (int i = 0; i < currentApplication.imageDirs.Length; i++) - { - if (!currentApplication.imageDirs[i].ToString().Equals("")) - { - imageDirsList.Add(currentApplication.imageDirs[i]); - } - - } - */ - - if (this.imageDirsTextBox.Text != string.Empty) + for (int i = 0; i < imageDirs.Length; i++) { - string[] imageDirs = this.imageDirsTextBox.Text.Split(';'); - //get all imagedirs - for (int i = 0; i < imageDirs.Length; i++) + if (!imageDirs[i].ToString().Equals("")) { - if (!imageDirs[i].ToString().Equals("")) - { - imageDirsList.Add(imageDirs[i]); - } - + imageDirsList.Add(imageDirs[i]); } + } - try + try + { + //if any imagedirs given + if (imageDirsList.Count > 0) { - //if any imagedirs given - if (imageDirsList.Count > 0) + //for every dir fiven... + foreach (string directory in imageDirsList) { - //for every dir fiven... - foreach (string directory in imageDirsList) + + DirectoryInfo directoryInfo = new DirectoryInfo(directory); + //and for each file in dir + if (directoryInfo.Exists) { + System.IO.FileInfo[] files = directoryInfo.GetFiles(); - DirectoryInfo directoryInfo = new DirectoryInfo(directory); - //and for each file in dir - if (directoryInfo.Exists) + for (int z = 0; z < currentApplication.ItemList.Count; z++) { - System.IO.FileInfo[] files = directoryInfo.GetFiles(); + bool imageFound = false; + string foundImagePath = string.Empty; + FileItem fileItem = (FileItem)currentApplication.ItemList[z]; + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileItem.Filename); - for (int z = 0; z < currentApplication.ItemList.Count; z++) + //check all files if same name can be found + int i = 0; + while ((imageFound == false) && (i < files.Length)) { - bool imageFound = false; - string foundImagePath = string.Empty; - FileItem fileItem = (FileItem)currentApplication.ItemList[z]; - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileItem.Filename); - - //check all files if same name can be found - int i = 0; - while ((imageFound == false) && (i < files.Length)) + if (fileNameWithoutExtension.Equals(Path.GetFileNameWithoutExtension(files[i].ToString()))) { - if (fileNameWithoutExtension.Equals(Path.GetFileNameWithoutExtension(files[i].ToString()))) - { - //found - imageFound = true; - foundImagePath = Path.Combine(directory, files[i].ToString()); - } - i++; + //found + imageFound = true; + foundImagePath = Path.Combine(directory, files[i].ToString()); } + i++; + } - // if an image with same name as file was found - if (foundImagePath != string.Empty) - { - fileItem.Imagefile = foundImagePath; - fileItem.Write(); + // if an image with same name as file was found + if (foundImagePath != string.Empty) + { + fileItem.Imagefile = foundImagePath; + fileItem.Write(); - } } } } } } - catch (Exception ee) - { - - MessageBox.Show(ee.ToString()); - SetEnabledComponents(true); - } } - - scanImageDirsButton.Enabled = true; - scanImageDirsButton.Text = "(Re)Scan imagefolders"; - Application.DoEvents(); - SetEnabledComponents(true); - if (this.OnImageFolderSearch != null) + catch (Exception ee) { - OnImageFolderSearch(this, null); + MessageBox.Show(ee.ToString()); + SetEnabledComponents(true); } } - else + + scanImageDirsButton.Enabled = true; + scanImageDirsButton.Text = "(Re)Scan imagefolders"; + Application.DoEvents(); + SetEnabledComponents(true); + if (this.OnImageFolderSearch != null) { - MessageBox.Show("Please set the first imagedirectory before rescanning folders for images!", "Missing or Invalid Imagedirectory"); + OnImageFolderSearch(this, null); } } @@ -585,35 +576,30 @@ public void FillApplicationItem(ApplicationItem applicationItem) { - if (applicationItem != null) - { + if (applicationItem == null) return; - applicationItem.FileDirectory = fileDirTextBox.Text; + if (!ProgramUtils.UseThumbsDir()) + { applicationItem.ImageDirectory = imageDirsTextBox.Text; - applicationItem.ValidExtensions = fileExtensionsTextBox.Text; + } + applicationItem.FileDirectory = fileDirTextBox.Text; + applicationItem.ValidExtensions = fileExtensionsTextBox.Text; + if ((currentApplication is ApplicationItemMame) || ((currentApplication is ApplicationItemGameBase))) + { + applicationItem.ImportValidImagesOnly = this.validImagesCheckBox.Checked; + } + if ((currentApplication is ApplicationItemMame)) + { + ((ApplicationItemMame)applicationItem).ImportOriginalsOnly = this.importOriginalsCheckBox.Checked; + applicationItem.ImportMameMahjong = this.importMahjongCheckBox.Checked; + applicationItem.ImportMamePlaychoice10 = this.importPlaychoiceCheckBox.Checked; + } - if ((currentApplication is ApplicationItemMame) || ((currentApplication is ApplicationItemGameBase))) - { - applicationItem.ImportValidImagesOnly = this.validImagesCheckBox.Checked; - } - - if ((currentApplication is ApplicationItemMame)) - { - ((ApplicationItemMame)applicationItem).ImportOriginalsOnly = this.importOriginalsCheckBox.Checked; - applicationItem.ImportMameMahjong = this.importMahjongCheckBox.Checked; - applicationItem.ImportMamePlaychoice10 = this.importPlaychoiceCheckBox.Checked; - - } - - if ((currentApplication is ApplicationItemGameBase)) - { - applicationItem.Source = this.gamebaseDBTextBox.Text; - } - - - + if ((currentApplication is ApplicationItemGameBase)) + { + applicationItem.Source = this.gamebaseDBTextBox.Text; } } @@ -674,8 +660,14 @@ if (currentApplication != null) { + if (ProgramUtils.UseThumbsDir()) + imageDirsTextBox.Text = ProgramUtils.GetApplicationImageFolder(currentApplication); + else + imageDirsTextBox.Text = currentApplication.ImageDirectory; + imageDirsTextBox.ReadOnly = ProgramUtils.UseThumbsDir(); + imageDirButton.Visible = !ProgramUtils.UseThumbsDir(); + fileDirTextBox.Text = currentApplication.FileDirectory; - imageDirsTextBox.Text = currentApplication.ImageDirectory; fileExtensionsTextBox.Text = currentApplication.ValidExtensions; @@ -694,7 +686,6 @@ this.importOriginalsCheckBox.Checked = ((ApplicationItemMame)currentApplication).ImportOriginalsOnly; this.importMahjongCheckBox.Checked = currentApplication.ImportMameMahjong; this.importPlaychoiceCheckBox.Checked = currentApplication.ImportMamePlaychoice10; - } if ((currentApplication is ApplicationItemGameBase)) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -48,26 +48,14 @@ public ApplicationItem CurApp { - get - { - return m_CurApp; - } - set - { - m_CurApp = value; - } + get { return m_CurApp; } + set { m_CurApp = value; } } public FileItem CurFile { - get - { - return m_CurFile; - } - set - { - m_CurFile = value; - } + get { return m_CurFile; } + set { m_CurFile = value; } } public FileDetailsForm() @@ -83,12 +71,21 @@ gbFileDetails.Text = CurApp.Title + ": " + CurFile.Title; txtTitle.Text = m_CurFile.Title; txtFilename.Text = m_CurFile.Filename; - txtImageFile.Text = m_CurFile.Imagefile; + + if (ProgramUtils.UseThumbsDir()) + { + txtImageFile.Text = ProgramUtils.GetFileImage(CurApp, CurFile); + } + else + { + txtImageFile.Text = m_CurFile.Imagefile; + } + FileItemToGenre(); manufacturerComboBox.SelectedValue = CurFile.ManufacturerId; //txtManufacturer.Text = m_CurFile.Manufacturer; - txtYear.Text = m_CurFile.Year.ToString(); + txtYear.Text = m_CurFile.Year.ToString(); cbRating.SelectedIndex = m_CurFile.Rating; txtCountry.Text = m_CurFile.Country; @@ -241,7 +238,8 @@ { CurFile.Title = txtTitle.Text; CurFile.Filename = txtFilename.Text; - CurFile.Imagefile = txtImageFile.Text; + if (!ProgramUtils.UseThumbsDir()) + CurFile.Imagefile = txtImageFile.Text; // CurFile.MainGenre = genreComboBox.SelectedText; CurFile.MainGenreId = (int)genreComboBox.SelectedValue; //CurFile.SubGenre = subGenreComboBox.SelectedText; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -941,7 +941,7 @@ // check whether to use thumbsdir or not string imgFile = String.Empty; if (ProgramUtils.UseThumbsDir()) - imgFile = ProgramUtils.GetApplicationImage(applicationItem.Title); + imgFile = ProgramUtils.GetApplicationImage(applicationItem); else imgFile = applicationItem.Imagefile; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -1043,8 +1043,8 @@ } else { - string candFolder = imageDirs[thumbFolderIndex]; - string candThumb = candFolder + "\\" + fileItem.ExtractImageFileNoPath(); + string candFolder = imageDirs[thumbFolderIndex]; + string candThumb = candFolder + "\\" + Path.GetFileName(fileItem.Imagefile); if ( candThumb.ToLower() != fileItem.Imagefile.ToLower() ) { foundThumb = ( System.IO.File.Exists( candThumb ) ); @@ -1060,7 +1060,7 @@ public virtual string GetCurThumb(GUIListItem item) { - if ( item.MusicTag == null ) return ""; + if ( item.MusicTag == null ) return ""; if ( item.MusicTag is FileItem ) { @@ -1073,9 +1073,12 @@ } else if ( item.MusicTag is ApplicationItem ) { - ApplicationItem curApp = item.MusicTag as ApplicationItem; + ApplicationItem curApp = item.MusicTag as ApplicationItem; - return curApp.Imagefile; + if ( ProgramUtils.UseThumbsDir() ) + return ProgramUtils.GetApplicationImage( curApp ); + else + return curApp.Imagefile; } else return ""; } @@ -1091,7 +1094,7 @@ else { string curFolder = imageDirs[thumbFolderIndex]; - curThumb = curFolder + "\\" + fileItem.ExtractImageFileNoPath(); + curThumb = curFolder + "\\" + Path.GetFileName(fileItem.Imagefile); } if ( thumbIndex > 0 ) @@ -1099,7 +1102,7 @@ // try to find another thumb.... // use the myGames convention: // every thumb has the postfix "_1", "_2", etc with the same file extension - string curExtension = fileItem.ExtractImageExtension(); + string curExtension = Path.GetExtension(fileItem.Imagefile); if ( curThumb != "" ) { string cand = curThumb.Replace( curExtension, "_" + thumbIndex.ToString() + curExtension ); @@ -1121,10 +1124,7 @@ public string GetCurThumbFromThumbsDir(FileItem fileItem) { - string curThumb = MediaPortal.Util.Utils.GetCoverArtName( - Config.GetSubFolder( Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title ), - Path.GetFileNameWithoutExtension( fileItem.Filename ) - ); + string curThumb = ProgramUtils.GetFileImage(this, fileItem); if ( File.Exists( curThumb ) ) if ( thumbIndex > 0 ) @@ -1132,10 +1132,7 @@ // try to find another thumb.... // use the myGames convention: // every thumb has the postfix "_1", "_2", etc with the same file extension - string cand = MediaPortal.Util.Utils.GetCoverArtName( - Config.GetSubFolder( Config.Dir.Thumbs, @"MyProgramsAlt\" + this.Title ), - Path.GetFileNameWithoutExtension( fileItem.Filename ) + "_" + thumbIndex.ToString() - ); + string cand = ProgramUtils.GetFileImage(this, fileItem, thumbIndex); if ( File.Exists( cand ) ) curThumb = cand; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -401,28 +401,33 @@ return nRes; } - 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; - } + // + // no need for these methods anymore + // - public string ExtractImageFileNoPath() - { - string strRes = ""; - string[] parts = this.Imagefile.Split( '\\' ); - if ( parts.Length >= 1 ) - { - strRes = parts[parts.Length - 1]; - } - return strRes; - } + //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);*/ @@ -752,6 +757,9 @@ public string GetNewValidImageFile(ApplicationItem curApp, string strExtension) { + if (ProgramUtils.UseThumbsDir()) + return GetNewValidImageFileFromThumbsDir(curApp, strExtension); + if ( curApp == null ) return ""; if ( curApp.imageDirs == null ) @@ -831,58 +839,43 @@ iImgIndex++; if ( iImgIndex == 0 ) { - strCand = String.Format( "{0}\\{1}{2}", strFolder, strFileName, strExtension ); + strCand = String.Format( "{0}\\{1}.{2}", strFolder, strFileName, strExtension ); } else { - strCand = String.Format( "{0}\\{1}_{2}{3}", strFolder, strFileName, iImgIndex, strExtension ); + strCand = String.Format( "{0}\\{1}_{2}.{3}", strFolder, strFileName, iImgIndex, strExtension ); } bFound = !File.Exists( strCand ); } return strCand; } - public string GetNewValidImageFileFromThumbsDir(ApplicationItem curApp, string strExtension) - { - if ( curApp == null ) return ""; - if ( ( this.Imagefile == "" ) && ( this.Filename == "" ) ) - return ""; + public string GetNewValidImageFileFromThumbsDir(ApplicationItem curApp, string strExtension) + { + if (curApp == null) return ""; + if (this.Filename == "") return ""; - string strCand = ""; - int iImgIndex = -1; - bool bFound = false; + string strCand = ""; + int iImgIndex = -1; + bool bFound = false; - string folder = Config.GetSubFolder( Config.Dir.Thumbs, @"MyProgramsAlt\" + curApp.Title ); - if ( !Directory.Exists( folder ) ) - Directory.CreateDirectory( folder ); + string folder = ProgramUtils.GetApplicationImageFolder(curApp); + if (!Directory.Exists(folder)) + Directory.CreateDirectory(folder); - while ( !bFound ) - { - iImgIndex++; - if ( iImgIndex == 0 ) - { - strCand = String.Format( "{0}\\{1}{2}", - folder, - Path.GetFileNameWithoutExtension( this.Filename ), - strExtension - ); - } - else - { - strCand = String.Format( "{0}\\{1}_{2}{3}", - folder, - Path.GetFileNameWithoutExtension( this.Filename ), - iImgIndex, - strExtension - ); - } - bFound = !File.Exists( strCand ); - } + while (!bFound) + { + iImgIndex++; + strCand = ProgramUtils.GetFileImage(curApp, this, iImgIndex); + strCand = Path.ChangeExtension(strCand, strExtension); - return strCand; - } + bFound = !File.Exists(strCand); + } + return strCand; + } + public void DeleteImages(ApplicationItem curApp) { if ( curApp == null ) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -351,10 +351,7 @@ // imageUrl contains a full URL with one picture to download i++; - if (ProgramUtils.UseThumbsDir()) - strFile = curFile.GetNewValidImageFileFromThumbsDir(curApp, Path.GetExtension(imageUrl)); - else - strFile = curFile.GetNewValidImageFile(curApp, Path.GetExtension(imageUrl)); + strFile = curFile.GetNewValidImageFile(curApp, Path.GetExtension(imageUrl)); MediaPortal.Util.Utils.DownLoadImage(imageUrl, strFile); if ((File.Exists(strFile)) && (curFile.Imagefile == "")) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 17:23:42 UTC (rev 794) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-05 22:21:57 UTC (rev 795) @@ -47,6 +47,8 @@ using MediaPortal.Util; using GUIPrograms.Database; +using GUIPrograms.Items; + using MediaPortal.Configuration; namespace GUIPrograms @@ -423,11 +425,38 @@ return Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt"); } - public static string GetApplicationImage(string applicationTitle) + public static string GetApplicationImage(ApplicationItem appItem) { - return MediaPortal.Util.Utils.GetCoverArtName(GetPluginThumbFolder(), applicationTitle); + return MediaPortal.Util.Utils.GetCoverArtName(GetPluginThumbFolder(), appItem.Title); } + public static string GetApplicationImageFolder(ApplicationItem appItem) + { + string folder = String.Format(@"{0}\{1}", GetPluginThumbFolder(), appItem.Title); + + if (!Directory.Exists(folder)) + Directory.CreateDirectory(folder); + + return folder; + } + + public static string GetFileImage(ApplicationItem appItem, FileItem fileItem) + { + return GetFileImage(appItem, fileItem, 0); + } + + public static string GetFileImage(ApplicationItem appItem, FileItem fileItem, int index) + { + if (index > 0) + return MediaPortal.Util.Utils.GetCoverArtName( + GetApplicationImageFolder(appItem), + Path.GetFileNameWithoutExtension(fileItem.Filename) + "_" + index.ToString()); + else + return MediaPortal.Util.Utils.GetCoverArtName( + GetApplicationImageFolder(appItem), + Path.GetFileNameWithoutExtension(fileItem.Filename)); + } + #endregion } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-08-13 23:44:59
|
Revision: 833 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=833&view=rev Author: northern_sky Date: 2007-08-13 16:44:56 -0700 (Mon, 13 Aug 2007) Log Message: ----------- made dbhandler real singelton,fixed a viewbug Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.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/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -41,32 +41,33 @@ { /// <summary> /// DBhandling methods + /// Singleton. Dont allow any instance of this class /// </summary> - public class DatabaseHandler + public sealed class DatabaseHandler { + private SQLiteConnection sqlLiteConnection = null; + private List<ApplicationItem> globalApplicationItemList = new List<ApplicationItem>(); + private readonly string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; - private static SQLiteConnection sqlLiteConn = null; + private static DatabaseHandler instance = new DatabaseHandler(); + // Explicit static constructor to tell C# compiler + // not to mark type as beforefieldinit + static DatabaseHandler() { } - static List<ApplicationItem> globalApplicationItemList = new List<ApplicationItem>(); - private const string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; - - // singleton. Dont allow any instance of this class - private DatabaseHandler() { } - - static DatabaseHandler() + private DatabaseHandler() { string DatabasePath = Config.GetFile(Config.Dir.Database, DATABASEFILE); + string connString = string.Empty; try { - //check if database exists if (!File.Exists(DatabasePath)) { SQLiteConnection.CreateFile(DatabasePath); - string connString = "Data Source=" + Config.GetFile(Config.Dir.Database, DATABASEFILE); - sqlLiteConn = new SQLiteConnection(connString); + connString = "Data Source=" + Config.GetFile(Config.Dir.Database, DATABASEFILE); + sqlLiteConnection = new SQLiteConnection(connString); SetPragmas(); @@ -78,24 +79,27 @@ } else { - string connString = "Data Source=" + Config.GetFile(Config.Dir.Database, DATABASEFILE) + ";Version=3"; - sqlLiteConn = new SQLiteConnection(connString); + connString = "Data Source=" + Config.GetFile(Config.Dir.Database, DATABASEFILE) + ";Version=3"; + sqlLiteConnection = new SQLiteConnection(connString); } - //globalApplicationItemList = new ApplicationItemList(sqlDB, new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink)); - LoadAllApplicationItems(); } catch (SQLiteException ex) { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + Log.Info("DatabaseHandler() exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } } - static private void SetPragmas() + + public static DatabaseHandler DBHandlerInstance { + get { return instance; } + } + + private void SetPragmas() + { ExecuteStmtNonQuery("PRAGMA default_cache_size=3000"); ExecuteStmtNonQuery("PRAGMA count_changes=1"); ExecuteStmtNonQuery("PRAGMA short_column_names=1"); ExecuteStmtNonQuery("PRAGMA auto_vacuum=1"); - } /*static void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) @@ -109,15 +113,15 @@ // we can always keep an connection open in sqllite.. //to expensive closing it - public static SQLiteConnection SqlLiteConn + public SQLiteConnection SqlLiteConn { get { - if (sqlLiteConn.State == ConnectionState.Closed) + if (sqlLiteConnection.State == ConnectionState.Closed) { - sqlLiteConn.Open(); + sqlLiteConnection.Open(); } - return sqlLiteConn; + return sqlLiteConnection; } } @@ -125,67 +129,70 @@ /// Create db tables etc,if not already exist /// </summary> /// <returns></returns> - static bool CreateDBTables() + bool CreateDBTables() { string sqlStmt = @"CREATE TABLE tblApplicationItem - ( - applicationId INTEGER PRIMARY KEY, - fatherNodeId INTEGER, - title TEXT, - filename TEXT, - arguments TEXT, - windowstyle TEXT, - startupdir TEXT, - useShellExecute BOOL, - useQuotes BOOL, - applicationItemType TEXT, - source TEXT, - imagefile TEXT, - filedirectory TEXT, - imagedirectory TEXT, - validExtensions TEXT, - enabled BOOL, - importValidImagesOnly BOOL, - iposition INTEGER, - refreshGUIAllowed BOOL, - platformId INTEGER, - waitForExit BOOL, - preLaunch TEXT, - postLaunch TEXT - )"; + ( + applicationId INTEGER PRIMARY KEY, + fatherNodeId INTEGER, + title TEXT, + filename TEXT, + arguments TEXT, + windowstyle TEXT, + startupdir TEXT, + useShellExecute BOOL, + useQuotes BOOL, + applicationItemType TEXT, + source TEXT, + imagefile TEXT, + filedirectory TEXT, + imagedirectory TEXT, + validExtensions TEXT, + enabled BOOL, + importValidImagesOnly BOOL, + iposition INTEGER, + refreshGUIAllowed BOOL, + platformId INTEGER, + waitForExit BOOL, + preLaunch TEXT, + postLaunch TEXT + )"; ExecuteStmtNonQuery(sqlStmt); - sqlStmt = @"CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, genreId INTEGER, genreStyleId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, platformId INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, categorydata TEXT, gameInfoUrl TEXT)"; ExecuteStmtNonQuery(sqlStmt); + sqlStmt = @"CREATE TABLE tblFileLinkItem (applicationId INTEGER, grouperAppID INTEGER, fileID INTEGER, filename TEXT, updateFlag INTEGER)"; ExecuteStmtNonQuery(sqlStmt); + sqlStmt = @"CREATE TABLE tblSetting (settingid INTEGER PRIMARY KEY, key TEXT, value TEXT)"; ExecuteStmtNonQuery(sqlStmt); sqlStmt = @"CREATE TABLE - tblGenre - ( - genreId INTEGER PRIMARY KEY, - genre TEXT - )"; + tblGenre + ( + genreId INTEGER PRIMARY KEY, + genre TEXT + )"; ExecuteStmtNonQuery(sqlStmt); + sqlStmt = @"CREATE TABLE - tblPlatform - ( - platformId INTEGER PRIMARY KEY, - platform TEXT - )"; + tblPlatform + ( + platformId INTEGER PRIMARY KEY, + platform TEXT + )"; ExecuteStmtNonQuery(sqlStmt); + sqlStmt = @"CREATE TABLE - tblManufacturer - ( - manufacturerId INTEGER PRIMARY KEY, - manufacturer TEXT - )"; + tblManufacturer + ( + manufacturerId INTEGER PRIMARY KEY, + manufacturer TEXT + )"; ExecuteStmtNonQuery(sqlStmt); sqlStmt = @"CREATE INDEX idxFile1 ON tblFileItem(applicationId)"; @@ -202,7 +209,7 @@ /// Inserting some default values so that the db is preloaded /// Should always be there. /// </summary> - private static void InsertDefaultDBValues() + private void InsertDefaultDBValues() { string sqlStmt = @"INSERT INTO @@ -254,7 +261,7 @@ } - private static void FillDefaultDBLexiconHelper(string tableName, string columnName, List<string> itemList) + private void FillDefaultDBLexiconHelper(string tableName, string columnName, List<string> itemList) { SQLiteParameter[] paramCollection = new SQLiteParameter[1]; SQLiteParameter paramInsertValue = new SQLiteParameter("@insertValue", DbType.String); @@ -273,15 +280,13 @@ foreach (string insertValue in itemList) { - - paramCollection[0].Value = insertValue; ExecuteStmtNonQuery(sqlStmt, paramCollection); } } #region dbsettings - static public string ReadSetting(string Key) + public string ReadSetting(string Key) { string sqlStmt = string.Empty; @@ -305,7 +310,7 @@ return keyValue; } - static int CountKey(string Key) + int CountKey(string Key) { string sqlStmt = string.Empty; int keyValue = 0; @@ -322,12 +327,12 @@ return keyValue; } - static public bool KeyExists(string Key) + public bool KeyExists(string Key) { return (CountKey(Key) > 0); } - static public void WriteSetting(string Key, string Value) + public void WriteSetting(string Key, string Value) { string sqlStmt = string.Empty; @@ -355,21 +360,19 @@ ExecuteStmtNonQuery(sqlStmt); } - static public void DeleteSetting(string Key) + public void DeleteSetting(string Key) { - string sqlStmt = "DELETE FROM tblSetting WHERE key = '" + Key + "'"; ExecuteStmtNonQuery(sqlStmt); } #endregion dbsettings - public static int LexiconDataExists(string tableName, string columnName, string fieldValue) + public int LexiconDataExists(string tableName, string columnName, string fieldValue) { SQLiteParameter[] parameterArray = new SQLiteParameter[1]; parameterArray[0] = GetParameter<string>(fieldValue, "@fieldValue", DbType.String); - string sqlStmt = @" SELECT " + columnName + @"id @@ -415,6 +418,7 @@ #region default lexiconvalues + private static List<string> CreateGenreLexiconList() { List<string> genreList = new List<string>(); @@ -469,9 +473,7 @@ #endregion default lexiconvalues - - - static public List<ApplicationItem> ApplicationItemList + public List<ApplicationItem> ApplicationItemList { get { @@ -479,7 +481,7 @@ } } - static public ItemType GetItemType(string columnName, string tableName, int id) + public ItemType GetItemType(string columnName, string tableName, int id) { ItemType itemType = ItemType.UNKNOWN; @@ -491,7 +493,7 @@ #region dataaccess help methods - public static DataTable ExecuteStmtDataTable(string stmt) + public DataTable ExecuteStmtDataTable(string stmt) { DataTable dataTable = new DataTable(); @@ -514,7 +516,7 @@ return dataTable; } - public static void ExecuteStmtNonQuery(string stmt) + public void ExecuteStmtNonQuery(string stmt) { try { @@ -530,7 +532,7 @@ } } - public static void ExecuteStmtNonQuery(string stmt, SQLiteParameter[] paramcollection) + public void ExecuteStmtNonQuery(string stmt, SQLiteParameter[] paramcollection) { try { @@ -547,7 +549,7 @@ } } - public static T ExecuteStmtScalar<T>(string stmt, SQLiteParameter[] paramcollection) + public T ExecuteStmtScalar<T>(string stmt, SQLiteParameter[] paramcollection) { object o = null; @@ -564,7 +566,6 @@ return (T)Convert.ChangeType(o, typeof(T)); } return default(T); - } } catch (Exception exception) @@ -573,9 +574,7 @@ } } - - - public static object ExecuteStmtScalar(string stmt) + public object ExecuteStmtScalar(string stmt) { object o = null; try @@ -603,7 +602,7 @@ #endregion dataaccess help methods - public static void LoadAllApplicationItems() + public void LoadAllApplicationItems() { try { @@ -620,7 +619,6 @@ // applicationItem.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); globalApplicationItemList.Add(applicationItem); } - } } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -40,7 +40,7 @@ { public partial class AppSettingsFilesView : UserControl { - private List<ApplicationItem> apps = DatabaseHandler.ApplicationItemList; + private List<ApplicationItem> apps = DatabaseHandler.DBHandlerInstance.ApplicationItemList; public event EventHandler OnRefreshClick; private ApplicationItem currentApplication = null; public event EventHandler OnImageFolderSearch; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -108,7 +108,7 @@ List<ListItem> listItemList = new List<ListItem>(); - SQLiteCommand command = DatabaseHandler.SqlLiteConn.CreateCommand(); + SQLiteCommand command = DatabaseHandler.DBHandlerInstance.SqlLiteConn.CreateCommand(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -44,6 +44,7 @@ public partial class SettingsBase : UserControl { protected ConditionChecker conditionChecker = new ConditionChecker(); + protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; public SettingsBase() Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -53,7 +53,7 @@ base.LoadSettings(curApp); // plugin title - titleTextBox.Text = DatabaseHandler.ReadSetting(ProgramUtils.cPLUGINTITLE); + titleTextBox.Text = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); if (titleTextBox.Text == "") { // PluginTitle.Text = GUILocalizeStrings.Get(0); @@ -77,15 +77,15 @@ // plugin title if (titleTextBox.Text == ProgramUtils.cDefaultPluginTitle || titleTextBox.Text == "") - DatabaseHandler.DeleteSetting(ProgramUtils.cPLUGINTITLE); + dbHandlerInstance.DeleteSetting(ProgramUtils.cPLUGINTITLE); else - DatabaseHandler.WriteSetting(ProgramUtils.cPLUGINTITLE, titleTextBox.Text); + dbHandlerInstance.WriteSetting(ProgramUtils.cPLUGINTITLE, titleTextBox.Text); // sleep time - DatabaseHandler.WriteSetting(ProgramUtils.cSLIDESPEED, sleepTimeNumericUpDown.Value.ToString()); + dbHandlerInstance.WriteSetting(ProgramUtils.cSLIDESPEED, sleepTimeNumericUpDown.Value.ToString()); // use mp thumbs dir - DatabaseHandler.WriteSetting(ProgramUtils.cUSE_MP_THUMBS_DIR, checkBoxUseThumbsDir.Checked.ToString()); + dbHandlerInstance.WriteSetting(ProgramUtils.cUSE_MP_THUMBS_DIR, checkBoxUseThumbsDir.Checked.ToString()); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -57,7 +57,8 @@ #region Variables - private List<ApplicationItem> globalApplicationList = DatabaseHandler.ApplicationItemList; + private DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + private List<ApplicationItem> globalApplicationList;// = DatabaseHandler.DBHandlerInstance.ApplicationItemList; private AppSettingsDirCache appSettingsDirCache = new AppSettingsDirCache(); private AppSettingsMame appSettingsMame = new AppSettingsMame(); private AppSettingsGamebase appSettingsGameBase = new AppSettingsGamebase(); @@ -79,7 +80,9 @@ public SetupForm() { InitializeComponent(); - + //globalApplicationItemList = new ApplicationItemList(sqlDB, new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink)); + dbHandlerInstance.LoadAllApplicationItems(); + globalApplicationList = dbHandlerInstance.ApplicationItemList; appSettingsFileEditView.OnRefreshClick += new EventHandler(this.RefreshClick); //when imagefolder was clicked on filesview... appSettingsFileEditView.OnImageFolderSearch += new EventHandler(this.ImageSearchClick); @@ -654,7 +657,7 @@ //ADD POSITION CHECK? - DatabaseHandler.LoadAllApplicationItems(); + dbHandlerInstance.LoadAllApplicationItems(); UpdateTree(); } } @@ -688,7 +691,7 @@ } newApplication.SourceType = newSourceType; newApplication.InsertOrUpdateSettings(); - DatabaseHandler.LoadAllApplicationItems(); + dbHandlerInstance.LoadAllApplicationItems(); UpdateTree(); @@ -896,7 +899,7 @@ } } - DatabaseHandler.LoadAllApplicationItems(); + dbHandlerInstance.LoadAllApplicationItems(); UpdateTree(); } } @@ -951,9 +954,9 @@ } //close conn - if (DatabaseHandler.SqlLiteConn.State == ConnectionState.Open) + if (dbHandlerInstance.SqlLiteConn.State == ConnectionState.Open) { - DatabaseHandler.SqlLiteConn.Close(); + dbHandlerInstance.SqlLiteConn.Close(); } } @@ -1099,7 +1102,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery(sqlStmt); + dbHandlerInstance.ExecuteStmtNonQuery(sqlStmt); } catch (Exception exception) { @@ -1123,7 +1126,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery(sqlStmt); + dbHandlerInstance.ExecuteStmtNonQuery(sqlStmt); } catch (Exception exception) { @@ -1147,7 +1150,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery(sqlStmt); + dbHandlerInstance.ExecuteStmtNonQuery(sqlStmt); } catch (Exception exception) { @@ -1170,7 +1173,7 @@ " + column + @" <> 1 "; try { - DatabaseHandler.ExecuteStmtNonQuery(sqlStmt); + dbHandlerInstance.ExecuteStmtNonQuery(sqlStmt); } catch (Exception exception) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -70,7 +70,7 @@ /// false : plugin does not need its own button on home</returns> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { - string strText = DatabaseHandler.ReadSetting(ProgramUtils.cPLUGINTITLE); + string strText = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); if ((strText != "") && (strText != null)) { strButtonText = strText; @@ -403,6 +403,8 @@ public GUIPrograms() { + dbHandlerInstance.LoadAllApplicationItems(); + globalApplicationList = dbHandlerInstance.ApplicationItemList; GetID = (int)Window.WINDOW_FILES; LoadSettings(); skipInit = true; @@ -426,9 +428,9 @@ } - if (DatabaseHandler.SqlLiteConn.State == ConnectionState.Open) + if (dbHandlerInstance.SqlLiteConn.State == ConnectionState.Open) { - DatabaseHandler.SqlLiteConn.Close(); + dbHandlerInstance.SqlLiteConn.Close(); } } @@ -468,11 +470,12 @@ static int startWindow = (int)GUIWindow.Window.WINDOW_FILES; protected ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; + protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; bool currentSortAsc = true; ProgramViewHandler viewHandler = ProgramViewHandler.Instance; - List<ApplicationItem> allApplicationsList = DatabaseHandler.ApplicationItemList; + List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; public MapSettings mapSettings = new MapSettings(); DirectoryHistory itemHistory = new DirectoryHistory(); public ApplicationItem lastApp = null; @@ -779,7 +782,7 @@ } else { - string strText = DatabaseHandler.ReadSetting(ProgramUtils.cPLUGINTITLE); + string strText = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); if ((strText != "") && (strText != null)) { GUIPropertyManager.SetProperty("#curheader", strText); @@ -1076,7 +1079,7 @@ { List<ApplicationItem> applicationItemList = new List<ApplicationItem>(); - foreach (ApplicationItem curApp in allApplicationsList) + foreach (ApplicationItem curApp in globalApplicationList) { if (curApp.FatherID == FatherID) { @@ -1101,7 +1104,7 @@ public int GetMaxPosition(int fatherID) { int res = 0; - foreach (ApplicationItem curApp in allApplicationsList) + foreach (ApplicationItem curApp in globalApplicationList) { if ((curApp.FatherID == fatherID) && (curApp.Position > res)) { @@ -1113,7 +1116,7 @@ public ApplicationItem GetAppByID(int targetAppID) { - foreach (ApplicationItem curApp in allApplicationsList) + foreach (ApplicationItem curApp in globalApplicationList) { if (curApp.ApplicationItemId == targetAppID) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -42,6 +42,7 @@ public class GamebaseImport { private ApplicationItem applicationItem = null; + // event: read new file public delegate void MyEventHandler(string informationMessage, int progressBarCtr); @@ -68,16 +69,16 @@ string strGenre1 = myReader["ParentGenre"].ToString(); string strGenre2 = myReader["Genre"].ToString(); - int LexiconId = DatabaseHandler.LexiconDataExists("tblGenre", "genre", strGenre1); + int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre1); curFile.GenreId = LexiconId; - LexiconId = DatabaseHandler.LexiconDataExists("tblGenre", "genre", strGenre2); + LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre2); curFile.GenreStyleId = LexiconId; // todo: country curFile.Country = ""; - LexiconId = DatabaseHandler.LexiconDataExists("tblManufacturer", "manufacturer", myReader["Publisher"].ToString()); + LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblManufacturer", "manufacturer", myReader["Publisher"].ToString()); curFile.ManufacturerId = LexiconId; curFile.Year = Convert.ToInt32(myReader["Year"]); curFile.Rating = Convert.ToInt32(myReader["Rating"]) * 2; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -308,8 +308,8 @@ localRomNames.Reverse(); double total = localRomNames.Count; - - using (SQLiteTransaction transaction = DatabaseHandler.SqlLiteConn.BeginTransaction()) + + using (SQLiteTransaction transaction = DatabaseHandler.DBHandlerInstance.SqlLiteConn.BeginTransaction()) { foreach (string fileName in localRomNames) {// @@ -337,7 +337,7 @@ { curFile.Year = Convert.ToInt32(match.Groups["year"].Value); - int LexiconId = DatabaseHandler.LexiconDataExists("tblManufacturer", "manufacturer", match.Groups["manufacturer"].Value); + int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblManufacturer", "manufacturer", match.Groups["manufacturer"].Value); curFile.ManufacturerId = LexiconId; @@ -420,7 +420,7 @@ ProcessFullEntry(curFile, fullEntry); ProcessGenreEntry(curFile, genreEntry); - int LexiconId = DatabaseHandler.LexiconDataExists("tblPlatform", "platform", "Arcade"); + int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblPlatform", "platform", "Arcade"); curFile.PlatformId = LexiconId; curFile.Rating = 5; @@ -475,10 +475,10 @@ { genres[z] = tmpArr[z]; } - int LexiconId = DatabaseHandler.LexiconDataExists("tblGenre", "genre", genres[0].ToString()); + int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", genres[0].ToString()); curFile.GenreId = LexiconId; - LexiconId = DatabaseHandler.LexiconDataExists("tblGenre", "genre", genres[1].ToString()); + LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", genres[1].ToString()); curFile.GenreStyleId = LexiconId; } // mspacman=Maze Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -510,7 +510,7 @@ filePath = pathSubfolders; string sqlQuery = ViewHandler.BuildQuery( appID, pathSubfolders ); - using ( SQLiteCommand command = DatabaseHandler.SqlLiteConn.CreateCommand() ) + using (SQLiteCommand command = dbHandlerInstance.SqlLiteConn.CreateCommand()) { command.CommandText = sqlQuery; using ( SQLiteDataReader dataReader = command.ExecuteReader() ) @@ -746,7 +746,7 @@ int result = 0; // won't work in multiuser environment :) string sqlStmt = "SELECT MAX(applicationId) FROM tblApplicationItem"; - object o = DatabaseHandler.ExecuteStmtScalar( sqlStmt ); + object o = dbHandlerInstance.ExecuteStmtScalar( sqlStmt ); if ( o.ToString() != "" ) { result = Convert.ToInt32( o ); @@ -850,7 +850,7 @@ @postLaunch )"; - DatabaseHandler.ExecuteStmtNonQuery( sqlStmt, parameterArray ); + dbHandlerInstance.ExecuteStmtNonQuery( sqlStmt, parameterArray ); } catch ( SQLiteException ex ) { @@ -922,7 +922,7 @@ WHERE applicationId = @applicationItemId"; - DatabaseHandler.ExecuteStmtNonQuery( sqlStmt, parameterArray ); ; + dbHandlerInstance.ExecuteStmtNonQuery( sqlStmt, parameterArray ); ; } catch ( SQLiteException ex ) { @@ -942,7 +942,7 @@ { DeleteFiles(); DeleteFileLinks(paramArray); - DatabaseHandler.ExecuteStmtNonQuery( "DELETE FROM tblApplicationItem WHERE applicationId = @applicationItemId",paramArray); + dbHandlerInstance.ExecuteStmtNonQuery( "DELETE FROM tblApplicationItem WHERE applicationId = @applicationItemId",paramArray); } catch ( SQLiteException ex ) { @@ -957,7 +957,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery( "DELETE FROM tblFileItem WHERE applicationId = " +ApplicationItemId ); + dbHandlerInstance.ExecuteStmtNonQuery( "DELETE FROM tblFileItem WHERE applicationId = " +ApplicationItemId ); } catch ( SQLiteException ex ) { @@ -971,7 +971,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery( "DELETE FROM tblFileLinkItem WHERE applicationId = @applicationItemId OR grouperappid = @applicationItemId",paramArray ); + dbHandlerInstance.ExecuteStmtNonQuery( "DELETE FROM tblFileLinkItem WHERE applicationId = @applicationItemId OR grouperappid = @applicationItemId",paramArray ); } catch ( SQLiteException ex ) { @@ -1026,9 +1026,9 @@ try { // 1) initialize TAG.. // update command to fix one single link - DatabaseHandler.ExecuteStmtNonQuery( "update tblFileLinkItem set updateFlag = 1234 where applicationId = " + ApplicationItemId ); + dbHandlerInstance.ExecuteStmtNonQuery( "update tblFileLinkItem set updateFlag = 1234 where applicationId = " + ApplicationItemId ); - dataTable = DatabaseHandler.ExecuteStmtDataTable( sqlSelectDataToFix ); + dataTable = dbHandlerInstance.ExecuteStmtDataTable( sqlSelectDataToFix ); // 2) fix all fileids of the newly imported files @@ -1038,13 +1038,13 @@ { newFileID = Convert.ToInt32( row["newfileid"] ); filenameToFix = row["filename"].ToString(); - DatabaseHandler.ExecuteStmtNonQuery( "update tblFileLinkItem set fileID = " + newFileID + ", updateFlag = 0 where applicationId = " + ApplicationItemId + " and filename = '" + filenameToFix + "'" ); + dbHandlerInstance.ExecuteStmtNonQuery( "update tblFileLinkItem set fileID = " + newFileID + ", updateFlag = 0 where applicationId = " + ApplicationItemId + " and filename = '" + filenameToFix + "'" ); } // 3) delete untouched links ( they were not imported anymore ) - DatabaseHandler.ExecuteStmtNonQuery( @"delete from tblFileLinkItem where applicationId = " + ApplicationItemId + " and updateFlag = 1234" ); + dbHandlerInstance.ExecuteStmtNonQuery( @"delete from tblFileLinkItem where applicationId = " + ApplicationItemId + " and updateFlag = 1234" ); } catch ( SQLiteException ex ) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -236,7 +236,7 @@ } private void ImportDirectory(string[] fileDirPaths, bool mpGuiMode) { - using ( SQLiteTransaction transaction = DatabaseHandler.SqlLiteConn.BeginTransaction() ) + using ( SQLiteTransaction transaction = dbHandlerInstance.SqlLiteConn.BeginTransaction() ) { //get all maindirs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -113,7 +113,7 @@ item.StartupDir = (string)dataReader["startupdir"]; item.UseShellExecute =(bool) dataReader["useShellExecute"]; item.UseQuotes =(bool) dataReader["useQuotes"]; - item.SourceType = (ItemType) DatabaseHandler.GetItemType("applicationItemType","tblApplicationItem",item.ApplicationItemId); + item.SourceType = (ItemType) DatabaseHandler.DBHandlerInstance.GetItemType("applicationItemType","tblApplicationItem",item.ApplicationItemId); item.Source = (string)dataReader["source"]; item.Imagefile = (string)dataReader["imagefile"]; item.FileDirectory = (string)dataReader["filedirectory"]; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -128,7 +128,7 @@ filePath = pathSubfolders; - using ( SQLiteCommand command = DatabaseHandler.SqlLiteConn.CreateCommand() ) + using ( SQLiteCommand command = dbHandlerInstance.SqlLiteConn.CreateCommand() ) { command.CommandText = strSQL; using ( SQLiteDataReader dataReader = command.ExecuteReader() ) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -22,8 +22,7 @@ public abstract class BaseItem { - - protected static SQLiteConnection sqlDB = DatabaseHandler.SqlLiteConn; + protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; public ProgramViewHandler ViewHandler = ProgramViewHandler.Instance; public string filePath = ""; //s protected FilelinkItemList fileLinks = null; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -521,7 +521,7 @@ - DatabaseHandler.ExecuteStmtNonQuery( sqlStmt, parameterArray ); + dbHandlerInstance.ExecuteStmtNonQuery( sqlStmt, parameterArray ); } catch ( SQLiteException ex ) @@ -576,7 +576,7 @@ WHERE fileid = @fileId"; - DatabaseHandler.ExecuteStmtNonQuery(sqlStmt,parameterArray); + dbHandlerInstance.ExecuteStmtNonQuery(sqlStmt,parameterArray); } catch ( SQLiteException ex ) { @@ -598,7 +598,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery(@" + dbHandlerInstance.ExecuteStmtNonQuery(@" UPDATE tblFileItem SET @@ -634,8 +634,8 @@ { try { - DatabaseHandler.ExecuteStmtNonQuery( @"DELETE FROM tblFileLinkItem WHERE fileid = " + this.FileID ); - DatabaseHandler.ExecuteStmtNonQuery( @"DELETE FROM tblFileItem WHERE fileid = " + this.FileID ); + dbHandlerInstance.ExecuteStmtNonQuery( @"DELETE FROM tblFileLinkItem WHERE fileid = " + this.FileID ); + dbHandlerInstance.ExecuteStmtNonQuery( @"DELETE FROM tblFileItem WHERE fileid = " + this.FileID ); } catch ( SQLiteException ex ) @@ -720,16 +720,16 @@ { if ( this.FileInfoFavourite != null ) { - int LexiconId = DatabaseHandler.LexiconDataExists( "tblGenre", "genre", FileInfoFavourite.Genre ); + int LexiconId = dbHandlerInstance.LexiconDataExists( "tblGenre", "genre", FileInfoFavourite.Genre ); this.GenreId = LexiconId; - LexiconId = DatabaseHandler.LexiconDataExists( "tblGenre", "genre", FileInfoFavourite.GenreStyle ); + LexiconId = dbHandlerInstance.LexiconDataExists("tblGenre", "genre", FileInfoFavourite.GenreStyle); this.GenreStyleId = LexiconId; - LexiconId = DatabaseHandler.LexiconDataExists( "tblManufacturer", "manufacturer", FileInfoFavourite.Manufacturer ); + LexiconId = dbHandlerInstance.LexiconDataExists( "tblManufacturer", "manufacturer", FileInfoFavourite.Manufacturer ); this.ManufacturerId = LexiconId; - LexiconId = DatabaseHandler.LexiconDataExists( "tblPlatform", "platform", FileInfoFavourite.Platform ); + LexiconId = dbHandlerInstance.LexiconDataExists( "tblPlatform", "platform", FileInfoFavourite.Platform ); this.PlatformId = LexiconId; if (importTitle) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -77,7 +77,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery(String.Format(String.Format("DELETE FROM tblFileLinkItem WHERE applicationId = {0} AND grouperAppID = {1} AND fileID = {2}", this.TargetAppID, + dbHandlerInstance.ExecuteStmtNonQuery(String.Format(String.Format("DELETE FROM tblFileLinkItem WHERE applicationId = {0} AND grouperAppID = {1} AND fileID = {2}", this.TargetAppID, this.AppID, this.FileID))); } catch (SQLiteException ex) @@ -90,7 +90,7 @@ private bool Exists() { - bool res = (bool) DatabaseHandler.ExecuteStmtScalar(String.Format("SELECT COUNT(*) FROM tblFileLinkItem WHERE applicationId = {0} AND grouperAppID = {1} AND fileID = {2}", this.TargetAppID, + bool res = (bool) dbHandlerInstance.ExecuteStmtScalar(String.Format("SELECT COUNT(*) FROM tblFileLinkItem WHERE applicationId = {0} AND grouperAppID = {1} AND fileID = {2}", this.TargetAppID, this.AppID, this.FileID)); return res ; @@ -106,7 +106,7 @@ try { - DatabaseHandler.ExecuteStmtNonQuery(@" + dbHandlerInstance.ExecuteStmtNonQuery(@" INSERT INTO tblFileLinkItem ( Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -383,7 +383,7 @@ try { - SQLiteCommand command = new SQLiteCommand(DatabaseHandler.SqlLiteConn); + SQLiteCommand command = new SQLiteCommand(DatabaseHandler.DBHandlerInstance.SqlLiteConn); command.CommandText = sqlStmt; using (SQLiteDataReader dataReader = command.ExecuteReader()) @@ -412,7 +412,7 @@ { int sleepTime; - if (int.TryParse(DatabaseHandler.ReadSetting(ProgramUtils.cSLIDESPEED), out sleepTime)) + if (int.TryParse(DatabaseHandler.DBHandlerInstance.ReadSetting(ProgramUtils.cSLIDESPEED), out sleepTime)) return sleepTime; else return cDefaultSleepTime; @@ -422,7 +422,7 @@ { bool useThumbsDir; - if (bool.TryParse(DatabaseHandler.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR), out useThumbsDir)) + if (bool.TryParse(DatabaseHandler.DBHandlerInstance.ReadSetting(ProgramUtils.cUSE_MP_THUMBS_DIR), out useThumbsDir)) return useThumbsDir; else return true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs 2007-08-13 18:00:08 UTC (rev 832) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs 2007-08-13 23:44:56 UTC (rev 833) @@ -470,7 +470,7 @@ if (sqlSelect.Distinct) { - return "SELECT DISTINCT TRIM(title) FROM (" + sqlSelect.AsSQL + ")"; + return "SELECT DISTINCT TRIM(title) as title FROM (" + sqlSelect.AsSQL + ")"; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-08-14 09:28:50
|
Revision: 836 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=836&view=rev Author: northern_sky Date: 2007-08-14 02:28:48 -0700 (Tue, 14 Aug 2007) Log Message: ----------- misc cleanup Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -21,10 +21,11 @@ * */ -#endregion +#endregion Copyright (C) 2005-2007 Team MediaPortal +#region Imports + using System; - using System.Collections; using System.Collections.Generic; using System.IO; @@ -37,6 +38,7 @@ using System.Data.SQLite; using GUIPrograms.Items; +#endregion Imports namespace GUIPrograms.Database { /// <summary> @@ -45,16 +47,21 @@ /// </summary> public sealed class DatabaseHandler { + #region Variables + private SQLiteConnection sqlLiteConnection = null; private List<ApplicationItem> globalApplicationItemList = new List<ApplicationItem>(); private readonly string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; private static DatabaseHandler instance = new DatabaseHandler(); + #endregion Variables + + #region Constructors/Destructors + // Explicit static constructor to tell C# compiler // not to mark type as beforefieldinit static DatabaseHandler() { } - private DatabaseHandler() { string DatabasePath = Config.GetFile(Config.Dir.Database, DATABASEFILE); @@ -89,28 +96,15 @@ } } + #endregion Constructors/Destructors + + #region Properties + public static DatabaseHandler DBHandlerInstance { get { return instance; } } - private void SetPragmas() - { - ExecuteStmtNonQuery("PRAGMA default_cache_size=3000"); - ExecuteStmtNonQuery("PRAGMA count_changes=1"); - ExecuteStmtNonQuery("PRAGMA short_column_names=1"); - ExecuteStmtNonQuery("PRAGMA auto_vacuum=1"); - } - - /*static void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) - { - ApplicationItem targetApp = globalApplicationItemList.GetAppByID(curLink.TargetAppID); - if (targetApp != null) - { - targetApp.LaunchFile(curLink, MPGUIMode); - } - }*/ - // we can always keep an connection open in sqllite.. //to expensive closing it public SQLiteConnection SqlLiteConn @@ -125,167 +119,20 @@ } } - /// <summary> - /// Create db tables etc,if not already exist - /// </summary> - /// <returns></returns> - bool CreateDBTables() + public List<ApplicationItem> ApplicationItemList { - string sqlStmt = @"CREATE TABLE - tblApplicationItem - ( - applicationId INTEGER PRIMARY KEY, - fatherNodeId INTEGER, - title TEXT, - filename TEXT, - arguments TEXT, - windowstyle TEXT, - startupdir TEXT, - useShellExecute BOOL, - useQuotes BOOL, - applicationItemType TEXT, - source TEXT, - imagefile TEXT, - filedirectory TEXT, - imagedirectory TEXT, - validExtensions TEXT, - enabled BOOL, - importValidImagesOnly BOOL, - iposition INTEGER, - refreshGUIAllowed BOOL, - platformId INTEGER, - waitForExit BOOL, - preLaunch TEXT, - postLaunch TEXT - )"; - - - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, genreId INTEGER, genreStyleId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, platformId INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, categorydata TEXT, gameInfoUrl TEXT)"; - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE TABLE tblFileLinkItem (applicationId INTEGER, grouperAppID INTEGER, fileID INTEGER, filename TEXT, updateFlag INTEGER)"; - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE TABLE tblSetting (settingid INTEGER PRIMARY KEY, key TEXT, value TEXT)"; - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE TABLE - tblGenre - ( - genreId INTEGER PRIMARY KEY, - genre TEXT - )"; - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE TABLE - tblPlatform - ( - platformId INTEGER PRIMARY KEY, - platform TEXT - )"; - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE TABLE - tblManufacturer - ( - manufacturerId INTEGER PRIMARY KEY, - manufacturer TEXT - )"; - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"CREATE INDEX idxFile1 ON tblFileItem(applicationId)"; - ExecuteStmtNonQuery(sqlStmt); - sqlStmt = @"CREATE INDEX idxApp1 ON tblApplicationItem(fatherNodeId)"; - ExecuteStmtNonQuery(sqlStmt); - sqlStmt = @"CREATE UNIQUE INDEX idxFilterItem1 ON tblFileLinkItem(applicationId, fileID, grouperAppID)"; - ExecuteStmtNonQuery(sqlStmt); - - return true; - } - - /// <summary> - /// Inserting some default values so that the db is preloaded - /// Should always be there. - /// </summary> - private void InsertDefaultDBValues() - { - - string sqlStmt = @"INSERT INTO - tblGenre - ( - genre - ) - VALUES - ( - 'Unknown' - )"; - - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"INSERT INTO - tblManufacturer - ( - manufacturer - ) - VALUES - ( - 'Unknown' - )"; - - - ExecuteStmtNonQuery(sqlStmt); - - sqlStmt = @"INSERT INTO - tblPlatform - ( - platform - ) - VALUES - ( - 'Unknown' - )"; - - ExecuteStmtNonQuery(sqlStmt); - - - using (SQLiteTransaction transaction = SqlLiteConn.BeginTransaction()) + get { - FillDefaultDBLexiconHelper("tblPlatform", "platform", CreateSystemLexiconList()); - FillDefaultDBLexiconHelper("tblManufacturer", "manufacturer", CreateManufacturerLexiconList()); - FillDefaultDBLexiconHelper("tblGenre", "genre", CreateGenreLexiconList()); - - transaction.Commit(); + return globalApplicationItemList; } - } - private void FillDefaultDBLexiconHelper(string tableName, string columnName, List<string> itemList) - { - SQLiteParameter[] paramCollection = new SQLiteParameter[1]; - SQLiteParameter paramInsertValue = new SQLiteParameter("@insertValue", DbType.String); - paramCollection[0] = paramInsertValue; + #endregion Properties - string sqlStmt = @" - INSERT INTO - " + tableName + @" - ( - " + columnName + @" - ) - VALUES - ( - @insertValue - );"; + #region Public Methods - foreach (string insertValue in itemList) - { - paramCollection[0].Value = insertValue; - ExecuteStmtNonQuery(sqlStmt, paramCollection); - } - } + #region dbsettings - #region dbsettings public string ReadSetting(string Key) { string sqlStmt = string.Empty; @@ -310,7 +157,7 @@ return keyValue; } - int CountKey(string Key) + public int CountKey(string Key) { string sqlStmt = string.Empty; int keyValue = 0; @@ -347,7 +194,6 @@ WHERE key = '" + Key + "'"; - } else { @@ -369,7 +215,6 @@ public int LexiconDataExists(string tableName, string columnName, string fieldValue) { - SQLiteParameter[] parameterArray = new SQLiteParameter[1]; parameterArray[0] = GetParameter<string>(fieldValue, "@fieldValue", DbType.String); @@ -396,7 +241,6 @@ try { - int lexiconId = ExecuteStmtScalar<Int32>(sqlStmt, parameterArray); //lexion didnt exist, we save it @@ -417,78 +261,12 @@ } - #region default lexiconvalues - - private static List<string> CreateGenreLexiconList() - { - List<string> genreList = new List<string>(); - - - genreList.Add("Shooter"); - genreList.Add("Platform"); - genreList.Add("Adventure"); - - return genreList; - } - - private static List<string> CreateManufacturerLexiconList() - { - List<string> manufacturerList = new List<string>(); - - manufacturerList.Add("Sega"); - manufacturerList.Add("Nintendo"); - manufacturerList.Add("Konami"); - - return manufacturerList; - } - - private static List<string> CreateSystemLexiconList() - { - List<string> systemList = new List<string>(); - systemList.Add(""); - systemList.Add("Atari 5200"); - systemList.Add("Atari 7800"); - systemList.Add("Atari Lynx"); - systemList.Add("Atari ST"); - systemList.Add("Atari Video Computer System"); - systemList.Add("Commodore 64/128"); - systemList.Add("Commodore Amiga"); - systemList.Add("Game Boy"); - systemList.Add("Game Boy Advance"); - systemList.Add("Game Boy Color"); - systemList.Add("Neo Geo"); - systemList.Add("Nintendo 64"); - systemList.Add("Nintendo Entertainment System"); - systemList.Add("PlayStation"); - systemList.Add("Sega Dreamcast"); - systemList.Add("Sega Game Gear"); - systemList.Add("Sega Genesis"); - systemList.Add("Sega Master System"); - systemList.Add("Super NES"); - systemList.Add("TurboGrafx-16"); - systemList.Add("Arcade"); - systemList.Add("PC"); - return systemList; - } - - #endregion default lexiconvalues - - public List<ApplicationItem> ApplicationItemList - { - get - { - return globalApplicationItemList; - } - } - public ItemType GetItemType(string columnName, string tableName, int id) { ItemType itemType = ItemType.UNKNOWN; + string sqlStmt = "SELECT " + columnName + " FROM " + tableName + " WHERE applicationId = " + id; - string sqlStmt = "select " + columnName + " from " + tableName + " where applicationid = " + id; - - itemType = ProgramUtils.StringToSourceType(ExecuteStmtScalar(sqlStmt).ToString()); - return itemType; + return ProgramUtils.StringToSourceType(ExecuteStmtScalar(sqlStmt).ToString()); } #region dataaccess help methods @@ -499,7 +277,6 @@ try { - using (SQLiteCommand command = new SQLiteCommand(SqlLiteConn)) { command.CommandText = stmt; @@ -551,7 +328,6 @@ public T ExecuteStmtScalar<T>(string stmt, SQLiteParameter[] paramcollection) { - object o = null; try { @@ -592,7 +368,7 @@ return o; } - public static SQLiteParameter GetParameter<G>(G value, string parameterName, DbType type) + public SQLiteParameter GetParameter<G>(G value, string parameterName, DbType type) { SQLiteParameter parameter = new SQLiteParameter(parameterName, type); parameter.Value = value; @@ -604,28 +380,259 @@ public void LoadAllApplicationItems() { - try + + globalApplicationItemList.Clear(); + + using (SQLiteCommand command = SqlLiteConn.CreateCommand()) { - globalApplicationItemList.Clear(); - - using (SQLiteCommand command = SqlLiteConn.CreateCommand()) + command.CommandText = "SELECT * FROM tblApplicationItem ORDER BY iposition"; + using (SQLiteDataReader dataReader = command.ExecuteReader()) { - command.CommandText = "SELECT * FROM tblApplicationItem order by iposition"; - using (SQLiteDataReader dataReader = command.ExecuteReader()) + while (dataReader.Read()) { - while (dataReader.Read()) - { - ApplicationItem applicationItem = (ApplicationItem)ApplicationItemFactory.AppFactory.GetApplicationItem(GetItemType("applicationItemType", "tblApplicationItem", Convert.ToInt32(dataReader["applicationId"])), dataReader); - // applicationItem.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); - globalApplicationItemList.Add(applicationItem); - } + ApplicationItem applicationItem = (ApplicationItem) ItemFactory.ItemFactoryInstance.GetItem(GetItemType("applicationItemType", "tblApplicationItem", Convert.ToInt32(dataReader["applicationId"])), dataReader); + // applicationItem.OnLaunchFilelink += new ApplicationItem.FilelinkLaunchEventHandler(LaunchFilelink); + globalApplicationItemList.Add(applicationItem); } } } - catch (SQLiteException ex) + } + + + + #endregion Public Methods + + #region Private Methods + + private void SetPragmas() + { + ExecuteStmtNonQuery("PRAGMA default_cache_size=3000"); + ExecuteStmtNonQuery("PRAGMA count_changes=1"); + ExecuteStmtNonQuery("PRAGMA short_column_names=1"); + ExecuteStmtNonQuery("PRAGMA auto_vacuum=1"); + } + + /// <summary> + /// Create db tables etc,if not already exist + /// </summary> + /// <returns></returns> + private bool CreateDBTables() + { + string sqlStmt = @"CREATE TABLE + tblApplicationItem + ( + applicationId INTEGER PRIMARY KEY, + fatherNodeId INTEGER, + title TEXT, + filename TEXT, + arguments TEXT, + windowstyle TEXT, + startupdir TEXT, + useShellExecute BOOL, + useQuotes BOOL, + applicationItemType TEXT, + source TEXT, + imagefile TEXT, + filedirectory TEXT, + imagedirectory TEXT, + validExtensions TEXT, + enabled BOOL, + importValidImagesOnly BOOL, + iposition INTEGER, + refreshGUIAllowed BOOL, + platformId INTEGER, + waitForExit BOOL, + preLaunch TEXT, + postLaunch TEXT + )"; + + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE TABLE tblFileItem (fileid INTEGER PRIMARY KEY, applicationId INTEGER, title TEXT, filename TEXT, imagefile TEXT, genreId INTEGER, genreStyleId INTEGER, country TEXT, manufacturerId INTEGER, year INTEGER, rating INTEGER, overview TEXT, platformId INTEGER, lastTimeLaunched TEXT, launchcount INTEGER, categorydata TEXT, gameInfoUrl TEXT)"; + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE TABLE tblFileLinkItem (applicationId INTEGER, grouperAppID INTEGER, fileID INTEGER, filename TEXT, updateFlag INTEGER)"; + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE TABLE tblSetting (settingid INTEGER PRIMARY KEY, key TEXT, value TEXT)"; + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE TABLE + tblGenre + ( + genreId INTEGER PRIMARY KEY, + genre TEXT + )"; + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE TABLE + tblPlatform + ( + platformId INTEGER PRIMARY KEY, + platform TEXT + )"; + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE TABLE + tblManufacturer + ( + manufacturerId INTEGER PRIMARY KEY, + manufacturer TEXT + )"; + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"CREATE INDEX idxFile1 ON tblFileItem(applicationId)"; + ExecuteStmtNonQuery(sqlStmt); + sqlStmt = @"CREATE INDEX idxApp1 ON tblApplicationItem(fatherNodeId)"; + ExecuteStmtNonQuery(sqlStmt); + sqlStmt = @"CREATE UNIQUE INDEX idxFilterItem1 ON tblFileLinkItem(applicationId, fileID, grouperAppID)"; + ExecuteStmtNonQuery(sqlStmt); + + return true; + } + + /// <summary> + /// Inserting some default values so that the db is preloaded + /// Should always be there. + /// </summary> + private void InsertDefaultDBValues() + { + string sqlStmt = @"INSERT INTO + tblGenre + ( + genre + ) + VALUES + ( + 'Unknown' + )"; + + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"INSERT INTO + tblManufacturer + ( + manufacturer + ) + VALUES + ( + 'Unknown' + )"; + + + ExecuteStmtNonQuery(sqlStmt); + + sqlStmt = @"INSERT INTO + tblPlatform + ( + platform + ) + VALUES + ( + 'Unknown' + )"; + + ExecuteStmtNonQuery(sqlStmt); + + using (SQLiteTransaction transaction = SqlLiteConn.BeginTransaction()) { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + FillDefaultDBLexiconHelper("tblPlatform", "platform", CreateSystemLexiconList()); + FillDefaultDBLexiconHelper("tblManufacturer", "manufacturer", CreateManufacturerLexiconList()); + FillDefaultDBLexiconHelper("tblGenre", "genre", CreateGenreLexiconList()); + + transaction.Commit(); } } + + private void FillDefaultDBLexiconHelper(string tableName, string columnName, List<string> itemList) + { + SQLiteParameter[] paramCollection = new SQLiteParameter[1]; + SQLiteParameter paramInsertValue = new SQLiteParameter("@insertValue", DbType.String); + paramCollection[0] = paramInsertValue; + + string sqlStmt = @" + INSERT INTO + " + tableName + @" + ( + " + columnName + @" + ) + VALUES + ( + @insertValue + );"; + + foreach (string insertValue in itemList) + { + paramCollection[0].Value = insertValue; + ExecuteStmtNonQuery(sqlStmt, paramCollection); + } + } + + #region default lexiconvalues + + private static List<string> CreateGenreLexiconList() + { + List<string> genreList = new List<string>(); + + genreList.Add("Shooter"); + genreList.Add("Platform"); + genreList.Add("Adventure"); + + return genreList; + } + + private static List<string> CreateManufacturerLexiconList() + { + List<string> manufacturerList = new List<string>(); + + manufacturerList.Add("Sega"); + manufacturerList.Add("Nintendo"); + manufacturerList.Add("Konami"); + + return manufacturerList; + } + + private static List<string> CreateSystemLexiconList() + { + List<string> systemList = new List<string>(); + systemList.Add(""); + systemList.Add("Atari 5200"); + systemList.Add("Atari 7800"); + systemList.Add("Atari Lynx"); + systemList.Add("Atari ST"); + systemList.Add("Atari Video Computer System"); + systemList.Add("Commodore 64/128"); + systemList.Add("Commodore Amiga"); + systemList.Add("Game Boy"); + systemList.Add("Game Boy Advance"); + systemList.Add("Game Boy Color"); + systemList.Add("Neo Geo"); + systemList.Add("Nintendo 64"); + systemList.Add("Nintendo Entertainment System"); + systemList.Add("PlayStation"); + systemList.Add("Sega Dreamcast"); + systemList.Add("Sega Game Gear"); + systemList.Add("Sega Genesis"); + systemList.Add("Sega Master System"); + systemList.Add("Super NES"); + systemList.Add("TurboGrafx-16"); + systemList.Add("Arcade"); + systemList.Add("PC"); + + return systemList; + } + + #endregion default lexiconvalues + + #endregion Private Methods + + /*static void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + ApplicationItem targetApp = globalApplicationItemList.GetAppByID(curLink.TargetAppID); + if (targetApp != null) + { + targetApp.LaunchFile(curLink, MPGUIMode); + } + }*/ } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -679,7 +679,7 @@ { if (SaveAppItem()) { - ApplicationItem newApplication = (ApplicationItem)ApplicationItemFactory.AppFactory.GetApplicationItem(newSourceType, null); + ApplicationItem newApplication = (ApplicationItem) ItemFactory.ItemFactoryInstance.GetItem(newSourceType, null); globalApplicationList.Add(newApplication); newApplication.FatherID = GetTreeNodeApplicationItemId(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -1128,7 +1128,7 @@ /* public ApplicationItem CloneAppItem(ApplicationItem sourceApp) { - ApplicationItem newApp = (ApplicationItem)ApplicationItemFactory.AppFactory.GetApplicationItem(sqlDB, sourceApp.SourceType, null, 0); + ApplicationItem newApp = (ApplicationItem)ItemFactory.itemFactoryInstance.GetItem(sqlDB, sourceApp.SourceType, null, 0); newApp.Assign(sourceApp); newApp.ApplicationItemId = -1; // to force a sql INSERT when written Add(newApp); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -519,12 +519,12 @@ { if ( ViewHandler.IsFilterQuery ) { - FilterItem curFile = ( FilterItem ) ApplicationItemFactory.AppFactory.GetApplicationItem( ItemType.FILTERITEM, dataReader ); + FilterItem curFile = (FilterItem) itemFactoryInstance.GetItem(ItemType.FILTERITEM, dataReader); ItemList.Add( curFile ); } else { - FileItem curFile = ( FileItem ) ApplicationItemFactory.AppFactory.GetApplicationItem( ItemType.FILEITEM, dataReader ); + FileItem curFile = (FileItem) itemFactoryInstance.GetItem(ItemType.FILEITEM, dataReader); ItemList.Add( curFile ); } } @@ -761,29 +761,29 @@ SQLiteParameter[] parameterArray = new SQLiteParameter[23]; ApplicationItemId = GetNewAppID(); // important to avoid subsequent inserts! //params for question + values - parameterArray[0] = DatabaseHandler.GetParameter<int>( ApplicationItemId, "@applicationItemId", DbType.Int32 ); - parameterArray[1] = DatabaseHandler.GetParameter<int>( FatherID, "@fatherNodeId", DbType.Int32); - parameterArray[2] = DatabaseHandler.GetParameter<string>( Title, "@title", DbType.String); - parameterArray[3] = DatabaseHandler.GetParameter<string>( Filename, "@filename", DbType.String ); - parameterArray[4] = DatabaseHandler.GetParameter<string>( Arguments, "@arguments", DbType.String); - parameterArray[5] = DatabaseHandler.GetParameter<string>( ProgramUtils.WindowStyleToStr( WindowStyle ), "@windowStyle", DbType.String); - parameterArray[6] = DatabaseHandler.GetParameter<string>( StartupDir, "@startupDir", DbType.String ); - parameterArray[7] = DatabaseHandler.GetParameter<bool>( UseShellExecute, "@useShellExecute", DbType.Boolean ); - parameterArray[8] = DatabaseHandler.GetParameter<bool>( UseQuotes, "@useQuotes", DbType.Boolean); - parameterArray[9] = DatabaseHandler.GetParameter<string>( ProgramUtils.ApplicationTypeToString( SourceType ), "@applicationItemType", DbType.String ); - parameterArray[10] = DatabaseHandler.GetParameter<string>( Source, "@source", DbType.String); - parameterArray[11] = DatabaseHandler.GetParameter<string>( imageFile, "@imageFile", DbType.String ); - parameterArray[12] = DatabaseHandler.GetParameter<string>( FileDirectory, "@fileDirectory", DbType.String ); - parameterArray[13] = DatabaseHandler.GetParameter<string>( ImageDirectory, "@imageDirectory", DbType.String ); - parameterArray[14] = DatabaseHandler.GetParameter<string>( ValidExtensions, "@validExtensions", DbType.String); - parameterArray[15] = DatabaseHandler.GetParameter<bool>( ImportValidImagesOnly, "@importValidImagesOnly", DbType.Boolean ); - parameterArray[16] = DatabaseHandler.GetParameter<int>( Position, "@position", DbType.Int32 ); - parameterArray[17] = DatabaseHandler.GetParameter<bool>( Enabled, "@enabled", DbType.Boolean); - parameterArray[18] = DatabaseHandler.GetParameter<bool>( RefreshGUIAllowed, "@refreshGUIAllowed", DbType.Boolean ); - parameterArray[19] = DatabaseHandler.GetParameter<int>( PlatformId, "@platformId", DbType.Int32); - parameterArray[20] = DatabaseHandler.GetParameter<bool>( WaitForExit, "@waitForExit", DbType.Boolean); - parameterArray[21] = DatabaseHandler.GetParameter<string>( PreLaunch, "@preLaunch", DbType.String); - parameterArray[22] = DatabaseHandler.GetParameter<string>( PostLaunch, "@postLaunch", DbType.String); + parameterArray[0] = dbHandlerInstance.GetParameter<int>( ApplicationItemId, "@applicationItemId", DbType.Int32 ); + parameterArray[1] = dbHandlerInstance.GetParameter<int>( FatherID, "@fatherNodeId", DbType.Int32); + parameterArray[2] = dbHandlerInstance.GetParameter<string>( Title, "@title", DbType.String); + parameterArray[3] = dbHandlerInstance.GetParameter<string>( Filename, "@filename", DbType.String ); + parameterArray[4] = dbHandlerInstance.GetParameter<string>( Arguments, "@arguments", DbType.String); + parameterArray[5] = dbHandlerInstance.GetParameter<string>( ProgramUtils.WindowStyleToStr( WindowStyle ), "@windowStyle", DbType.String); + parameterArray[6] = dbHandlerInstance.GetParameter<string>( StartupDir, "@startupDir", DbType.String ); + parameterArray[7] = dbHandlerInstance.GetParameter<bool>( UseShellExecute, "@useShellExecute", DbType.Boolean ); + parameterArray[8] = dbHandlerInstance.GetParameter<bool>( UseQuotes, "@useQuotes", DbType.Boolean); + parameterArray[9] = dbHandlerInstance.GetParameter<string>( ProgramUtils.ApplicationTypeToString( SourceType ), "@applicationItemType", DbType.String ); + parameterArray[10] = dbHandlerInstance.GetParameter<string>( Source, "@source", DbType.String); + parameterArray[11] = dbHandlerInstance.GetParameter<string>( imageFile, "@imageFile", DbType.String ); + parameterArray[12] = dbHandlerInstance.GetParameter<string>( FileDirectory, "@fileDirectory", DbType.String ); + parameterArray[13] = dbHandlerInstance.GetParameter<string>( ImageDirectory, "@imageDirectory", DbType.String ); + parameterArray[14] = dbHandlerInstance.GetParameter<string>( ValidExtensions, "@validExtensions", DbType.String); + parameterArray[15] = dbHandlerInstance.GetParameter<bool>( ImportValidImagesOnly, "@importValidImagesOnly", DbType.Boolean ); + parameterArray[16] = dbHandlerInstance.GetParameter<int>( Position, "@position", DbType.Int32 ); + parameterArray[17] = dbHandlerInstance.GetParameter<bool>( Enabled, "@enabled", DbType.Boolean); + parameterArray[18] = dbHandlerInstance.GetParameter<bool>( RefreshGUIAllowed, "@refreshGUIAllowed", DbType.Boolean ); + parameterArray[19] = dbHandlerInstance.GetParameter<int>( PlatformId, "@platformId", DbType.Int32); + parameterArray[20] = dbHandlerInstance.GetParameter<bool>( WaitForExit, "@waitForExit", DbType.Boolean); + parameterArray[21] = dbHandlerInstance.GetParameter<string>( PreLaunch, "@preLaunch", DbType.String); + parameterArray[22] = dbHandlerInstance.GetParameter<string>( PostLaunch, "@postLaunch", DbType.String); // " + ProgramUtils.TrueOrFalseToInt(UseShellExecute.ToString()) + @", //'" + ProgramUtils.ApplicationTypeToString(SourceType) + @"', @@ -866,29 +866,29 @@ SQLiteParameter[] parameterArray = new SQLiteParameter[23]; //params for question + values - parameterArray[0] = DatabaseHandler.GetParameter<int>( ApplicationItemId, "@applicationItemId", DbType.Int32 ); - parameterArray[1] = DatabaseHandler.GetParameter<int>( FatherID, "@fatherNodeId", DbType.Int32 ); - parameterArray[2] = DatabaseHandler.GetParameter<string>( Title, "@title", DbType.String ); - parameterArray[3] = DatabaseHandler.GetParameter<string>( Filename, "@filename", DbType.String ); - parameterArray[4] = DatabaseHandler.GetParameter<string>( Arguments, "@arguments", DbType.String); - parameterArray[5] = DatabaseHandler.GetParameter<string>( ProgramUtils.WindowStyleToStr( WindowStyle ), "@windowStyle", DbType.String ); - parameterArray[6] = DatabaseHandler.GetParameter<string>( StartupDir, "@startupDir", DbType.String); - parameterArray[7] = DatabaseHandler.GetParameter<bool>( UseShellExecute, "@useShellExecute", DbType.Boolean ); - parameterArray[8] = DatabaseHandler.GetParameter<bool>( UseQuotes, "@useQuotes", DbType.Boolean); - parameterArray[9] = DatabaseHandler.GetParameter<string>( ProgramUtils.ApplicationTypeToString( SourceType ), "@applicationItemType", DbType.String); - parameterArray[10] = DatabaseHandler.GetParameter<string>( Source, "@source", DbType.String ); - parameterArray[11] = DatabaseHandler.GetParameter<string>( imageFile, "@imageFile", DbType.String ); - parameterArray[12] = DatabaseHandler.GetParameter<string>( FileDirectory, "@fileDirectory", DbType.String ); - parameterArray[13] = DatabaseHandler.GetParameter<string>( ImageDirectory, "@imageDirectory", DbType.String ); - parameterArray[14] = DatabaseHandler.GetParameter<string>( ValidExtensions, "@validExtensions", DbType.String); - parameterArray[15] = DatabaseHandler.GetParameter<bool>( ImportValidImagesOnly, "@importValidImagesOnly", DbType.Boolean ); - parameterArray[16] = DatabaseHandler.GetParameter<int>( Position, "@position", DbType.Int32); - parameterArray[17] = DatabaseHandler.GetParameter<bool>( Enabled, "@enabled", DbType.Boolean); - parameterArray[18] = DatabaseHandler.GetParameter<bool>( RefreshGUIAllowed, "@refreshGUIAllowed", DbType.Boolean ); - parameterArray[19] = DatabaseHandler.GetParameter<int>( PlatformId, "@platformId", DbType.Int32 ); - parameterArray[20] = DatabaseHandler.GetParameter<bool>( WaitForExit, "@waitForExit", DbType.Boolean ); - parameterArray[21] = DatabaseHandler.GetParameter<string>( PreLaunch, "@preLaunch", DbType.String ); - parameterArray[22] = DatabaseHandler.GetParameter<string>( PostLaunch, "@postLaunch", DbType.String ); + parameterArray[0] = dbHandlerInstance.GetParameter<int>( ApplicationItemId, "@applicationItemId", DbType.Int32 ); + parameterArray[1] = dbHandlerInstance.GetParameter<int>( FatherID, "@fatherNodeId", DbType.Int32 ); + parameterArray[2] = dbHandlerInstance.GetParameter<string>( Title, "@title", DbType.String ); + parameterArray[3] = dbHandlerInstance.GetParameter<string>( Filename, "@filename", DbType.String ); + parameterArray[4] = dbHandlerInstance.GetParameter<string>( Arguments, "@arguments", DbType.String); + parameterArray[5] = dbHandlerInstance.GetParameter<string>( ProgramUtils.WindowStyleToStr( WindowStyle ), "@windowStyle", DbType.String ); + parameterArray[6] = dbHandlerInstance.GetParameter<string>( StartupDir, "@startupDir", DbType.String); + parameterArray[7] = dbHandlerInstance.GetParameter<bool>( UseShellExecute, "@useShellExecute", DbType.Boolean ); + parameterArray[8] = dbHandlerInstance.GetParameter<bool>( UseQuotes, "@useQuotes", DbType.Boolean); + parameterArray[9] = dbHandlerInstance.GetParameter<string>( ProgramUtils.ApplicationTypeToString( SourceType ), "@applicationItemType", DbType.String); + parameterArray[10] = dbHandlerInstance.GetParameter<string>( Source, "@source", DbType.String ); + parameterArray[11] = dbHandlerInstance.GetParameter<string>( imageFile, "@imageFile", DbType.String ); + parameterArray[12] = dbHandlerInstance.GetParameter<string>( FileDirectory, "@fileDirectory", DbType.String ); + parameterArray[13] = dbHandlerInstance.GetParameter<string>( ImageDirectory, "@imageDirectory", DbType.String ); + parameterArray[14] = dbHandlerInstance.GetParameter<string>( ValidExtensions, "@validExtensions", DbType.String); + parameterArray[15] = dbHandlerInstance.GetParameter<bool>( ImportValidImagesOnly, "@importValidImagesOnly", DbType.Boolean ); + parameterArray[16] = dbHandlerInstance.GetParameter<int>( Position, "@position", DbType.Int32); + parameterArray[17] = dbHandlerInstance.GetParameter<bool>( Enabled, "@enabled", DbType.Boolean); + parameterArray[18] = dbHandlerInstance.GetParameter<bool>( RefreshGUIAllowed, "@refreshGUIAllowed", DbType.Boolean ); + parameterArray[19] = dbHandlerInstance.GetParameter<int>( PlatformId, "@platformId", DbType.Int32 ); + parameterArray[20] = dbHandlerInstance.GetParameter<bool>( WaitForExit, "@waitForExit", DbType.Boolean ); + parameterArray[21] = dbHandlerInstance.GetParameter<string>( PreLaunch, "@preLaunch", DbType.String ); + parameterArray[22] = dbHandlerInstance.GetParameter<string>( PostLaunch, "@postLaunch", DbType.String ); try { @@ -936,7 +936,7 @@ if ( ApplicationItemId == -1 ) return; SQLiteParameter[] paramArray = new SQLiteParameter[1]; - paramArray[0] = DatabaseHandler.GetParameter<int>( ApplicationItemId, "@applicationItemId", DbType.Int32 ); + paramArray[0] = dbHandlerInstance.GetParameter<int>( ApplicationItemId, "@applicationItemId", DbType.Int32 ); try { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -32,23 +32,24 @@ namespace GUIPrograms.Items { /// <summary> - /// Factory object that creates the matchin Application descendant class + /// Factory like object that creates the matchin Application descendant class /// depending on the sourceType parameter /// Descendant classes differ in LOADING and REFRESHING filelists /// </summary> - public class ApplicationItemFactory + public class ItemFactory { - static public ApplicationItemFactory AppFactory = new ApplicationItemFactory(); - - // singleton. Dont allow any instance of this class - private ApplicationItemFactory() { } + static private ItemFactory itemFactoryInstance = new ItemFactory(); - static ApplicationItemFactory() + public static ItemFactory ItemFactoryInstance { - // nothing to create...... + get { return ItemFactory.itemFactoryInstance; } } + + // singleton. Dont allow any instance of this class + private ItemFactory() { } + static ItemFactory() { } - public BaseItem GetApplicationItem(ItemType sourceType,SQLiteDataReader dataReader) + public BaseItem GetItem(ItemType sourceType,SQLiteDataReader dataReader) { BaseItem item = null; switch (sourceType) @@ -81,7 +82,7 @@ private ApplicationItem AppItemFactory(SQLiteDataReader dataReader,ItemType sourceType) { - ApplicationItem item = null;//= (ApplicationItem)appFactory.GetApplicationItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"), null, 0); + ApplicationItem item = null;//= (ApplicationItem)appFactory.GetItem(sqlDB, ProgramUtils.GetSourceType(results, recordIndex, "applicationItemType"), null, 0); switch (sourceType) { @@ -130,8 +131,6 @@ return item; } - - private FileItem FileItemFactory(SQLiteDataReader dataReader) { FileItem newFile = new FileItem(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -137,12 +137,12 @@ { if ( ViewHandler.IsFilterQuery ) { - FilterItem curFile = ( FilterItem ) ApplicationItemFactory.AppFactory.GetApplicationItem( ItemType.FILTERITEM, dataReader ); + FilterItem curFile = ( FilterItem ) itemFactoryInstance.GetItem( ItemType.FILTERITEM, dataReader ); ItemList.Add( curFile ); } else { - FileItem curFile = ( FileItem ) ApplicationItemFactory.AppFactory.GetApplicationItem( ItemType.FILEITEM, dataReader ); + FileItem curFile = ( FileItem ) itemFactoryInstance.GetItem( ItemType.FILEITEM, dataReader ); ItemList.Add( curFile ); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -23,6 +23,7 @@ { protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + protected ItemFactory itemFactoryInstance = ItemFactory.ItemFactoryInstance; public ProgramViewHandler ViewHandler = ProgramViewHandler.Instance; public string filePath = ""; //s protected FilelinkItemList fileLinks = null; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -460,22 +460,22 @@ SQLiteParameter[] parameterArray = new SQLiteParameter[15]; // parameterArray[0] = GetParameter<int>( ApplicationItemId, "@fileid", DbType.Int32, "applicationId" ); - parameterArray[0] = DatabaseHandler.GetParameter<int>( AppID, "@applicationId", DbType.Int32 ); - parameterArray[1] = DatabaseHandler.GetParameter<string>( Title, "@title", DbType.String ); - parameterArray[2] = DatabaseHandler.GetParameter<string>( Filename, "@filename", DbType.String ); - parameterArray[3] = DatabaseHandler.GetParameter<string>( Imagefile, "@imagefile", DbType.String ); - parameterArray[4] = DatabaseHandler.GetParameter<int>( GenreId, "@genreId", DbType.Int32 ); - parameterArray[5] = DatabaseHandler.GetParameter<int>( GenreStyleId, "@genreStyleId", DbType.Int32 ); - parameterArray[6] = DatabaseHandler.GetParameter<string>( Country, "@country", DbType.String ); - parameterArray[7] = DatabaseHandler.GetParameter<int>( ManufacturerId, "@manufacturerId", DbType.Int32 ); - parameterArray[8] = DatabaseHandler.GetParameter<int>( Year, "@year", DbType.Int32 ); - parameterArray[9] = DatabaseHandler.GetParameter<int>( Rating, "@rating", DbType.Int32 ); - parameterArray[10] = DatabaseHandler.GetParameter<string>( Overview, "@overview", DbType.String ); - parameterArray[11] = DatabaseHandler.GetParameter<int>( PlatformId, "@platformId", DbType.Int32 ); - parameterArray[12] = DatabaseHandler.GetParameter<DateTime>( LastTimeLaunched, "@lastTimeLaunched", DbType.DateTime ); - parameterArray[13] = DatabaseHandler.GetParameter<int>( LaunchCount, "@launchcount", DbType.Int32 ); - parameterArray[14] = DatabaseHandler.GetParameter<string>( GameInfoURL, "@gameInfoUrl", DbType.String ); - // parameterArray[16] = DatabaseHandler.GetParameter<bool>( IsFolder, "@isFolder", DbType.Boolean ); + parameterArray[0] = dbHandlerInstance.GetParameter<int>( AppID, "@applicationId", DbType.Int32 ); + parameterArray[1] = dbHandlerInstance.GetParameter<string>( Title, "@title", DbType.String ); + parameterArray[2] = dbHandlerInstance.GetParameter<string>( Filename, "@filename", DbType.String ); + parameterArray[3] = dbHandlerInstance.GetParameter<string>( Imagefile, "@imagefile", DbType.String ); + parameterArray[4] = dbHandlerInstance.GetParameter<int>( GenreId, "@genreId", DbType.Int32 ); + parameterArray[5] = dbHandlerInstance.GetParameter<int>( GenreStyleId, "@genreStyleId", DbType.Int32 ); + parameterArray[6] = dbHandlerInstance.GetParameter<string>( Country, "@country", DbType.String ); + parameterArray[7] = dbHandlerInstance.GetParameter<int>( ManufacturerId, "@manufacturerId", DbType.Int32 ); + parameterArray[8] = dbHandlerInstance.GetParameter<int>( Year, "@year", DbType.Int32 ); + parameterArray[9] = dbHandlerInstance.GetParameter<int>( Rating, "@rating", DbType.Int32 ); + parameterArray[10] = dbHandlerInstance.GetParameter<string>( Overview, "@overview", DbType.String ); + parameterArray[11] = dbHandlerInstance.GetParameter<int>( PlatformId, "@platformId", DbType.Int32 ); + parameterArray[12] = dbHandlerInstance.GetParameter<DateTime>( LastTimeLaunched, "@lastTimeLaunched", DbType.DateTime ); + parameterArray[13] = dbHandlerInstance.GetParameter<int>( LaunchCount, "@launchcount", DbType.Int32 ); + parameterArray[14] = dbHandlerInstance.GetParameter<string>( GameInfoURL, "@gameInfoUrl", DbType.String ); + // parameterArray[16] = dbHandlerInstance.GetParameter<bool>( IsFolder, "@isFolder", DbType.Boolean ); try { @@ -539,23 +539,23 @@ { SQLiteParameter[] parameterArray = new SQLiteParameter[16]; - parameterArray[0] = DatabaseHandler.GetParameter<int>( FileID, "@fileid", DbType.Int32); - parameterArray[1] = DatabaseHandler.GetParameter<int>( AppID, "@applicationId", DbType.Int32 ); - parameterArray[2] = DatabaseHandler.GetParameter<string>( Title, "@title", DbType.String ); - parameterArray[3] = DatabaseHandler.GetParameter<string>( Filename, "@filename", DbType.String ); - parameterArray[4] = DatabaseHandler.GetParameter<string>( Imagefile, "@imagefile", DbType.String ); - parameterArray[5] = DatabaseHandler.GetParameter<int>( GenreId, "@genreId", DbType.Int32 ); - parameterArray[6] = DatabaseHandler.GetParameter<int>( GenreStyleId, "@genreStyleId", DbType.Int32 ); - parameterArray[7] = DatabaseHandler.GetParameter<string>( Country, "@country", DbType.String ); - parameterArray[8] = DatabaseHandler.GetParameter<int>( ManufacturerId, "@manufacturerId", DbType.Int32); - parameterArray[9] = DatabaseHandler.GetParameter<int>( Year, "@year", DbType.Int32 ); - parameterArray[10] = DatabaseHandler.GetParameter<int>( Rating, "@rating", DbType.Int32 ); - parameterArray[11] = DatabaseHandler.GetParameter<string>( Overview, "@overview", DbType.String ); - parameterArray[12] = DatabaseHandler.GetParameter<int>( PlatformId, "@platformId", DbType.Int32 ); - parameterArray[13] = DatabaseHandler.GetParameter<DateTime>( LastTimeLaunched, "@lastTimeLaunched", DbType.DateTime ); - parameterArray[14] = DatabaseHandler.GetParameter<int>( LaunchCount, "@launchcount", DbType.Int32 ); - parameterArray[15] = DatabaseHandler.GetParameter<string>( GameInfoURL, "@gameInfoUrl", DbType.String ); - // parameterArray[17] = DatabaseHandler.GetParameter<bool>( IsFolder, "@isFolder", DbType.Boolean ); + parameterArray[0] = dbHandlerInstance.GetParameter<int>( FileID, "@fileid", DbType.Int32); + parameterArray[1] = dbHandlerInstance.GetParameter<int>( AppID, "@applicationId", DbType.Int32 ); + parameterArray[2] = dbHandlerInstance.GetParameter<string>( Title, "@title", DbType.String ); + parameterArray[3] = dbHandlerInstance.GetParameter<string>( Filename, "@filename", DbType.String ); + parameterArray[4] = dbHandlerInstance.GetParameter<string>( Imagefile, "@imagefile", DbType.String ); + parameterArray[5] = dbHandlerInstance.GetParameter<int>( GenreId, "@genreId", DbType.Int32 ); + parameterArray[6] = dbHandlerInstance.GetParameter<int>( GenreStyleId, "@genreStyleId", DbType.Int32 ); + parameterArray[7] = dbHandlerInstance.GetParameter<string>( Country, "@country", DbType.String ); + parameterArray[8] = dbHandlerInstance.GetParameter<int>( ManufacturerId, "@manufacturerId", DbType.Int32); + parameterArray[9] = dbHandlerInstance.GetParameter<int>( Year, "@year", DbType.Int32 ); + parameterArray[10] = dbHandlerInstance.GetParameter<int>( Rating, "@rating", DbType.Int32 ); + parameterArray[11] = dbHandlerInstance.GetParameter<string>( Overview, "@overview", DbType.String ); + parameterArray[12] = dbHandlerInstance.GetParameter<int>( PlatformId, "@platformId", DbType.Int32 ); + parameterArray[13] = dbHandlerInstance.GetParameter<DateTime>( LastTimeLaunched, "@lastTimeLaunched", DbType.DateTime ); + parameterArray[14] = dbHandlerInstance.GetParameter<int>( LaunchCount, "@launchcount", DbType.Int32 ); + parameterArray[15] = dbHandlerInstance.GetParameter<string>( GameInfoURL, "@gameInfoUrl", DbType.String ); + // parameterArray[17] = dbHandlerInstance.GetParameter<bool>( IsFolder, "@isFolder", DbType.Boolean ); string sqlStmt = @" UPDATE @@ -591,9 +591,9 @@ LaunchCount = LaunchCount + 1; SQLiteParameter[] parameterArray = new SQLiteParameter[3]; - parameterArray[0] = DatabaseHandler.GetParameter<DateTime>(LastTimeLaunched, "@lastTimeLaunched", DbType.DateTime); - parameterArray[1] = DatabaseHandler.GetParameter<int>(LaunchCount, "@launchCount", DbType.Int32); - parameterArray[2] = DatabaseHandler.GetParameter<int>(FileID, "@fileId", DbType.Int32); + parameterArray[0] = dbHandlerInstance.GetParameter<DateTime>(LastTimeLaunched, "@lastTimeLaunched", DbType.DateTime); + parameterArray[1] = dbHandlerInstance.GetParameter<int>(LaunchCount, "@launchCount", DbType.Int32); + parameterArray[2] = dbHandlerInstance.GetParameter<int>(FileID, "@fileId", DbType.Int32); try { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-08-14 06:47:43 UTC (rev 835) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-08-14 09:28:48 UTC (rev 836) @@ -99,10 +99,10 @@ private void Insert() { SQLiteParameter[] parameterArray = new SQLiteParameter[3]; - parameterArray[0] = DatabaseHandler.GetParameter<int>(TargetAppID,"@targetApplicationItemId",DbType.Int32); - parameterArray[1] = DatabaseHandler.GetParameter<int>(AppID,"@applicationItemId",DbType.Int32); - parameterArray[2] = DatabaseHandler.GetParameter<int>(FileID,"@fileId",DbType.Int32); - parameterArray[3] = DatabaseHandler.GetParameter<string>(Filename,"@filename",DbType.String); + parameterArray[0] = dbHandlerInstance.GetParameter<int>(TargetAppID,"@targetApplicationItemId",DbType.Int32); + parameterArray[1] = dbHandlerInstance.GetParameter<int>(AppID,"@applicationItemId",DbType.Int32); + parameterArray[2] = dbHandlerInstance.GetParameter<int>(FileID,"@fileId",DbType.Int32); + parameterArray[3] = dbHandlerInstance.GetParameter<string>(Filename,"@filename",DbType.String); try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-08-16 10:37:22
|
Revision: 842 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=842&view=rev Author: northern_sky Date: 2007-08-16 03:36:15 -0700 (Thu, 16 Aug 2007) Log Message: ----------- more cleanups, fixed gamebaseimport,baseitem rem, abstact appitem instead Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilterItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/BaseItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -49,6 +49,9 @@ { #region Variables + private ProgramViewHandler ViewHandler = ProgramViewHandler.Instance; + private ItemFactory itemFactoryInstance = ItemFactory.ItemFactoryInstance; + private SQLiteConnection sqlLiteConnection = null; private List<ApplicationItem> globalApplicationItemList = new List<ApplicationItem>(); private readonly string DATABASEFILE = "myProgramsAltDatabaseV1.db3"; @@ -66,8 +69,8 @@ { string DatabasePath = Config.GetFile(Config.Dir.Database, DATABASEFILE); string connString = string.Empty; - - try + + try { //check if database exists if (!File.Exists(DatabasePath)) @@ -263,7 +266,6 @@ public ItemType GetItemType(string columnName, string tableName, int id) { - ItemType itemType = ItemType.UNKNOWN; string sqlStmt = "SELECT " + columnName + " FROM " + tableName + " WHERE applicationId = " + id; return ProgramUtils.StringToSourceType(ExecuteStmtScalar(sqlStmt).ToString()); @@ -378,6 +380,51 @@ #endregion dataaccess help methods + + public List<object> LoadItemList(int appID,List<object> itemList, string overrideSQL) + { + try + { + itemList.Clear(); + string sqlQuery = ""; + + if (overrideSQL == "") + { + sqlQuery = ViewHandler.BuildQuery(appID); + } + else + { + sqlQuery = overrideSQL; + } + + using (SQLiteCommand command = SqlLiteConn.CreateCommand()) + { + command.CommandText = sqlQuery; + using (SQLiteDataReader dataReader = command.ExecuteReader()) + { + while (dataReader.Read()) + { + if (ViewHandler.IsFilterQuery) + { + FilterItem curFile = (FilterItem)itemFactoryInstance.GetItem(ItemType.FILTERITEM, dataReader); + itemList.Add(curFile); + } + else + { + FileItem curFile = (FileItem)itemFactoryInstance.GetItem(ItemType.FILEITEM, dataReader); + itemList.Add(curFile); + } + } + } + } + } + catch (SQLiteException ex) + { + Log.Info("Filedatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + return itemList; + } + public void LoadAllApplicationItems() { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -111,7 +111,7 @@ fileListView.Items.Clear(); - foreach (BaseItem item in currentApplication.ItemList) + foreach (object item in currentApplication.ItemList) { // add all filelinks, // or add all files @@ -254,16 +254,11 @@ if (dialogResult == DialogResult.OK) { file.Write(); - currentApplication.ItemLoad(currentApplication.ApplicationItemId, ""); + currentApplication.LoadFiles(); SyncListView(); } } - private void ChangeFilePath(string NewPath) - { - currentApplication.ItemLoad(currentApplication.ApplicationItemId, NewPath); - SyncListView(); - } private void EditItem() { @@ -279,7 +274,7 @@ if (dialogResult == DialogResult.OK) { file.Write(); - currentApplication.ItemLoad(currentApplication.ApplicationItemId, ""); + currentApplication.LoadFiles(); SyncListView(); } } @@ -330,7 +325,7 @@ } } } - currentApplication.ItemLoad(currentApplication.ApplicationItemId, ""); + currentApplication.LoadFiles(); SyncListView(); } @@ -564,7 +559,7 @@ // Log.Info("Add to Favourites groupAppID:{0} Title:{1} fileID:{2} appID:{3}", GrouperAppID, currentFileItem.Title, currentFileItem.FileID, currentFileItem.applicationId); } - foreach (BaseItem app in apps) + foreach (object app in apps) { if (app is ApplicationItemGrouper) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -36,6 +36,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "SettingsBase"; this.Size = new System.Drawing.Size(497, 550); + this.Load += new System.EventHandler(this.SettingsBase_Load); this.ResumeLayout(false); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -44,7 +44,7 @@ public partial class SettingsBase : UserControl { protected ConditionChecker conditionChecker = new ConditionChecker(); - protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + protected DatabaseHandler dbHandlerInstance; public SettingsBase() @@ -68,5 +68,14 @@ //Log.Debug("{0}: EntriesOK()", this.ToString()); return true; } + + private void SettingsBase_Load(object sender, EventArgs e) + { + //temp fix for vs designer support + //vs design can be errorunos if using static help methods in contructor etc . databasehandler does + if(!DesignMode) { + dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + } + } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -20,36 +20,7 @@ #endregion -//#region Enums -//#endregion -//#region Delegates -//#endregion - -//#region Events -//#endregion - - - - - -#region Properties -// Public Properties -#endregion - -#region Public Methods -#endregion - -#region Private Methods -#endregion - -#region <Base class> Overloads -#endregion - -#region <Interface> Implementations -// region for each interface -#endregion - namespace GUIPrograms.Design { public partial class SetupForm : Form @@ -57,6 +28,7 @@ #region Variables + private DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; private List<ApplicationItem> globalApplicationList;// = DatabaseHandler.DBHandlerInstance.ApplicationItemList; private AppSettingsDirCache appSettingsDirCache = new AppSettingsDirCache(); @@ -633,7 +605,7 @@ { AppSettingsBase appSettingsPage = pageCurrentSettings as AppSettingsBase; // create a pseudo-appitem and read the values from the xml node - ApplicationItem tempApp = new ApplicationItem(); + ApplicationItemDirectoryCache tempApp = new ApplicationItemDirectoryCache(); tempApp.LoadFromXmlProfile(node); appSettingsPage.LoadFromAppItem(tempApp); appSettingsFileEditView.FileExtensionsText = tempApp.ValidExtensions; @@ -723,6 +695,9 @@ private void SetupForm_Load(object sender, EventArgs e) { + + + AttachFilesView(); AttachProgramsView(); UpdateTree(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -305,7 +305,7 @@ } xmlwriter.SetValue("myprograms", "startWindow", StartWindow.ToString()); - xmlwriter.SetValue("myprograms", "startview", (int) mapSettings.ViewLayout); + xmlwriter.SetValue("myprograms", "startview", (int)mapSettings.ViewLayout); } } @@ -452,7 +452,7 @@ prevFilepath = lastApp.DefaultFilepath(); this.CurrentSortAsc = mapSettings.SortAscending; ViewHandler.CurrentLevel = mapSettings.LastViewLevel; - lastApp.ViewHandler = this.ViewHandler; + //lastApp.ViewHandler = this.ViewHandler; } else { @@ -797,7 +797,7 @@ switch (CurrentSortMethod) { - case ProgramSort.SortMethod.Title: + case ProgramSort.SortMethod.Title: sortBy = GUILocalizeStrings.Get(268); break; case ProgramSort.SortMethod.Filename: @@ -925,8 +925,8 @@ lastApp.LoadFiles(); lastApp.CurrentView = ViewHandler.CurrentView; } - - int totalFiles = lastApp.DisplayFiles(lastApp.FileDirectory, facadeView); + int totalFiles = 0; + totalFiles = totalFiles + DisplayItemList(lastApp.filePath, lastApp.ItemList, facadeView); return (totalFiles); } @@ -1216,6 +1216,19 @@ } } + /* protected void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIPrograms.ThumbnailPath = ""; + if (item.ThumbnailImage != "" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" + ) + { + // only show big thumb if there is really one.... + GUIPrograms.ThumbnailPath = item.ThumbnailImage; + } + }*/ + void OnItemSelected(GUIListItem item, GUIControl parent) { ThumbnailPath = ""; @@ -1236,15 +1249,52 @@ void OnClick() { - GUIListItem item = GetSelectedItem(); + GUIListItem selectedGUIListItem = GetSelectedItem(); - if (item.MusicTag != null) + if (selectedGUIListItem.MusicTag != null) { - ((BaseItem)item.MusicTag).OnClick((BaseItem)item.MusicTag, this); + object item = selectedGUIListItem.MusicTag; + + if (item is ApplicationItem) + { + + lastApp = (ApplicationItem)item; + SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, lastApp.lastFilepath); + mapSettings.LastAppID = lastApp.ApplicationItemId; + prevFilepath = lastApp.DefaultFilepath(); + ViewHandler.CurrentLevel = 0; + //lastApp.ViewHandler = ViewHandler; + } + else if (item is FileItem) + { + FileItem fileItem = (FileItem)item; + selectedItemIndex = GetSelectedItemNo(); + + if (lastApp != null) + { + mapSettings.LastAppID = lastApp.ApplicationItemId; + prevFilepath = lastApp.DefaultFilepath(); + lastApp.LaunchFile(fileItem); + } + } + else if (item is FilterItem) + { + FilterItem filterItem = (FilterItem)item; + + SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, prevFilepath); + ViewHandler.AddFilterItem(filterItem); + if (lastApp != null) + { + // force reload, this will load the next filter-level..... + lastApp.LoadFiles(); + } + } + + UpdateButtonStates(); UpdateListControl(); } - else if (item.Label.Equals(ProgramUtils.cBackLabel)) + else if (selectedGUIListItem.Label.Equals(ProgramUtils.cBackLabel)) { // folder-item clicked.... selectedItemIndex = -1; BackItemClicked(); @@ -1252,6 +1302,69 @@ } } + #region moved from BaseItem + + public int DisplayItemList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) + { + int totalItems = 0; + + foreach (object baseItem in dbItems) + { + totalItems = totalItems + 1; + + if (baseItem is FileItem) + { + FileItem curFile = baseItem as FileItem; + GUIListItem gli = new GUIListItem(curFile.Title); + + gli.MusicTag = curFile; + // gli.IsFolder = curFile.IsFolder; + gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); + } + if (baseItem is FilterItem) + { + FilterItem curFile = baseItem as FilterItem; + GUIListItem gli = new GUIListItem(curFile.Title); + gli.MusicTag = curFile; + //gli.IsFolder = false; + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); + } + } + return totalItems; + } + + protected void OnRetrieveCoverArt(GUIListItem guiListItem) + { + if (guiListItem.MusicTag == null) return; + FileItem curFileItem = (FileItem)guiListItem.MusicTag; + if (curFileItem == null) return; + + string imgFile = String.Empty; + + if (ProgramUtils.UseThumbsDir()) + imgFile = ProgramUtils.GetFileImage(lastApp, curFileItem); + else + imgFile = curFileItem.Imagefile; + + if (File.Exists(imgFile)) + { + guiListItem.ThumbnailImage = imgFile; + guiListItem.IconImageBig = imgFile; + guiListItem.IconImage = imgFile; + } + else + { + guiListItem.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + guiListItem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + guiListItem.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; + } + } + + #endregion + protected void OnShowSort() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); @@ -1288,15 +1401,15 @@ default: CurrentSortMethod = ProgramSort.SortMethod.Title; break; - } + } //ToDo //tmp fix until all mappings in place. - switch (dlg.SelectedLabelText) + switch (dlg.SelectedLabelText) { case "Sort by: Times launched": CurrentSortMethod = ProgramSort.SortMethod.LaunchCount; break; - case "Sort by: Date launched": + case "Sort by: Date launched": CurrentSortMethod = ProgramSort.SortMethod.LastTimeLaunched; break; case "Sort by: Platform": @@ -1304,9 +1417,9 @@ break; default: break; - } - + } + OnSort(); GUIControl.FocusControl(GetID, btnSortBy.GetID); } @@ -1330,7 +1443,7 @@ if (item.Label.Equals(ProgramUtils.cBackLabel)) return; if (item.MusicTag == null) return; if (item.MusicTag is ApplicationItem) return; - + if (item.MusicTag is FileItem) { curFile = (FileItem)item.MusicTag; @@ -1378,7 +1491,7 @@ { int nNewWindow = (int)Window.WINDOW_FILES; StartWindow = nNewWindow; - mapSettings.ViewLayout = (int) Layout.List; + mapSettings.ViewLayout = (int)Layout.List; ViewHandler.CurrentView = GUILocalizeStrings.Get(100000 + GetID);//my files if (nNewWindow != GetID) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-16 10:36:15 UTC (rev 842) @@ -145,7 +145,6 @@ <Compile Include="Items\ApplicationItemGameBase.cs" /> <Compile Include="Items\ApplicationItemGrouper.cs" /> <Compile Include="Items\ApplicationItemMame.cs" /> - <Compile Include="Items\BaseItem.cs" /> <Compile Include="Items\FileItem.cs" /> <Compile Include="Items\FileItemInfo.cs" /> <Compile Include="Items\FilelinkItem.cs" /> Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -32,6 +32,7 @@ using GUIPrograms.Items; using GUIPrograms; using GUIPrograms.Database; +using System.Data.SQLite; namespace GUIPrograms.Imports @@ -60,6 +61,7 @@ void DBImportGamebaseItem(OleDbDataReader myReader, string romFilename, string imgFilename, int curPos, int maxGames) { + FileItem curFile = new FileItem(); curFile.FileID = -1; // to force an INSERT statement when writing the item curFile.AppID = applicationItem.ApplicationItemId; @@ -142,64 +144,69 @@ { using (OleDbConnection myCon = new OleDbConnection(strCon)) { - using (OleDbTransaction transaction = myCon.BeginTransaction()) - { + using (OleDbCommand myCmd = new OleDbCommand(sqlStr, myCon)) { + using (SQLiteTransaction transaction = DatabaseHandler.DBHandlerInstance.SqlLiteConn.BeginTransaction()) + + { myCon.Open(); int maxGames = CountGames(myCon, sqlStrCount); - using (OleDbDataReader myReader = myCmd.ExecuteReader()) - { + + + using (OleDbDataReader myReader = myCmd.ExecuteReader()) + { - int i = 0; - while (myReader.Read()) - { - i++; - curRomname = myReader["Filename"].ToString(); - curFullRomname = applicationItem.FileDirectory + "\\" + curRomname; + int i = 0; + while (myReader.Read()) + { + i++; + curRomname = myReader["Filename"].ToString(); + curFullRomname = applicationItem.FileDirectory + "\\" + curRomname; - if (applicationItem.ImageDirectory != "") - { - curTitleImage = applicationItem.imageDirs[0] + "\\" + myReader["ScrnshotFilename"].ToString(); - } - else - { - curTitleImage = ""; - } + if (applicationItem.ImageDirectory != "") + { + curTitleImage = applicationItem.imageDirs[0] + "\\" + myReader["ScrnshotFilename"].ToString(); + } + else + { + curTitleImage = ""; + } - if (File.Exists(curFullRomname)) - { - // rom-name from gamebase exists in users filedirectory - // => ready to import item - bDoImport = true; + if (File.Exists(curFullRomname)) + { + // rom-name from gamebase exists in users filedirectory + // => ready to import item + bDoImport = true; - if (applicationItem.ImportValidImagesOnly) - { - // skip item if no thumbnail image is found - bDoImport = ((curTitleImage != null) && (curTitleImage != "") && (File.Exists(curTitleImage))); - } + if (applicationItem.ImportValidImagesOnly) + { + // skip item if no thumbnail image is found + bDoImport = ((curTitleImage != null) && (curTitleImage != "") && (File.Exists(curTitleImage))); + } + + if (bDoImport) + { + DBImportGamebaseItem(myReader, curFullRomname, curTitleImage, i, maxGames); - if (bDoImport) - { - DBImportGamebaseItem(myReader, curFullRomname, curTitleImage, i, maxGames); + } + else + { + Log.Info("*skipped* gamebase game {0} image{1}", curRomname, curTitleImage); + } + } + else + { + Log.Info("*missing* gamebase game {0}", curRomname); + } } - else - { - Log.Info("*skipped* gamebase game {0} image{1}", curRomname, curTitleImage); - } - } - else - { - Log.Info("*missing* gamebase game {0}", curRomname); - } + transaction.Commit(); } - } - } - transaction.Commit(); + } } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-16 05:22:46 UTC (rev 841) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-16 10:36:15 UTC (rev 842) @@ -23,6 +23,8 @@ #endregion +#region Imports + using System; using System.Collections.Generic; using System.Diagnostics; @@ -41,761 +43,644 @@ using GUIPrograms.Database; using GUIPrograms.Items; +#endregion Imports namespace GUIPrograms.Items { - public class ApplicationItem : BaseItem - { - #region Variables + public abstract class ApplicationItem + { + #region Events/Delegates - int appID; - int fatherID; - string title; - string filename; + public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + public event FilelinkLaunchEventHandler OnLaunchFilelink = null; - string arguments; - ProcessWindowStyle windowStyle; - string startupDir; - bool useQuotes; - bool useShellExecute; - bool waitForExit; - string preLaunch; - string postLaunch; + // event: read new file + public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); + public event RefreshInfoEventHandler OnRefreshInfo = null; + #endregion Events/Delegates - private List<ImportOption> importOptionList; + #region Variables - public List<ImportOption> ImportOptionList - { - get { return importOptionList; } - set { importOptionList = value; } - } - bool enabled; - int appPosition; + protected int GetID = ProgramUtils.GetID; + protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - string currentView = ""; + int appID; + int fatherID; + string title; + string filename; - public List<BaseItem> ItemList = new List<BaseItem>(); - public bool filesAreLoaded = false; // load on demand.... - // protected FileItemList fileList = null; + string arguments; + ProcessWindowStyle windowStyle; + string startupDir; + bool useQuotes; + bool useShellExecute; + bool waitForExit; + string preLaunch; + string postLaunch; + private List<ImportOption> importOptionList; + bool enabled; + int appPosition; - public bool linksAreLoaded = false; // load on demand.... + string currentView = ""; - bool importMamePlaychoice10 = false; - bool importMameMahjong = false; - bool refreshGUIAllowed = false; + public List<object> ItemList = new List<object>(); + public bool filesAreLoaded = false; // load on demand.... + public bool linksAreLoaded = false; // load on demand.... + bool importMamePlaychoice10 = false; + bool importMameMahjong = false; + bool refreshGUIAllowed = false; + public string filePath = ""; - ItemType sourceType; - string sourceFile; - string imageFile; - string imageDirectories; // in one string for sqlite db field - public string[] imageDirs; // imageDirectories splitted - string fileDirectory; - string validExtensions; - bool importValidImagesOnly; + ItemType sourceType; + string sourceFile; + string imageFile; + string imageDirectories; // in one string for sqlite db field + public string[] imageDirs; // imageDirectories splitted + string fileDirectory; + string validExtensions; + bool importValidImagesOnly; + int platformId; + string launchErrorMsg; + // two magic image-slideshow counters + int thumbIndex = 0; + int thumbFolderIndex = -1; - int platformId; + public string lastFilepath = ""; // cached path - string launchErrorMsg; - // two magic image-slideshow counters - int thumbIndex = 0; - int thumbFolderIndex = -1; + #endregion - protected string lastFilepath = ""; // cached path + #region Properties - #endregion + public List<ImportOption> ImportOptionList + { + get { return importOptionList; } + set { importOptionList = value; } + } - #region Properties - // Helper Routines + public int ApplicationItemId + { + get { return appID; } + set { appID = value; } + } + public int FatherID + { + get { return fatherID; } + set { fatherID = value; } + } + public string Title + { + get { return title; } + set { title = value; } + } + public string Filename + { + get { return filename; } + set { filename = value; } + } + public string Imagefile + { + get { return imageFile; } + set { imageFile = value; } + } - public int ApplicationItemId - { - get { return appID; } - set { appID = value; } - } - public int FatherID - { - get { return fatherID; } - set { fatherID = value; } - } - public string Title - { - get { return title; } - set { title = value; } - } + public string Arguments + { + get { return arguments; } + set { arguments = value; } + } + public ProcessWindowStyle WindowStyle + { + get { return windowStyle; } + set { windowStyle = value; } + } + public string StartupDir + { + get { return startupDir; } + set { startupDir = value; } + } + public bool UseQuotes + { + get { return useQuotes; } + set { useQuotes = value; } + } + public bool UseShellExecute + { + get { return useShellExecute; } + set { useShellExecute = value; } + } + public bool WaitForExit + { + get { return waitForExit; } + set { waitForExit = value; } + } + public string PreLaunch + { + get { return preLaunch; } + set { preLaunch = value; } + } + public string PostLaunch + { + get { return postLaunch; } + set { postLaunch = value; } + } - public string Filename - { - get { return filename; } - set { filename = value; } - } - public string Imagefile - { - get { return imageFile; } - set { imageFile = value; } - } + public bool Enabled + { + get { return enabled; } + set { enabled = value; } + } - public string Arguments - { - get { return arguments; } - set { arguments = value; } - } - public ProcessWindowStyle WindowStyle - { - get { return windowStyle; } - set { windowStyle = value; } - } - public string StartupDir - { - get { return startupDir; } - set { startupDir = value; } - } - public bool UseQuotes - { - get { return useQuotes; } - set { useQuotes = value; } - } - public bool UseShellExecute - { - get { return useShellExecute; } - set { useShellExecute = value; } - } - public bool WaitForExit - { - get { return waitForExit; } - set { waitForExit = value; } - } - public string PreLaunch - { - get { return preLaunch; } - set { preLaunch = value; } - } - public string PostLaunch - { - get { return postLaunch; } - set { postLaunch = value; } - } + public bool RefreshGUIAllowed + { + get { return refreshGUIAllowed; } + set { refreshGUIAllowed = value; } + } - public bool Enabled - { - get { return enabled; } - set { enabled = value; } - } + public int Position + { + get { return appPosition; } + set { appPosition = value; } + } - public virtual bool RefreshGUIAllowed - { - get { return refreshGUIAllowed; } - set { refreshGUIAllowed = value; } - } + public string CurrentView + { + get { return currentView; } + set { currentView = value; } + } - public int Position - { - get { return appPosition; } - set { appPosition = value; } - } + public bool ImportMamePlaychoice10 + { + get { return importMamePlaychoice10; } + set { importMamePlaychoice10 = value; } + } + public bool ImportMameMahjong + { + get { return importMameMahjong; } + set { importMameMahjong = value; } + } - public string CurrentView - { - get { return currentView; } - set { currentView = value; } - } + // more Properties, maybe need some renaming or anything else + public string FileDirectory + { + get { return fileDirectory; } + set { fileDirectory = value; } + } + public string ImageDirectory + { + get { return imageDirectories; } + set { SetImageDirectory(value); } + } + private void SetImageDirectory(string value) + { + imageDirectories = value; + imageDirs = imageDirectories.Split(';'); + for (int i = 0; i < imageDirs.Length; i++) + { + imageDirs[i] = imageDirs[i].Trim(); + // hack the \n away.... + // imageDirs[i] = imageDirs[i].TrimStart('\n'); + // hack trailing backslashes away + imageDirs[i] = imageDirs[i].TrimEnd('\\'); + } + } + public string Source + { + get { return sourceFile; } + set { sourceFile = value; } + } + public ItemType SourceType + { + get { return sourceType; } + set { sourceType = value; } + } + public string ValidExtensions + { + get { return validExtensions; } + set { validExtensions = value; } + } + public bool ImportValidImagesOnly + { + get { return importValidImagesOnly; } + set { importValidImagesOnly = value; } + } - public bool ImportMamePlaychoice10 - { - get { return importMamePlaychoice10; } - set { importMamePlaychoice10 = value; } - } - public bool ImportMameMahjong - { - get { return importMameMahjong; } - set { importMameMahjong = value; } - } + public int PlatformId + { + get { return platformId; } + set { platformId = value; } + } + public string LaunchErrorMsg + { + get { return launchErrorMsg; } + set { launchErrorMsg = value; } + } - // more Properties, maybe need some renaming or anything else - public string FileDirectory - { - get { return fileDirectory; } - set { fileDirectory = value; } - } - public string ImageDirectory - { - get { return imageDirectories; } - set { SetImageDirectory( value ); } - } - private void SetImageDirectory(string value) - { - imageDirectories = value; - imageDirs = imageDirectories.Split( ';' ); - for ( int i = 0; i < imageDirs.Length; i++ ) - { - imageDirs[i] = imageDirs[i].Trim(); - // hack the \n away.... - // imageDirs[i] = imageDirs[i].TrimStart('\n'); - // hack trailing backslashes away - imageDirs[i] = imageDirs[i].TrimEnd( '\\' ); - } - } - public string Source - { - get { return sourceFile; } - set { sourceFile = value; } - } - public ItemType SourceType - { - get { return sourceType; } - set { sourceType = value; } - } - public string ValidExtensions - { - get { return validExtensions; } - set { validExtensions = value; } - } - public bool ImportValidImagesOnly - { - get { return importValidImagesOnly; } - set { importValidImagesOnly = value; } - } + #endregion - public int PlatformId - { - get { return platformId; } - set { platformId = value; } - } - public string LaunchErrorMsg - { - get { return launchErrorMsg; } - set { launchErrorMsg = value; } - } + #region Constructor - #endregion + public ApplicationItem() + { - #region Events - - 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; - - #endregion - - #region Constructor - - public ApplicationItem() - { - - // .. init member variables ... - appID = -1; - fatherID = -1; - title = ""; - filename = ""; - arguments = ""; - windowStyle = ProcessWindowStyle.Normal; - startupDir = "%FILEDIR%"; - useShellExecute = false; - useQuotes = true; - enabled = true; - sourceType = ItemType.UNKNOWN; - sourceFile = ""; - imageFile = ""; - fileDirectory = ""; - imageDirectories = ""; - validExtensions = ""; - appPosition = 0; - importValidImagesOnly = false; + // .. init member variables ... + appID = -1; + fatherID = -1; + title = ""; + filename = ""; + arguments = ""; + windowStyle = ProcessWindowStyle.Normal; + startupDir = "%FILEDIR%"; + useShellExecute = false; + useQuotes = true; + enabled = true; + sourceType = ItemType.UNKNOWN; + sourceFile = ""; + imageFile = ""; + fileDirectory = ""; + imageDirectories = ""; + validExtensions = ""; + appPosition = 0; + importValidImagesOnly = false; platformId = 0; - waitForExit = true; - filesAreLoaded = false; - preLaunch = ""; - postLaunch = ""; + waitForExit = true; + filesAreLoaded = false; + preLaunch = ""; + postLaunch = ""; - } + } - #endregion + #endregion Constructor - protected void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) - { - /*ApplicationItem targetApp = GetAppByID(curLink.TargetAppID); - if (targetApp != null) - { - targetApp.LaunchFile(curLink, MPGUIMode); - }*/ - } + #region protected methods + protected void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + /*ApplicationItem targetApp = GetAppByID(curLink.TargetAppID); + if (targetApp != null) + { + targetApp.LaunchFile(curLink, MPGUIMode); + }*/ + } - protected void SendRefreshInfo(string informationMessage, int progressBarCtr) - { - if ( OnRefreshInfo != null ) - { - OnRefreshInfo( informationMessage, progressBarCtr ); - } - } - protected int GetID = ProgramUtils.GetID; + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) + { + if (OnRefreshInfo != null) + { + OnRefreshInfo(informationMessage, progressBarCtr); + } + } - 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]; - } + protected void DoPreLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(preLaunch); + } + } - public FileItem NextFile(FileItem curFile) - { - if ( ItemList == null ) return null; - if ( ItemList.Count == 0 ) return null; + protected void DoPostLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(postLaunch); + } + } - int index = this.ItemList.IndexOf( curFile ); - index = index + 1; - if ( index > ItemList.Count - 1 ) - index = 0; - return ( FileItem ) ItemList[index]; - } + protected void LaunchCmd(string commands) + { + string results = ""; + string errors = ""; + string[] script; + string curLine; + Process p = new Process(); + StreamWriter sw; + StreamReader sr; + StreamReader err; - /// <summary> - /// look for FileItem and launch it using the found object - /// </summary> - /// <param name="guiListItem"></param> - public virtual void LaunchFile(BaseItem launchItem) - { - FileItem curFileItem = ( FileItem ) launchItem; - if ( curFileItem == null ) return; + script = commands.Split(';'); + if (script.Length > 0) + { + ProcessStartInfo psI = new ProcessStartInfo("cmd"); + psI.UseShellExecute = false; + psI.RedirectStandardInput = true; + psI.RedirectStandardOutput = true; + psI.RedirectStandardError = true; + psI.CreateNoWindow = true; + p.StartInfo = psI; - this.LaunchFile( curFileItem, true ); - } + p.Start(); + sw = p.StandardInput; + sr = p.StandardOutput; + err = p.StandardError; - public virtual void LaunchFile(FileItem fileItem, bool mpGuiMode) - { - string filename = fileItem.Filename; - if ( filename == "" ) return; + sw.AutoFlush = true; - // Launch File by item - if ( mpGuiMode ) - fileItem.UpdateLaunchInfo(); + for (int i = 0; i < script.Length; i++) + { + curLine = script[i].Trim(); + curLine = curLine.TrimStart('\n'); + if (curLine != "") + sw.WriteLine(curLine); + } + sw.Close(); - ProcessStartInfo procStart = new ProcessStartInfo(); + results += sr.ReadToEnd(); + errors += err.ReadToEnd(); - if ( this.Filename != "" ) - { // use the APPLICATION launcher and add current file information + if (errors.Trim() != "") + { + Log.Info("Application PrePost errors: {0}", errors); + } + } + } - // filename of the application - procStart.FileName = this.Filename; + #endregion protected methods - // double quotes around the filename-argument..... - if ( UseQuotes ) - filename = "\"" + fileItem.Filename + "\""; + #region Public Methods - // set the arguments: one of the arguments is the fileitem-filename - if ( this.Arguments.Contains( "%FILEnoPATHnoEXT%" ) ) - // ex. kawaks: - // winkawaks.exe alpham2 - // => filename without path and extension is necessary! - procStart.Arguments = " " + this.Arguments.Replace( "%FILEnoPATHnoEXT%", Path.GetFileNameWithoutExtension( fileItem.Filename ) ); - else if ( this.Arguments.Contains( "%FILE%" ) ) - // placeholder found => replace the placeholder by the correct filename - procStart.Arguments = " " + this.Arguments.Replace( "%FILE%", filename ); - else - // no placeholder found => default handling: add the fileitem as the last argument - procStart.Arguments = " " + this.Arguments + " " + filename; - // set WorkingDirectory - if ( this.StartupDir.Contains( "%FILEDIR%" ) ) - procStart.WorkingDirectory = this.StartupDir.Replace( "%FILEDIR%", Path.GetDirectoryName( fileItem.Filename ) ); - else - procStart.WorkingDirectory = this.StartupDir; - } - else - { - // application has no launch-file - // => try to make a correct launch using the current FILE object - if ( UseQuotes ) - { - procStart.FileName = "\"" + fileItem.Filename + "\""; - } - else - { - procStart.FileName = fileItem.Filename; - } + public virtual string CurrentFilePath() + { + return this.FileDirectory; + } - // set WorkingDirectory - if ( this.StartupDir == "" ) - procStart.WorkingDirectory = Path.GetDirectoryName( fileItem.Filename ); - else if ( this.StartupDir.Contains( "%FILEDIR%" ) ) - procStart.WorkingDirectory = this.StartupDir.Replace( "%FILEDIR%", Path.GetDirectoryName( fileItem.Filename ) ); - else - procStart.WorkingDirectory = this.StartupDir; - } + public void Assign(ApplicationItem sourceApp) + { + this.Enabled = sourceApp.Enabled; + this.ApplicationItemId = sourceApp.ApplicationItemId; + this.FatherID = sourceApp.FatherID; + this.Title = sourceApp.Title; + this.Filename = sourceApp.Filename; + this.Arguments = sourceApp.Arguments; + this.WindowStyle = sourceApp.WindowStyle; + this.StartupDir = sourceApp.StartupDir; + this.UseShellExecute = sourceApp.UseShellExecute; + this.UseQuotes = sourceApp.UseQuotes; + this.SourceType = sourceApp.SourceType; + this.Source = sourceApp.Source; + this.Imagefile = sourceApp.Imagefile; + this.FileDirectory = sourceApp.FileDirectory; + this.ImageDirectory = sourceApp.ImageDirectory; + this.ValidExtensions = sourceApp.ValidExtensions; + this.ImportValidImagesOnly = sourceApp.ImportValidImagesOnly; + this.Position = sourceApp.Position; + this.WaitForExit = sourceApp.WaitForExit; + this.PreLaunch = sourceApp.PreLaunch; + this.PostLaunch = sourceApp.PostLaunch; + this.PlatformId = sourceApp.PlatformId; - // set UseShellExecute - procStart.UseShellExecute = this.UseShellExecute; - // set WindowStyle - procStart.WindowStyle = this.WindowStyle; + } - this.LaunchErrorMsg = ""; - try - { - DoPreLaunch(); + public FileItem PrevFile(FileItem curFile) + { + if (ItemList == null) return null; + if (ItemList.Count == 0) return null; - if ( mpGuiMode ) - { - AutoPlay.StopListening(); - if ( g_Player.Playing ) - g_Player.Stop(); - } + int index = this.ItemList.IndexOf(curFile); + index = index - 1; + if (index < 0) + index = ItemList.Count - 1; + return (FileItem)ItemList[index]; + } - //proc = new Process(); - /*proc.EnableRaisingEvents = true; - proc.Exited += new EventHandler(proc_Exited); + public FileItem NextFile(FileItem curFile) + { + if (ItemList == null) return null; + if (ItemList.Count == 0) return null; - proc.StartInfo = procStart; - ProgramUtils.StartProcess(proc, this.WaitForExit); - */ - Utils.StartProcess( procStart, this.WaitForExit ); + int index = this.ItemList.IndexOf(curFile); + index = index + 1; + if (index > ItemList.Count - 1) + index = 0; + return (FileItem)ItemList[index]; + } - if ( mpGuiMode ) - { - GUIGraphicsContext.DX9Device.Reset( GUIGraphicsContext.DX9Device.PresentationParameters ); - AutoPlay.StartListening(); - } - } - catch ( Exception ex ) - { - string ErrorString = String.Format( "myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", - procStart.FileName, - procStart.Arguments, - procStart.WorkingDirectory, - ex.Message, - ex.Source, - ex.StackTrace ); - Log.Info( ErrorString ); - this.LaunchErrorMsg = ErrorString; - } - finally - { - DoPostLaunch(); - } - } + /// <summary> + /// look for FileItem and launch it using the found object + /// </summary> + /// <param name="guiListItem"></param> + public virtual void LaunchFile(FileItem launchItem) + { + FileItem curFileItem = launchItem; + if (curFileItem == null) return; + this.LaunchFile(curFileItem, true); + } - protected void DoPreLaunch() - { - if ( waitForExit && ( preLaunch != "" ) ) - { - LaunchCmd( preLaunch ); - } - } + public virtual void LaunchFile(FileItem fileItem, bool mpGuiMode) + { + string filename = fileItem.Filename; + if (filename == "") return; - protected void DoPostLaunch() - { - if ( waitForExit && ( preLaunch != "" ) ) - { - LaunchCmd( postLaunch ); - } - } + // Launch File by item + if (mpGuiMode) + fileItem.UpdateLaunchInfo(); - public override void ItemLoad(int appID, string pathSubfolders) - { + ProcessStartInfo procStart = new ProcessStartInfo(); - try - { - ItemList.Clear(); + if (this.Filename != "") + { // use the APPLICATION launcher and add current file information - filePath = pathSubfolders; - string sqlQuery = ViewHandler.BuildQuery( appID, pathSubfolders ); + // filename of the application + procStart.FileName = this.Filename; - using (SQLiteCommand command = dbHandlerInstance.SqlLiteConn.CreateCommand()) - { - command.CommandText = sqlQuery; - using ( SQLiteDataReader dataReader = command.ExecuteReader() ) - { - while ( dataReader.Read() ) - { - if ( ViewHandler.IsFilterQuery ) - { - FilterItem curFile = (FilterItem) itemFactoryInstance.GetItem(ItemType.FILTERITEM, dataReader); - ItemList.Add( curFile ); - } - else - { - FileItem curFile = (FileItem) itemFactoryInstance.GetItem(ItemType.FILEITEM, dataReader); - ItemList.Add( curFile ); - } - } + // double quotes around the filename-argument..... + if (UseQuotes) + filename = "\"" + fileItem.Filename + "\""; - } - } - } - catch ( SQLiteException ex ) - { - Log.Info( "Filedatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace ); - } - } + // set the arguments: one of the arguments is the fileitem-filename + if (this.Arguments.Contains("%FILEnoPATHnoEXT%")) + // ex. kawaks: + // winkawaks.exe alpham2 + // => filename without path and extension is necessary! + procStart.Arguments = " " + this.Arguments.Replace("%FILEnoPATHnoEXT%", Path.GetFileNameWithoutExtension(fileItem.Filename)); + else if (this.Arguments.Contains("%FILE%")) + // placeholder found => replace the placeholder by the correct filename + procStart.Arguments = " " + this.Arguments.Replace("%FILE%", filename); + else + // no placeholder found => default handling: add the fileitem as the last argument + procStart.Arguments = " " + this.Arguments + " " + filename; - protected void LaunchCmd(string commands) - { - string results = ""; - string errors = ""; - string[] script; - string curLine; - Process p = new Process(); - StreamWriter sw; - StreamReader sr; - StreamReader err; - - script = commands.Split( ';' ); - if ( script.Length > 0 ) - { - ProcessStartInfo psI = new ProcessStartInfo( "cmd" ); - psI.UseShellExecute = false; - psI.RedirectStandardInput = true; - psI.RedirectStandardOutput = true; - psI.RedirectStandardError = true; - psI.CreateNoWindow = true; - p.StartInfo = psI; - - p.Start(); - sw = p.StandardInput; - sr = p.StandardOutput; - err = p.StandardError; - - sw.AutoFlush = true; - - for ( int i = 0; i < script.Length; i++ ) - { - curLine = script[i].Trim(); - curLine = curLine.TrimStart( '\n' ); - if ( curLine != "" ) - sw.WriteLine( curLine ); - } - sw.Close(); - - results += sr.ReadToEnd(); - errors += err.ReadToEnd(); - - if ( errors.Trim() != "" ) - { - Log.Info( "Application PrePost errors: {0}", errors ); - } - } - } - - public virtual string DefaultFilepath() - { - return ""; // override this if the appitem can have subfolders - } - - public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) - { - int totalItems = 0; - - totalItems = totalItems + DisplayItemList( filePath, this.ItemList, facadeView ); - - return totalItems; - } - - - #region moved from BaseItem - - public int DisplayItemList(string filePath, List<BaseItem> dbItems, GUIFacadeControl facadeView) - { - int totalItems = 0; - - foreach (BaseItem baseItem in dbItems) + // set WorkingDirectory + if (this.StartupDir.Contains("%FILEDIR%")) + procStart.WorkingDirectory = this.StartupDir.Replace("%FILEDIR%", Path.GetDirectoryName(fileItem.Filename)); + else + procStart.WorkingDirectory = this.StartupDir; + } + else { - totalItems = totalItems + 1; - - if (baseItem is FileItem) + // application has no launch-file + // => try to make a correct launch using the current FILE object + if (UseQuotes) { - FileItem curFile = baseItem as FileItem; - GUIListItem gli = new GUIListItem(curFile.Title); - - gli.MusicTag = curFile; - // gli.IsFolder = curFile.IsFolder; - gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); + procStart.FileName = "\"" + fileItem.Filename + "\""; } - if (baseItem is FilterItem) + else { - FilterItem curFile = baseItem as FilterItem; - GUIListItem gli = new GUIListItem(curFile.Title); - gli.MusicTag = curFile; - //gli.IsFolder = false; - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); + procStart.FileName = fileItem.Filename; } + + // set WorkingDirectory + if (this.StartupDir == "") + procStart.WorkingDirectory = Path.GetDirectoryName(fileItem.Filename); + else if (this.StartupDir.Contains("%FILEDIR%")) + procStart.WorkingDirectory = this.StartupDir.Replace("%FILEDIR%", Path.GetDirectoryName(fileItem.Filename)); + else + procStart.WorkingDirectory = this.StartupDir; } - return totalItems; - } - protected void OnRetrieveCoverArt(GUIListItem guiListItem) - { - if (guiListItem.MusicTag == null) return; - FileItem curFileItem = (FileItem)guiListItem.MusicTag; - if (curFileItem == null) return; + // set UseShellExecute + procStart.UseShellExecute = this.UseShellExecute; + // set WindowStyle + procStart.WindowStyle = this.WindowStyle; - string imgFile = String.Empty; + this.LaunchErrorMsg = ""; + try + { + DoPreLaunch(); - if (ProgramUtils.UseThumbsDir()) - imgFile = ProgramUtils.GetFileImage(this,curFileItem); - else - imgFile = curFileItem.Imagefile; + if (mpGuiMode) + { + AutoPlay.StopListening(); + if (g_Player.Playing) + g_Player.Stop(); + } - if (File.Exists(imgFile)) + //proc = new Process(); + /*proc.EnableRaisingEvents = true; + proc.Exited += new EventHandler(proc_Exited); + + proc.StartInfo = procStart; + ProgramUtils.StartProcess(proc, this.WaitForExit); + */ + Utils.StartProcess(procStart, this.WaitForExit); + + if (mpGuiMode) + { + GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); + AutoPlay.StartListening(); + } + } + catch (Exception ex) { - guiListItem.ThumbnailImage = imgFile; - guiListItem.IconImageBig = imgFile; - guiListItem.IconImage = imgFile; + string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", + procStart.FileName, + procStart.Arguments, + procStart.WorkingDirectory, + ex.Message, + ex.Source, + ex.StackTrace); + Log.Info(ErrorString); + this.LaunchErrorMsg = ErrorString; } - else + finally { - guiListItem.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - guiListItem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - guiListItem.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; + DoPostLaunch(); } } - #endregion + public virtual string DefaultFilepath() + { + return ""; // override this if the appitem can have subfolders + } + public virtual bool FileEditorAllowed() + { + return true; // otherwise, override this in child class + } - public override void OnClick(BaseItem baseItem, GUIPrograms guiPrograms) - { - ApplicationItem candidate = ( ApplicationItem ) baseItem; - guiPrograms.SaveItemIndex( guiPrograms.GetSelectedItemNo().ToString(), guiPrograms.lastApp, lastFilepath ); - guiPrograms.lastApp = candidate; - guiPrograms.mapSettings.LastAppID = guiPrograms.lastApp.ApplicationItemId; - guiPrograms.prevFilepath = guiPrograms.lastApp.DefaultFilepath(); - guiPrograms.ViewHandler.CurrentLevel = 0; - guiPrograms.lastApp.ViewHandler = guiPrograms.ViewHandler; - } + public virtual bool FileAddAllowed() + { + return true; // otherwise, override this in child class + } - /* protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) - { - int totalItems = 0; - //foreach (FileItem currentFileItem in dbItems) - foreach (object obj in dbItems) - { - totalItems = totalItems + 1; - if (obj is FileItem) - { - FileItem curFile = obj as FileItem; - GUIListItem gli = new GUIListItem(curFile.Title); + public virtual bool FilesCanBeFavourites() + { + return true; // otherwise, override this in child class + } - gli.MusicTag = curFile; - gli.IsFolder = curFile.IsFolder; - gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); - } - } - return totalItems; - } - */ + public virtual bool FileBrowseAllowed() + { + // set this to true, if SUBDIRECTORIES are allowed + // (example: possible for DIRECTORY-CACHE) + return false; // otherwise, override this in child class + } - public virtual bool FileEditorAllowed() - { - return true; // otherwise, override this in child class - } + public virtual bool SubItemsAllowed() + { + return false; + } - public virtual bool FileAddAllowed() - { - return true; // otherwise, override this in child class - } + public virtual bool ProfileLoadingAllowed() + { + return false; + } - public virtual bool FilesCanBeFavourites() - { - return true; // otherwise, override this in child class - } + public virtual void Refresh(bool mpGuiMode) + { + // descendant classes do that! + } - public virtual bool FileBrowseAllowed() - { - // set this to true, if SUBDIRECTORIES are allowed - // (example: possible for DIRECTORY-CACHE) - return false; // otherwise, override this in child class - } + #endregion Public Methods - public virtual bool SubItemsAllowed() - { - return false; - } - public virtual bool ProfileLoadingAllowed() - { - return false; - } - public virtual void Refresh(bool mpGuiMode) - { - // descendant classes do that! - } + #region Database stuff - #region Database stuff + /// <summary> + /// get an unused SQL application KEY-number + /// </summary> + private int GetNewAppID() + { + int result = 0; + // won't work in multiuser environment :) + string sqlStmt = "SELECT MAX(applicationId) FROM tblApplicationItem"; + object o = dbHandlerInstance.ExecuteStmtScalar(sqlStmt); + if (o.ToString() != "") + { + result = Convert.ToInt32(o); + } + return result + 1; + } - /// <summary> - /// get an unused SQL application KEY-number - /// </summary> - private int GetNewAppID() - { - int result = 0; - // won't work in multiuser environment :) - string sqlStmt = "SELECT MAX(applicationId) FROM tblApplicationItem"; - object o = dbHandlerInstance.ExecuteStmtScalar( sqlStmt ); - if ( o.ToString() != "" ) - { - result = Convert.ToInt32( o ); - } - return result + 1; - } - + private void Insert() + { + SQLiteParameter[] parameterArray = new SQLiteParameter[23]; + ApplicationItemId = GetNewAppID(); // important to avoid subsequent inserts! + //params for question + values + parameterArray[0] = dbHandlerInstance.GetParameter<int>(ApplicationItemId, "@applicationItemId", DbType.Int32); + parameterArray[1] = dbHandlerInstance.GetParameter<int>(FatherID, "@fatherNodeId", DbType.Int32); + parameterArray[2] = dbHandlerInstance.GetParameter<string>(Title, "@title", DbType.String); + parameterArray[3] = dbHandlerInstance.GetParameter<string>(Filename, "@filename", DbType.String); + parameterArray[4] = dbHandlerInstance.GetParameter<string>(Arguments, "@arguments", DbType.String); + parameterArray[5] = dbHandlerInstance.GetParameter<string>(ProgramUtils.WindowStyleToStr(WindowStyle), "@windowStyle", DbType.String); + parameterArray[6] = dbHandlerInstance.GetParameter<string>(StartupDir, "@startupDir", DbType.String); + parameterArray[7] = dbHandlerInstance.GetParameter<bool>(UseShellExecute, "@useShellExecute", DbType.Boolean); + parameterArray[8] = dbHandlerInstance.GetParameter<bool>(UseQuotes, "@useQuotes", DbType.Boolean); + parameterArray[9] = dbHandlerInstance.GetParameter<string>(ProgramUtils.ApplicationTypeToString(SourceType), "@applicationItemType", DbType.String); + parameterArray[10] = dbHandlerInstance.GetParameter<string>(Source, "@source", DbType.String); + parameterArray[11] = dbHandlerInstance.GetParameter<string>(imageFile, "@imageFile", DbType.String); + parameterArray[12] = dbHandlerInstance.GetParameter<string>(FileDire... [truncated message content] |
From: <nor...@us...> - 2007-08-19 23:23:23
|
Revision: 847 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=847&view=rev Author: northern_sky Date: 2007-08-19 16:23:20 -0700 (Sun, 19 Aug 2007) Log Message: ----------- misc cleanup, added abstract class for import, changed skin a bit, Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.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/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/Resources.Designer.cs Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAlt.xml Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myprograms.xml Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -445,8 +445,18 @@ } } + public ApplicationItem GetAppByID(int targetAppID) + { + foreach (ApplicationItem curApp in globalApplicationItemList) + { + if (curApp.ApplicationItemId == targetAppID) + { + return curApp; + } + } + return null; + } - #endregion Public Methods #region Private Methods Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -195,7 +195,7 @@ } else { - string imageDirectorys = string.Join(";", currentApplication.imageDirs); + string imageDirectorys = string.Join(";", currentApplication.ImageDirsSplitted); this.imageDirsTextBox.Text = imageDirectorys; } @@ -383,11 +383,11 @@ OnImageFolderSearch(this, null); } //get all imagedirs - /* for (int i = 0; i < currentApplication.imageDirs.Length; i++) + /* for (int i = 0; i < currentApplication.imageDirsSplitted.Length; i++) { - if (!currentApplication.imageDirs[i].ToString().Equals("")) + if (!currentApplication.imageDirsSplitted[i].ToString().Equals("")) { - imageDirsList.Add(currentApplication.imageDirs[i]); + imageDirsList.Add(currentApplication.imageDirsSplitted[i]); } } @@ -526,7 +526,7 @@ { // if (file.IsFolder) //{ - //ChangeFilePath(file.Filename); // filename becomes filepath in next view... :) + //ChangeFilePath(file.Executable); // executable becomes filepath in next view... :) //} //else //{ @@ -578,7 +578,7 @@ foreach (ApplicationItem app in apps) { - if (app.SourceType == ItemType.GROUPER) + if (app.Item_Type == ItemType.GROUPER) { ToolStripMenuItem newMenu = new ToolStripMenuItem(app.Title); newMenu.Tag = app.ApplicationItemId; @@ -653,7 +653,7 @@ if ((currentApplication is ApplicationItemGameBase)) { - applicationItem.Source = this.gamebaseDBTextBox.Text; + applicationItem.ApplicationItemSource = this.gamebaseDBTextBox.Text; } } @@ -739,7 +739,7 @@ this.gamebaseDBTextBox.Visible = true; this.gamebaseDBButton.Visible = true; this.gamebaseLabel.Visible = true; - this.gamebaseDBTextBox.Text = currentApplication.Source; + this.gamebaseDBTextBox.Text = currentApplication.ApplicationItemSource; } if ((currentApplication is ApplicationItemGrouper)) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -56,7 +56,7 @@ enabledCheckbox.Checked = curApp.Enabled; titleTextBox.Text = curApp.Title; - applicationExeTextBox.Text = curApp.Filename; + applicationExeTextBox.Text = curApp.Executable; applicationArgumentsTextBox.Text = curApp.Arguments; // Pre-Post-Launch preCommandTextBox.Text = curApp.PreLaunch; @@ -86,7 +86,7 @@ curApp.Enabled = enabledCheckbox.Checked; curApp.Title = titleTextBox.Text; - curApp.Filename = applicationExeTextBox.Text; + curApp.Executable = applicationExeTextBox.Text; curApp.Arguments = applicationArgumentsTextBox.Text; // Pre-Post-Launch curApp.PreLaunch = preCommandTextBox.Text; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -75,7 +75,7 @@ curApp.UseShellExecute = shellexecuteCheckBox.Checked; curApp.UseQuotes = quoteCheckBox.Checked; curApp.WaitForExit = waitExitCheckBox.Checked; - curApp.SourceType = ItemType.DIRCACHE; + curApp.Item_Type = ItemType.DIRCACHE; curApp.RefreshGUIAllowed = allowRefreshCheckBox.Checked; curApp.PlatformId = (int)platformComboBox.SelectedValue; } @@ -105,7 +105,7 @@ public override void LoadFromAppItem(ApplicationItem applicationItem) { titleTextBox.Text = applicationItem.Title; - applicationExeTextBox.Text = applicationItem.Filename; + applicationExeTextBox.Text = applicationItem.Executable; applicationArgumentsTextBox.Text = applicationItem.Arguments; startupDirComboBox.Text = applicationItem.StartupDir; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -64,7 +64,7 @@ curApp.UseShellExecute = this.shellexecuteCheckBox.Checked; curApp.UseQuotes = this.quoteCheckBox.Checked; curApp.WaitForExit = this.waitExitCheckBox.Checked; - curApp.SourceType = ItemType.GAMEBASE; + curApp.Item_Type = ItemType.GAMEBASE; curApp.RefreshGUIAllowed = this.allowRefreshCheckBox.Checked; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -53,7 +53,7 @@ { base.SaveSettings(curApp); - curApp.SourceType = ItemType.GROUPER; + curApp.Item_Type = ItemType.GROUPER; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -55,7 +55,7 @@ { base.SaveSettings(curApp); - curApp.SourceType = ItemType.MAMEDIRECT; + curApp.Item_Type = ItemType.MAMEDIRECT; curApp.RefreshGUIAllowed = true; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -378,7 +378,7 @@ this.lblFilename.Name = "lblFilename"; this.lblFilename.Size = new System.Drawing.Size(52, 13); this.lblFilename.TabIndex = 45; - this.lblFilename.Text = "Filename:"; + this.lblFilename.Text = "Executable:"; // // btnFilename // Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -216,7 +216,7 @@ { conditionChecker.Clear(); conditionChecker.DoCheck(CurFile.Title != "", "No title entered!"); - //01.04.05 no filename is FINE :-) conditionChecker.DoCheck(CurFile.Filename != "", "No filename entered!"); + //01.04.05 no executable is FINE :-) conditionChecker.DoCheck(CurFile.Executable != "", "No executable entered!"); if (!conditionChecker.IsOk) { string strHeader = "The following entries are invalid: \r\n\r\n"; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -343,7 +343,7 @@ ApplicationItem currentApplication = GetTreeNodeApplicationItem(treeView.SelectedNode); if (currentApplication == null) return appSettingsRoot; - switch (currentApplication.SourceType) + switch (currentApplication.Item_Type) { case ItemType.DIRCACHE: return appSettingsDirCache; @@ -528,7 +528,7 @@ else { ApplicationItem curApp = this.GetTreeNodeApplicationItem(treeView.SelectedNode); - if ((curApp.SourceType == ItemType.MAMEDIRECT) || (curApp.SourceType == ItemType.GAMEBASE)) + if ((curApp.Item_Type == ItemType.MAMEDIRECT) || (curApp.Item_Type == ItemType.GAMEBASE)) { this.premadeConfigurationsToolStripMenuItem.Enabled = false; } @@ -661,7 +661,7 @@ { newApplication.Title = "New item"; } - newApplication.SourceType = newSourceType; + newApplication.Item_Type = newSourceType; newApplication.InsertOrUpdateSettings(); dbHandlerInstance.LoadAllApplicationItems(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -446,7 +446,7 @@ { LoadLastAppIDFromSettings(); // hacky load back the last applicationItem id, otherwise this can get lost from dx resets.... } - lastApp = GetAppByID(mapSettings.LastAppID); + lastApp = this.dbHandlerInstance.GetAppByID(mapSettings.LastAppID); if (lastApp != null) { prevFilepath = lastApp.DefaultFilepath(); @@ -591,7 +591,7 @@ public override bool Init() { - return Load(GUIGraphicsContext.Skin + @"\myprograms.xml"); + return Load(GUIGraphicsContext.Skin + @"\myProgramsAlt.xml"); } protected override void OnPageLoad() @@ -926,7 +926,7 @@ lastApp.CurrentView = ViewHandler.CurrentView; } int totalFiles = 0; - totalFiles = totalFiles + DisplayItemList(lastApp.filePath, lastApp.ItemList, facadeView); + totalFiles = totalFiles + DisplayItemList(lastApp.ItemList, facadeView); return (totalFiles); } @@ -1048,7 +1048,7 @@ { // back item in application list clicked // go to father item - lastApp = GetAppByID(lastApp.FatherID); + lastApp = this.dbHandlerInstance.GetAppByID(lastApp.FatherID); if (lastApp != null) { mapSettings.LastAppID = lastApp.ApplicationItemId; @@ -1114,21 +1114,11 @@ return res; } - public ApplicationItem GetAppByID(int targetAppID) - { - foreach (ApplicationItem curApp in globalApplicationList) - { - if (curApp.ApplicationItemId == targetAppID) - { - return curApp; - } - } - return null; - } + /* public ApplicationItem CloneAppItem(ApplicationItem sourceApp) { - ApplicationItem newApp = (ApplicationItem)ItemFactory.itemFactoryInstance.GetItem(sqlDB, sourceApp.SourceType, null, 0); + ApplicationItem newApp = (ApplicationItem)ItemFactory.itemFactoryInstance.GetItem(sqlDB, sourceApp.Item_Type, null, 0); newApp.Assign(sourceApp); newApp.ApplicationItemId = -1; // to force a sql INSERT when written Add(newApp); @@ -1304,7 +1294,7 @@ #region moved from BaseItem - public int DisplayItemList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) + public int DisplayItemList(List<object> dbItems, GUIFacadeControl facadeView) { int totalItems = 0; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-19 23:23:20 UTC (rev 847) @@ -137,7 +137,9 @@ <Compile Include="GUIPrograms.cs" /> <Compile Include="GUIProgramsAltFileInfo.cs" /> <Compile Include="Imports\AllGameScraper.cs" /> + <Compile Include="Imports\DirectoryImport.cs" /> <Compile Include="Imports\GamebaseImport.cs" /> + <Compile Include="Imports\ImportBase.cs" /> <Compile Include="Imports\MameImport.cs" /> <Compile Include="Items\ApplicationItem.cs" /> <Compile Include="Items\ApplicationItemDirectoryCache.cs" /> @@ -161,7 +163,7 @@ </ItemGroup> <ItemGroup> <Content Include="MetaData\myProgramsAltPreconfiguration.xml" /> - <Content Include="skin\BlueTwo\myprograms.xml" /> + <Content Include="skin\BlueTwo\myprogramsAlt.xml" /> <Content Include="skin\BlueTwo\myProgramsAltFileInfo.xml" /> <Content Include="SqlNet\System.Data.SQLite.DLL" /> </ItemGroup> Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using MediaPortal.GUI.Library; + + +using GUIPrograms.Items; +using GUIPrograms; +using GUIPrograms.Database; +using System.Data.SQLite; + +using System.IO; + +namespace GUIPrograms.Imports +{ + public class DirectoryImport: ImportBase + { + private ApplicationItem applicationItem = null; + private DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + + 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(); + curFile.FileID = -1; // to force an INSERT statement when writing the item + curFile.AppID = applicationItem.ApplicationItemId; + curFile.Title = Path.GetFileNameWithoutExtension(fileInfo.Name); + curFile.Filename = fileInfo.FullName; + + //curFile.Imagefile = GetThumbsFile(fileInfo, curFile.Title); + curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, applicationItem); + + // not imported properties => set default values + curFile.LastTimeLaunched = DateTime.MinValue; + curFile.LaunchCount = 0; + curFile.Write(); + } + + private void DeleteOrphaned() + { + string TheFileName; + foreach (FileItem DBfile in applicationItem.ItemList) + { + + TheFileName = DBfile.Filename; + + //if (!DBfile.IsFolder) + //{ + if (!File.Exists(TheFileName)) { DBfile.Delete(); } + //} + //else + //{ + //if (!Directory.Exists(TheFileName)) { DBfile.Delete(); } + + //} + + } + } + + private void ImportFile(string dirPath, bool mpGuiMode) + { + + FileInfo fileInDir = null; + if (Directory.Exists(dirPath)) + { + DirectoryInfo directoryInfo = new DirectoryInfo(dirPath); + FileSystemInfo[] allUnderLyingFiles = directoryInfo.GetFileSystemInfos(); + + for (int i = 0; i < allUnderLyingFiles.Length; i++) + { + if (allUnderLyingFiles[i] is FileInfo) + { + Boolean FileExists = false; + + fileInDir = (FileInfo)allUnderLyingFiles[i]; + + foreach (FileItem DBfile in applicationItem.ItemList) + { + if (DBfile.Filename == fileInDir.FullName) + { + FileExists = true; + break;//ugly + } + } + if (!FileExists) + { + ImportFileItem(fileInDir); + //UpdateProgressDialog(fileInDir, mpGuiMode); + } + }//if dir found,, recurse + else if (allUnderLyingFiles[i] is DirectoryInfo) + { + DirectoryInfo directory = (DirectoryInfo)allUnderLyingFiles[i]; + ImportFile(directory.FullName, mpGuiMode); + } + } + } + } + + public void StartImport(string[] fileDirPaths, bool mpGuiMode) + { + using (SQLiteTransaction transaction = dbHandlerInstance.SqlLiteConn.BeginTransaction()) + { + DeleteOrphaned(); + //get all maindirs + foreach (string dirPath in fileDirPaths) + { + ImportFile(dirPath, mpGuiMode); + } + transaction.Commit(); + } + } + } +} Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -40,28 +40,25 @@ /// <summary> /// Summary description for GamebaseImport. /// </summary> - public class GamebaseImport + public class GamebaseImport : ImportBase { private ApplicationItem applicationItem = null; - - // event: read new file - public delegate void MyEventHandler(string informationMessage, int progressBarCtr); - - public event MyEventHandler OnReadNewFile = null; - public event MyEventHandler OnSendMessage = null; - - 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) { - + FileItem curFile = new FileItem(); curFile.FileID = -1; // to force an INSERT statement when writing the item curFile.AppID = applicationItem.ApplicationItemId; @@ -71,7 +68,7 @@ string strGenre1 = myReader["ParentGenre"].ToString(); string strGenre2 = myReader["Genre"].ToString(); - int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre1); + int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre1); curFile.GenreId = LexiconId; LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre2); @@ -99,14 +96,15 @@ 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))); + //this.OnReadNewFile(curFile.Title, (int)(100 * (((double)curPos) / maxGames))); + SendDisplayText(curFile.Title, (int)(100 * (((double)curPos) / maxGames))); return; } - public void Start() + public void StartImport() { // string strCon = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=C:\\media\\GameBase\\snes\\Snes.mdb"; - string strCon = String.Format("Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source={0}", applicationItem.Source); + string strCon = String.Format("Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source={0}", applicationItem.ApplicationItemSource); //Make a Select Command for querying the gamebase-MDB-file string sqlStrCount = "SELECT count(*) FROM Games"; @@ -144,69 +142,66 @@ { using (OleDbConnection myCon = new OleDbConnection(strCon)) { - - using (OleDbCommand myCmd = new OleDbCommand(sqlStr, myCon)) - { - using (SQLiteTransaction transaction = DatabaseHandler.DBHandlerInstance.SqlLiteConn.BeginTransaction()) - - { + using (OleDbCommand myCmd = new OleDbCommand(sqlStr, myCon)) + { + + using (SQLiteTransaction transaction = DatabaseHandler.DBHandlerInstance.SqlLiteConn.BeginTransaction()) + { myCon.Open(); int maxGames = CountGames(myCon, sqlStrCount); - - - using (OleDbDataReader myReader = myCmd.ExecuteReader()) - { - int i = 0; - while (myReader.Read()) - { - i++; - curRomname = myReader["Filename"].ToString(); - curFullRomname = applicationItem.FileDirectory + "\\" + curRomname; - if (applicationItem.ImageDirectory != "") - { - curTitleImage = applicationItem.imageDirs[0] + "\\" + myReader["ScrnshotFilename"].ToString(); - } - else - { - curTitleImage = ""; - } + using (OleDbDataReader myReader = myCmd.ExecuteReader()) + { - if (File.Exists(curFullRomname)) - { - // rom-name from gamebase exists in users filedirectory - // => ready to import item - bDoImport = true; + int i = 0; + while (myReader.Read()) + { + i++; + curRomname = myReader["Filename"].ToString(); + curFullRomname = applicationItem.FileDirectory + "\\" + curRomname; - if (applicationItem.ImportValidImagesOnly) - { - // skip item if no thumbnail image is found - bDoImport = ((curTitleImage != null) && (curTitleImage != "") && (File.Exists(curTitleImage))); - } - - if (bDoImport) - { - DBImportGamebaseItem(myReader, curFullRomname, curTitleImage, i, maxGames); + if (applicationItem.ImageDirectory != "") + { + curTitleImage = applicationItem.ImageDirsSplitted[0] + "\\" + myReader["ScrnshotFilename"].ToString(); + } + else + { + curTitleImage = ""; + } - } - else - { - Log.Info("*skipped* gamebase game {0} image{1}", curRomname, curTitleImage); - } + if (File.Exists(curFullRomname)) + { + // rom-name from gamebase exists in users filedirectory + // => ready to import item + bDoImport = true; - } - else - { - Log.Info("*missing* gamebase game {0}", curRomname); - } + if (applicationItem.ImportValidImagesOnly) + { + // skip item if no thumbnail image is found + bDoImport = ((curTitleImage != null) && (curTitleImage != "") && (File.Exists(curTitleImage))); } + + if (bDoImport) + { + DBImportGamebaseItem(myReader, curFullRomname, curTitleImage, i, maxGames); + + } + else + { + Log.Info("*skipped* gamebase game {0} image{1}", curRomname, curTitleImage); + } + } - transaction.Commit(); + else + { + Log.Info("*missing* gamebase game {0}", curRomname); + } } - - + } + transaction.Commit(); + } } } } @@ -216,14 +211,6 @@ } } - void SendText(string informationMessage, int progressBarCtr) - { - if (OnSendMessage != null) - { - OnSendMessage(informationMessage, progressBarCtr); - } - } - int CountGames(OleDbConnection myCon, string sqlStrCount) { int res = 0; Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using System.IO; +using GUIPrograms.Items; + +namespace GUIPrograms.Imports +{ + public abstract class ImportBase + { + // event: read new file + protected delegate void MyEventHandler(string informationMessage, int progressBarCtr); + + protected event MyEventHandler OnReadNewFile = null; + + protected void SendDisplayText(string displayText, int progressBarCtr) + { + if (OnReadNewFile != null) + { + OnReadNewFile(displayText, progressBarCtr); + } + } + + protected string ImportImageFiles(string fileName, string fileTitle,ApplicationItem applicationItem) + { + string thumb = ""; + + if (applicationItem.ImageDirsSplitted.Length > 0) + { + foreach (string imageDir in applicationItem.ImageDirsSplitted) + { + if (Directory.Exists(imageDir)) + { + string[] matchesJPG = Directory.GetFiles(imageDir, Path.GetFileNameWithoutExtension(fileName) + ".jpg"); + string[] matchesGIF = Directory.GetFiles(imageDir, Path.GetFileNameWithoutExtension(fileName) + ".gif"); + string[] matchesPNG = Directory.GetFiles(imageDir, Path.GetFileNameWithoutExtension(fileName) + ".png"); + if (matchesJPG.Length > 0) + { + thumb = matchesJPG[0]; + } + else if (matchesGIF.Length > 0) + { + thumb = matchesGIF[0]; + } + else if (matchesPNG.Length > 0) + { + thumb = matchesPNG[0]; + } + else + { + matchesJPG = Directory.GetFiles(imageDir, Path.GetFileNameWithoutExtension(fileName) + "*.jpg"); + matchesGIF = Directory.GetFiles(imageDir, Path.GetFileNameWithoutExtension(fileName) + "*.gif"); + matchesPNG = Directory.GetFiles(imageDir, Path.GetFileNameWithoutExtension(fileName) + "*.png"); + if (matchesJPG.Length > 0) + { + thumb = matchesJPG[0]; + } + else if (matchesGIF.Length > 0) + { + thumb = matchesGIF[0]; + } + else if (matchesPNG.Length > 0) + { + thumb = matchesPNG[0]; + } + + } + } + } + } + return thumb; + } + + } +} Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -46,15 +46,10 @@ /// <summary> /// Summary description for MameImport. /// </summary> - public class MameImport + public class MameImport : ImportBase { ApplicationItem currentApplication = null; - // event: read new file - public delegate void MyEventHandler(string informationMessage, int progressBarCtr); - - public event MyEventHandler OnReadNewFile = null; - public event MyEventHandler OnSendMessage = null; ConditionChecker Checker = new ConditionChecker(); Regex regexMameGameName = new Regex(@"(?<romName>\w+)\s+""(?<gameName>.+)"""); Regex regexMameCloneName = new Regex(@"(?<cloneName>\w+)\s+(?<orgGameName>\w+)"); @@ -79,19 +74,24 @@ { currentApplication = applicationItem; + OnReadNewFile += new MyEventHandler(currentApplication.ReadNewFile); } + public void DeInit() + { + OnReadNewFile -= new MyEventHandler(currentApplication.ReadNewFile); + } void ReadListFull() { fullRomListDictionary.Clear(); string line = string.Empty; - SendText("generating mame list (full)", 10); + SendDisplayText("generating mame list (full)", 10); using (Process process = new Process()) { - ProcessStartInfo processStartInfo = new ProcessStartInfo(currentApplication.Filename); + ProcessStartInfo processStartInfo = new ProcessStartInfo(currentApplication.Executable); processStartInfo.Arguments = "-listfull"; processStartInfo.UseShellExecute = false; processStartInfo.RedirectStandardOutput = true; @@ -115,17 +115,16 @@ } } - void ReadListClones() { string line; if (((ApplicationItemMame)currentApplication).ImportOriginalsOnly) { - SendText("generating mame list (clones)", 20); + SendDisplayText("generating mame list (clones)", 20); using (Process process = new Process()) { - ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(currentApplication.Filename); + ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(currentApplication.Executable); myProcessStartInfo.Arguments = "-listclones"; myProcessStartInfo.UseShellExecute = false; myProcessStartInfo.RedirectStandardOutput = true; @@ -192,7 +191,6 @@ } } - void ReadCatverIni() { string line = string.Empty; @@ -238,37 +236,33 @@ return mameHistoryContainer; } - - bool CheckPrerequisites() { char separator = ';'; Checker.Clear(); string[] fileDirs = currentApplication.FileDirectory.Split(separator); - - - if (Checker.DoCheck(System.IO.File.Exists(currentApplication.Filename), "mame-application not found!")) + if (Checker.DoCheck(System.IO.File.Exists(currentApplication.Executable), "mame-application not found!")) { - mameDir = Path.GetDirectoryName(currentApplication.Filename); + mameDir = Path.GetDirectoryName(currentApplication.Executable); catverIniFile = mameDir + "\\catver.ini"; historyDatFile = mameDir + "\\history.dat"; } if (Checker.IsOk) { - SendText("Generating lists...", 0); + SendDisplayText("Generating lists...", 0); ReadListFull(); - SendText("Generating lists.....", 0); + SendDisplayText("Generating lists.....", 0); ReadListClones(); if (System.IO.File.Exists(catverIniFile)) { - SendText("Reading catver.ini.......", 0); + SendDisplayText("Reading catver.ini.......", 0); ReadCatverIni(); } if (System.IO.File.Exists(historyDatFile)) { - SendText("Reading history.dat............", 0); + SendDisplayText("Reading history.dat............", 0); ReadHistoryDat(); } @@ -287,25 +281,16 @@ return Checker.IsOk; } - void SendText(string informationMessage, int progressBarCtr) - { - if (OnSendMessage != null) - { - OnSendMessage(informationMessage, progressBarCtr); - } - } - public void Start() + public void StartImport() { if (!CheckPrerequisites()) { - OnSendMessage(Checker.Problems, 0); + SendDisplayText(Checker.Problems, 0); Log.Info("MameImporter: import failed! Details: {0}", Checker.Problems); return; } int i = 0; - //trick to slow down progressbarimport.. - localRomNames.Reverse(); double total = localRomNames.Count; @@ -318,8 +303,8 @@ } transaction.Commit(); } - - SendText("Import done...................", 100); + + SendDisplayText("Import done...................", 100); } @@ -367,11 +352,11 @@ FileItem curFile = new FileItem(); curFile.AppID = currentApplication.ApplicationItemId; curFile.Filename = fullRomname; - curFile.Imagefile = GetImageFile(curRomname); + curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, currentApplication); if ((curFile.Imagefile == "") && (currentApplication.ImportValidImagesOnly)) { - this.SendText("", (int)(100 * (((double)count) / total))); + SendDisplayText("", (int)(100 * (((double)count) / total))); return; } if (this.fullRomListDictionary.ContainsKey(curRomname)) @@ -419,7 +404,7 @@ ProcessFullEntry(curFile, fullEntry); ProcessGenreEntry(curFile, genreEntry); - + int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblPlatform", "platform", "Arcade"); curFile.PlatformId = LexiconId; @@ -427,7 +412,7 @@ curFile.Write(); // OnReadNewFile(curFile.Title, count, localRomNames.Length); - this.SendText(curFile.Title, (int)(100 * (((double)count) / total))); + SendDisplayText(curFile.Title, (int)(100 * (((double)count) / total))); } } @@ -435,11 +420,11 @@ } else { - this.SendText("", (int)(100 * (((double)count) / total))); + SendDisplayText("", (int)(100 * (((double)count) / total))); } } - void ProcessFullEntry(FileItem curFile, string fullEntry) + void ProcessFullEntry(FileItem curFile, string fullEntry) { // mspacman "Ms. Pac-Man" Match m = regexMameGameName.Match(fullEntry); @@ -483,45 +468,6 @@ } // mspacman=Maze } - - - string GetImageFile(string curRomname) - { - string res = ""; - string imgFolder = ""; - int i = 0; - while ((res == "") && (i < currentApplication.imageDirs.Length)) - { - imgFolder = currentApplication.imageDirs[i]; - res = GetImageFileOfFolder(curRomname, imgFolder); - i++; - } - return res; - } - - string GetImageFileOfFolder(string curRomname, string imgFolder) - { - string res = ""; - if (Directory.Exists(imgFolder)) - { - string filenameNoExtension = imgFolder + "\\" + curRomname; - if (File.Exists(Path.ChangeExtension(filenameNoExtension, ".png"))) - { - res = Path.ChangeExtension(filenameNoExtension, ".png"); - } - else if (File.Exists(Path.ChangeExtension(filenameNoExtension, ".jpg"))) - { - res = Path.ChangeExtension(filenameNoExtension, ".jpg"); - } - else if (File.Exists(Path.ChangeExtension(filenameNoExtension, ".gif"))) - { - res = Path.ChangeExtension(filenameNoExtension, ".gif"); - } - } - return res; - } - - public class MameHistoryContainer { @@ -549,6 +495,5 @@ } } - } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -37,6 +37,7 @@ using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Ripper; +using MediaPortal.Dialogs; using MediaPortal.Util; using GUIPrograms; @@ -65,10 +66,12 @@ protected int GetID = ProgramUtils.GetID; protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + protected GUIDialogProgress progressDialog = null; + int appID; int fatherID; string title; - string filename; + string executable; string arguments; ProcessWindowStyle windowStyle; @@ -81,22 +84,22 @@ private List<ImportOption> importOptionList; bool enabled; int appPosition; - string currentView = ""; - public List<object> ItemList = new List<object>(); + 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; bool refreshGUIAllowed = false; - public string filePath = ""; - ItemType sourceType; - string sourceFile; + ItemType itemType; + string applicationItemSource; string imageFile; string imageDirectories; // in one string for sqlite db field - public string[] imageDirs; // imageDirectories splitted + private string[] imageDirsSplitted; // imageDirectories splitted + + string fileDirectory; string validExtensions; bool importValidImagesOnly; @@ -134,10 +137,10 @@ set { title = value; } } - public string Filename + public string Executable { - get { return filename; } - set { filename = value; } + get { return executable; } + set { executable = value; } } public string Imagefile { @@ -227,34 +230,39 @@ get { return fileDirectory; } set { fileDirectory = value; } } + public string ImageDirectory { get { return imageDirectories; } - set { SetImageDirectory(value); } - } - private void SetImageDirectory(string value) - { - imageDirectories = value; - imageDirs = imageDirectories.Split(';'); - for (int i = 0; i < imageDirs.Length; i++) + set { - imageDirs[i] = imageDirs[i].Trim(); - // hack the \n away.... - // imageDirs[i] = imageDirs[i].TrimStart('\n'); - // hack trailing backslashes away - imageDirs[i] = imageDirs[i].TrimEnd('\\'); + imageDirectories = value; + + //also do the split + imageDirsSplitted = imageDirectories.Split(';'); + for (int i = 0; i < imageDirsSplitted.Length; i++) + { + imageDirsSplitted[i] = imageDirsSplitted[i].Trim(); + imageDirsSplitted[i] = imageDirsSplitted[i].TrimEnd('\\'); + } } } - public string Source + + public string[] ImageDirsSplitted { - get { return sourceFile; } - set { sourceFile = value; } + get { return imageDirsSplitted; } } - public ItemType SourceType + + public string ApplicationItemSource { - get { return sourceType; } - set { sourceType = value; } + get { return applicationItemSource; } + set { applicationItemSource = value; } } + public ItemType Item_Type + { + get { return itemType; } + set { itemType = value; } + } public string ValidExtensions { get { return validExtensions; } @@ -271,6 +279,7 @@ get { return platformId; } set { platformId = value; } } + public string LaunchErrorMsg { get { return launchErrorMsg; } @@ -288,15 +297,15 @@ appID = -1; fatherID = -1; title = ""; - filename = ""; + executable = ""; arguments = ""; windowStyle = ProcessWindowStyle.Normal; startupDir = "%FILEDIR%"; useShellExecute = false; useQuotes = true; enabled = true; - sourceType = ItemType.UNKNOWN; - sourceFile = ""; + itemType = ItemType.UNKNOWN; + applicationItemSource = ""; imageFile = ""; fileDirectory = ""; imageDirectories = ""; @@ -315,16 +324,34 @@ #region protected methods - protected void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + + protected void ShowProgressDialog(string headerText) { - /*ApplicationItem targetApp = GetAppByID(curLink.TargetAppID); - if (targetApp != null) + progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + progressDialog.ShowWaitCursor = true; + progressDialog.SetHeading(headerText); + progressDialog.SetLine(0,headerText); + progressDialog.SetLine(1, ""); + progressDialog.SetLine(2, ""); + progressDialog.StartModal(GetID); + progressDialog.Progress(); + } + + public void ReadNewFile(string informationMessage, int progressBarCtr) + { + if (progressDialog != null) { - targetApp.LaunchFile(curLink, MPGUIMode); - }*/ + 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.Progress(); + } + SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); } - protected void SendRefreshInfo(string informationMessage, int progressBarCtr) { if (OnRefreshInfo != null) @@ -398,11 +425,15 @@ } } + protected virtual void Import(bool mpGUIMode) + { + //override + } + #endregion protected methods #region Public Methods - public virtual string CurrentFilePath() { return this.FileDirectory; @@ -414,14 +445,14 @@ this.ApplicationItemId = sourceApp.ApplicationItemId; this.FatherID = sourceApp.FatherID; this.Title = sourceApp.Title; - this.Filename = sourceApp.Filename; + this.Executable = sourceApp.Executable; this.Arguments = sourceApp.Arguments; this.WindowStyle = sourceApp.WindowStyle; this.StartupDir = sourceApp.StartupDir; this.UseShellExecute = sourceApp.UseShellExecute; this.UseQuotes = sourceApp.UseQuotes; - this.SourceType = sourceApp.SourceType; - this.Source = sourceApp.Source; + this.Item_Type = sourceApp.Item_Type; + this.ApplicationItemSource = sourceApp.ApplicationItemSource; this.Imagefile = sourceApp.Imagefile; this.FileDirectory = sourceApp.FileDirectory; this.ImageDirectory = sourceApp.ImageDirectory; @@ -432,7 +463,6 @@ this.PreLaunch = sourceApp.PreLaunch; this.PostLaunch = sourceApp.PostLaunch; this.PlatformId = sourceApp.PlatformId; - } public FileItem PrevFile(FileItem curFile) @@ -467,7 +497,6 @@ { FileItem curFileItem = launchItem; if (curFileItem == null) return; - this.LaunchFile(curFileItem, true); } @@ -476,19 +505,17 @@ string filename = fileItem.Filename; if (filename == "") return; - // Launch File by item - if (mpGuiMode) - fileItem.UpdateLaunchInfo(); + fileItem.UpdateLaunchInfo(); ProcessStartInfo procStart = new ProcessStartInfo(); - if (this.Filename != "") - { // use the APPLICATION launcher and add current file information + // use the APPLICATION launcher and add current file information + if (this.Executable != "") + { + // executable of the application + procStart.FileName = this.Executable; - // filename of the application - procStart.FileName = this.Filename; - - // double quotes around the filename-argument..... + // double quotes around the executable-argument..... if (UseQuotes) filename = "\"" + fileItem.Filename + "\""; @@ -496,7 +523,7 @@ if (this.Arguments.Contains("%FILEnoPATHnoEXT%")) // ex. kawaks: // winkawaks.exe alpham2 - // => filename without path and extension is necessary! + // => executable without path and extension is necessary! procStart.Arguments = " " + this.Arguments.Replace("%FILEnoPATHnoEXT%", Path.GetFileNameWithoutExtension(fileItem.Filename)); else if (this.Arguments.Contains("%FILE%")) // placeholder found => replace the placeholder by the correct filename @@ -625,10 +652,60 @@ // descendant classes do that! } - #endregion Public Methods + public void LoadFromXmlProfile(XmlNode node) + { + XmlNode titleNode = node.SelectSingleNode("title"); + if (titleNode != null) + { + this.Title = titleNode.InnerText; + } + XmlNode launchingAppNode = node.SelectSingleNode("launchingApplication"); + if (launchingAppNode != null) + { + this.Executable = launchingAppNode.InnerText; + } + XmlNode useShellExecuteNode = node.SelectSingleNode("useShellExecute"); + if (useShellExecuteNode != null) + { + this.UseShellExecute = ProgramUtils.StrToBoolean(useShellExecuteNode.InnerText); + } + + XmlNode argumentsNode = node.SelectSingleNode("arguments"); + if (argumentsNode != null) + { + this.Arguments = argumentsNode.InnerText; + } + + XmlNode windowStyleNode = node.SelectSingleNode("windowStyle"); + if (windowStyleNode != null) + { + this.WindowStyle = ProgramUtils.StringToWindowStyle(windowStyleNode.InnerText); + } + + XmlNode startupDirNode = node.SelectSingleNode("startupDir"); + if (startupDirNode != null) + { + this.StartupDir = startupDirNode.InnerText; + } + + XmlNode useQuotesNode = node.SelectSingleNode("useQuotes"); + if (useQuotesNode != null) + { + this.UseQuotes = ProgramUtils.StrToBoolean(useQuotesNode.InnerText); + } + + XmlNode fileExtensioneNode = node.SelectSingleNode("fileextensions"); + if (fileExtensioneNode != null) + { + this.ValidExtensions = fileExtensioneNode.InnerText; + } + } + + #endregion Public Methods + #region Database stuff /// <summary> @@ -656,14 +733,14 @@ parameterArray[0] = dbHandlerInstance.GetParameter<int>(ApplicationItemId, "@applicationItemId", DbType.Int32); parameterArray[1] = dbHandlerInstance.GetParameter<int>(FatherID, "@fatherNodeId", DbType.Int32); parameterArray[2] = dbHandlerInstance.GetParameter<string>(Title, "@title", DbType.String); - parameterArray[3] = dbHandlerInstance.GetParameter<string>(Filename, "@filename", DbType.String); + parameterArray[3] = dbHandlerInstance.GetParameter<string>(Executable, "@filename", DbType.String); parameterArray[4] = dbHandlerInstance.GetParameter<string>(Arguments, "@arguments", DbType.String); parameterArray[5] = dbHandlerInstance.GetParameter<string>(ProgramUtils.WindowStyleToStr(WindowStyle), "@windowStyle", DbType.String); parameterArray[6] = dbHandlerInstance.GetParameter<string>(StartupDir, "@startupDir", DbType.String); parameterArray[7] = dbHandlerInstance.GetParameter<bool>(UseShellExecute, "@useShellExecute", DbType.Boolean); parameterArray[8] = dbHandlerInstance.GetParameter<bool>(UseQuotes, "@useQuotes", DbType.Boolean); - parameterArray[9] = dbHandlerInstance.GetParameter<string>(ProgramUtils.ApplicationTypeToString(SourceType), "@applicationItemType", DbType.String); - parameterArray[10] = dbHandlerInstance.GetParameter<string>(Source, "@source", DbType.String); + parameterArray[9] = dbHandlerInstance.GetParameter<string>(ProgramUtils.ApplicationTypeToString(Item_Type), "@applicationItemType", DbType.String); + parameterArray[10] = dbHandlerInstance.GetParameter<string>(ApplicationItemSource, "@source", DbType.String); parameterArray[11] = dbHandlerInstance.GetParameter<string>(imageFile, "@imageFile", DbType.String); parameterArray[12] = dbHandlerInstance.GetParameter<string>(FileDirectory, "@fileDirectory", DbType.String); parameterArray[13] = dbHandlerInstance.GetParameter<string>(ImageDirectory, "@imageDirectory", DbType.String); @@ -754,14 +831,14 @@ parameterArray[0] = dbHandlerInstance.GetParameter<int>(ApplicationItemId, "@applicationItemId", DbType.Int32); parameterArray[1] = dbHandlerInstance.GetParameter<int>(FatherID, "@fatherNodeId", DbType.Int32); parameterArray[2] = dbHandlerInstance.GetParameter<string>(Title, "@title", DbType.String); - parameterArray[3] = dbHandlerInstance.GetParameter<string>(Filename, "@filename", DbType.String); + parameterArray[3] = dbHandlerInstance.GetParameter<string>(Executable, "@filename", DbType.String); parameterArray[4] = dbHandlerInstance.GetParameter<string>(Arguments, "@arguments", DbType.String); parameterArray[5] = dbHandlerInstance.GetParameter<string>(ProgramUtils.WindowStyleToStr(WindowStyle), "@windowStyle", DbType.String); parameterArray[6] = dbHandlerInstance.GetParameter<string>(StartupDir, "@startupDir", DbType.String); parameterArray[7] = dbHandlerInstance.GetParameter<bool>(UseShellExecute, "@useShellExecute", DbType.Boolean); parameterArray[8] = dbHandlerInstance.GetParameter<bool>(UseQuotes, "@useQuotes", DbType.Boolean); - parameterArray[9] = dbHandlerInstance.GetParameter<string>(ProgramUtils.ApplicationTypeToString(SourceType), "@applicationItemType", DbType.String); - parameterArray[10] = dbHandlerInstance.GetParameter<string>(Source, "@source", DbType.String); + parameterArray[9] = dbHandlerInstance.GetParameter<string>(ProgramUtils.ApplicationTypeToString(Item_Type), "@applicationItemType", DbType.String); + parameterArray[10] = dbHandlerInstance.GetParameter<string>(ApplicationItemSource, "@source", DbType.String); parameterArray[11] = dbHandlerInstance.GetParameter<string>(imageFile, "@imageFile", DbType.String); parameterArray[12] = dbHandlerInstance.GetParameter<string>(FileDirectory, "@fileDirectory", DbType.String); parameterArray[13] = dbHandlerInstance.GetParameter<string>(ImageDirectory, "@imageDirectory", DbType.String); @@ -866,8 +943,6 @@ public virtual void LoadFiles() { - lastFilepath = ""; - filePath = ""; ItemList = dbHandlerInstance.LoadItemList(ApplicationItemId, ItemList, ""); filesAreLoaded = true; } @@ -942,22 +1017,24 @@ #region imagedirectory stuff // get next imagedirectory that holds at least one image for a fileitem - // * m_pFile: the file we're looking images for + // * the file we're looking images for private void GetNextThumbFolderIndex(FileItem fileItem) { if (fileItem == null) return; + bool foundThumb = false; + while (!foundThumb) { thumbFolderIndex++; - if (thumbFolderIndex >= imageDirs.Length) + if (thumbFolderIndex >= imageDirsSplitted.Length) { thumbFolderIndex = -1; foundThumb = true; } else { - string candFolder = imageDirs[thumbFolderIndex]; + string candFolder = imageDirsSplitted[thumbFolderIndex]; string candThumb = candFolder + "\\" + Path.GetFileName(fileItem.Imagefile); if (candThumb.ToLower() != fileItem.Imagefile.ToLower()) { @@ -1007,7 +1084,7 @@ } else { - string curFolder = imageDirs[thumbFolderIndex]; + string curFolder = imageDirsSplitted[thumbFolderIndex]; curThumb = curFolder + "\\" + Path.GetFileName(fileItem.Imagefile); } @@ -1073,56 +1150,6 @@ #endregion - public void LoadFromXmlProfile(XmlNode node) - { - - XmlNode titleNode = node.SelectSingleNode("title"); - if (titleNode != null) - { - this.Title = titleNode.InnerText; - } - - XmlNode launchingAppNode = node.SelectSingleNode("launchingApplication"); - if (launchingAppNode != null) - { - this.Filename = launchingAppNode.InnerText; - } - - XmlNode useShellExecuteNode = node.SelectSingleNode("useShellExecute"); - if (useShellExecuteNode != null) - { - this.UseShellExecute = ProgramUtils.StrToBoolean(useShellExecuteNode.InnerText); - } - - XmlNode argumentsNode = node.SelectSingleNode("arguments"); - if (argumentsNode != null) - { - this.Arguments = argumentsNode.InnerText; - } - - XmlNode windowStyleNode = node.SelectSingleNode("windowStyle"); - if (windowStyleNode != null) - { - this.WindowStyle = ProgramUtils.StringToWindowStyle(windowStyleNode.InnerText); - } - - XmlNode startupDirNode = node.SelectSingleNode("startupDir"); - if (startupDirNode != null) - { - this.StartupDir = startupDirNode.InnerText; - } - - XmlNode useQuotesNode = node.SelectSingleNode("useQuotes"); - if (useQuotesNode != null) - { - this.UseQuotes = ProgramUtils.StrToBoolean(useQuotesNode.InnerText); - } - - XmlNode fileExtensioneNode = node.SelectSingleNode("fileextensions"); - if (fileExtensioneNode != null) - { - this.ValidExtensions = fileExtensioneNode.InnerText; - } - } + } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-19 14:44:46 UTC (rev 846) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-19 23:23:20 UTC (rev 847) @@ -23,6 +23,9 @@ #endregion + + +#region Imports using System; using System.Collections; using System.Collections.Generic; @@ -35,9 +38,13 @@ using MediaPortal.Util; using GUIPrograms; +using GUIPrograms.Imports; using GUIPrograms.Database; -using GUIPrograms.Items; +using GUIPrograms.Items; + +#endregion Imports + namespace GUIPrograms.Items { /// <summary> @@ -45,268 +52,57 @@ /// </summary> public class ApplicationItemDirectoryCache : ApplicationItem { - GUIDialogProgress progressDialog = null; - public ApplicationItemDirectoryCache() { } - private void ShowProgressDialog() - { - progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); - progressDialog.ShowWaitCursor = true; - progressDialog.SetHeading(GUILocalizeStrings.Get(13014)); - progressDialog.SetLine(0, GUILocalizeStrings.Get(13014)); - progressDialog.SetLine(1, ""); - progressDialog.SetLine(2, ""); - progressDialog.StartModal(GetID); - progressDialog.Progress(); - } + #region ApplicationItem Overloads - private void CloseProgressDialog() + public override string DefaultFilepath() { - progressDialog.Close(); + return this.FileDirectory; } - private string GetThumbsFile(FileInfo file, string fileTitle) + public override bool ProfileLoadingAllowed() { - string thumbFolder = ""; - - if (imageDirs.Length > 0) - { - string mainImgFolder = ""; - - foreach (string imgFolder in imageDirs) - { - if (System.IO.Directory.Exists(imgFolder)) - { - mainImgFolder = imgFolder; - } - } - - if ("" != mainImgFolder) - { - string curDir = mainImgFolder + "\\"; - string filenameNoExtension = mainImgFolder + "\\" + file.Name; - filenameNoExtension = Path.ChangeExtension(filenameNoExtension, null); - filenameNoExtension = Path.GetFileNameWithoutExtension(filenameNoExtension); - - string[] exactMatchesJPG = Directory.GetFiles(curDir, filenameNoExtension + ".jpg"); - string[] exactMatchesGIF = Directory.GetFiles(curDir, filenameNoExtension + ".gif"); - string[] exactMatchesPNG = Directory.GetFiles(curDir, filenameNoExtension + ".png"); - if (exactMatchesJPG.Length > 0) - { - thumbFolder = exactMatchesJPG[0]; - } - else if (exactMatchesGIF.Length > 0) - { - thumbFolder = exactMatchesGIF[0]; - } - else if (exactMatchesPNG.Length > 0) - { ... [truncated message content] |
From: <nor...@us...> - 2007-08-20 08:53:12
|
Revision: 848 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=848&view=rev Author: northern_sky Date: 2007-08-20 01:53:11 -0700 (Mon, 20 Aug 2007) Log Message: ----------- fixed some validate stuff Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.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/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -145,6 +145,7 @@ { fileListView.EndUpdate(); } + SetupFileView(); SyncListViewButtons(); SyncFilePath(); } @@ -661,7 +662,7 @@ private void AppFilesView_Load(object sender, EventArgs e) { - toolTip.SetToolTip(fileDirTextBox, "Directorys to display in MediaPortal,seperate with ; \r\n(mandatory)"); + toolTip.SetToolTip(fileDirTextBox, "Directorys where to look for files ,seperate with ; \r\n(mandatory)"); toolTip.SetToolTip(fileExtensionsTextBox, "Only files with matching extensions will be displayed. \r\nSeparate several extension" + "s by a ; (.zip;.txt)\r\n(mandatory)"); toolTip.SetToolTip(imageDirsTextBox, "Optional directory where MediaPortal searches for matching images. \r\n MediaPort" + Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -81,7 +81,7 @@ } - public override bool EntriesOK(ApplicationItem curApp) + public override bool ValidateEntries(ApplicationItem curApp) { conditionChecker.Clear(); conditionChecker.DoCheck(titleTextBox.Text != "", "No title entered!"); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -80,13 +80,15 @@ } - public override bool EntriesOK(ApplicationItem curApp) + public override bool ValidateEntries(ApplicationItem curApp) { conditionChecker.Clear(); - conditionChecker.DoCheck(this.titleTextBox.Text != "", "No title entered!"); + + conditionChecker.DoCheck(titleTextBox.Text != "", "No title entered!"); + if (this.applicationExeTextBox.Text == "") { - conditionChecker.DoCheck(this.shellexecuteCheckBox.Checked, "No launching filename entered!"); + conditionChecker.DoCheck(shellexecuteCheckBox.Checked, "No launching filename entered!"); } if (!conditionChecker.IsOk) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -59,7 +59,28 @@ curApp.RefreshGUIAllowed = true; } + public override bool ValidateEntries(ApplicationItem curApp) + { + conditionChecker.Clear(); + conditionChecker.DoCheck(titleTextBox.Text != "", "No title entered!"); + + if (this.applicationExeTextBox.Text == "") + { + conditionChecker.DoCheck(shellexecuteCheckBox.Checked, "No launching filename entered!"); + } + + if (!conditionChecker.IsOk) + { + string strHeader = "The following entries are invalid: \r\n\r\n"; + string strFooter = "\r\n\r\n(Click DELETE to remove this item)"; + MessageBox.Show(strHeader + conditionChecker.Problems + strFooter, "Invalid Entries"); + } + else + { } + return conditionChecker.IsOk; + } + void catverLink_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { LaunchLink(catverLink.Text); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -63,9 +63,9 @@ //Log.Debug("{0}: SaveSettings()", this.ToString()); } - public virtual bool EntriesOK(ApplicationItem curApp) + public virtual bool ValidateEntries(ApplicationItem curApp) { - //Log.Debug("{0}: EntriesOK()", this.ToString()); + //Log.Debug("{0}: ValidateEntries()", this.ToString()); return true; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -28,441 +28,443 @@ /// </summary> private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode( "Applications" ); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.applicationWithFiledirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addGroupnodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.extendedApplicationItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.mameImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importGamebaseItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.premadeConfigurationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.emulatorSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.treeView = new System.Windows.Forms.TreeView(); - this.tabControl = new System.Windows.Forms.TabControl(); - this.detailsTabPage = new System.Windows.Forms.TabPage(); - this.directoryTabPage = new System.Windows.Forms.TabPage(); - this.viewTabPage = new System.Windows.Forms.TabPage(); - this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); - this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); - this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); - this.removePlatformLabel = new System.Windows.Forms.Label(); - this.removePlatformButton = new System.Windows.Forms.Button(); - this.addPlatformLabel = new System.Windows.Forms.Label(); - this.addPlatformTextBox = new System.Windows.Forms.TextBox(); - this.addPlatformButton = new System.Windows.Forms.Button(); - this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); - this.removeManufacturerLabel = new System.Windows.Forms.Label(); - this.removeManufacturerButton = new System.Windows.Forms.Button(); - this.addManufacturerLabel = new System.Windows.Forms.Label(); - this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); - this.addManufacturerButton = new System.Windows.Forms.Button(); - this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); - this.removeGenreLabel = new System.Windows.Forms.Label(); - this.removeGenreButton = new System.Windows.Forms.Button(); - this.addGenreLabel = new System.Windows.Forms.Label(); - this.addGenreTextBox = new System.Windows.Forms.TextBox(); - this.addGenreButton = new System.Windows.Forms.Button(); - this.menuStrip.SuspendLayout(); - this.tabControl.SuspendLayout(); - this.dbOptionsTabPage.SuspendLayout(); - this.generalFileItemOptionsGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip - // - this.menuStrip.Items.AddRange( new System.Windows.Forms.ToolStripItem[] { + System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Applications"); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.applicationWithFiledirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addGroupnodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.extendedApplicationItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mameImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importGamebaseItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.premadeConfigurationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.emulatorSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.treeView = new System.Windows.Forms.TreeView(); + this.tabControl = new System.Windows.Forms.TabControl(); + this.detailsTabPage = new System.Windows.Forms.TabPage(); + this.directoryTabPage = new System.Windows.Forms.TabPage(); + this.viewTabPage = new System.Windows.Forms.TabPage(); + this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); + this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); + this.removePlatformLabel = new System.Windows.Forms.Label(); + this.removePlatformButton = new System.Windows.Forms.Button(); + this.addPlatformLabel = new System.Windows.Forms.Label(); + this.addPlatformTextBox = new System.Windows.Forms.TextBox(); + this.addPlatformButton = new System.Windows.Forms.Button(); + this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.removeManufacturerLabel = new System.Windows.Forms.Label(); + this.removeManufacturerButton = new System.Windows.Forms.Button(); + this.addManufacturerLabel = new System.Windows.Forms.Label(); + this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); + this.addManufacturerButton = new System.Windows.Forms.Button(); + this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); + this.removeGenreLabel = new System.Windows.Forms.Label(); + this.removeGenreButton = new System.Windows.Forms.Button(); + this.addGenreLabel = new System.Windows.Forms.Label(); + this.addGenreTextBox = new System.Windows.Forms.TextBox(); + this.addGenreButton = new System.Windows.Forms.Button(); + this.menuStrip.SuspendLayout(); + this.tabControl.SuspendLayout(); + this.dbOptionsTabPage.SuspendLayout(); + this.generalFileItemOptionsGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip + // + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addDeleteApplicationsToolStripMenuItem, - this.toolsStripMenuItem} ); - this.menuStrip.Location = new System.Drawing.Point( 0, 0 ); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.menuStrip.Size = new System.Drawing.Size( 747, 24 ); - this.menuStrip.TabIndex = 0; - this.menuStrip.Text = "menuStrip"; - // - // addDeleteApplicationsToolStripMenuItem - // - this.addDeleteApplicationsToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.toolsStripMenuItem}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.menuStrip.Size = new System.Drawing.Size(747, 24); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "menuStrip"; + // + // addDeleteApplicationsToolStripMenuItem + // + this.addDeleteApplicationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addApplicationToolStripMenuItem, - this.deleteApplicationToolStripMenuItem} ); - this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; - this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size( 132, 20 ); - this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; - // - // addApplicationToolStripMenuItem - // - this.addApplicationToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.deleteApplicationToolStripMenuItem}); + this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; + this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(146, 20); + this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; + // + // addApplicationToolStripMenuItem + // + this.addApplicationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.applicationWithFiledirectoryToolStripMenuItem, this.addGroupnodeToolStripMenuItem, - this.extendedApplicationItemToolStripMenuItem} ); - this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; - this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.addApplicationToolStripMenuItem.Text = "Add application"; - // - // applicationWithFiledirectoryToolStripMenuItem - // - this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; - this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); - this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; - this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler( this.applicationWithFiledirectoryToolStripMenuItem_Click ); - // - // addGroupnodeToolStripMenuItem - // - this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; - this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); - this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; - this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler( this.addGroupnodeToolStripMenuItem_Click ); - // - // extendedApplicationItemToolStripMenuItem - // - this.extendedApplicationItemToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { + this.extendedApplicationItemToolStripMenuItem}); + this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; + this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); + this.addApplicationToolStripMenuItem.Text = "Add application"; + // + // applicationWithFiledirectoryToolStripMenuItem + // + this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; + this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; + this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler(this.applicationWithFiledirectoryToolStripMenuItem_Click); + // + // addGroupnodeToolStripMenuItem + // + this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; + this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; + this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler(this.addGroupnodeToolStripMenuItem_Click); + // + // extendedApplicationItemToolStripMenuItem + // + this.extendedApplicationItemToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mameImportToolStripMenuItem, - this.importGamebaseItemToolStripMenuItem} ); - this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; - this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size( 207, 22 ); - this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; - // - // mameImportToolStripMenuItem - // - this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; - this.mameImportToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.mameImportToolStripMenuItem.Text = "Import Mame"; - this.mameImportToolStripMenuItem.Click += new System.EventHandler( this.mameImportToolStripMenuItem_Click ); - // - // importGamebaseItemToolStripMenuItem - // - this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; - this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; - this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler( this.importGamebaseItemToolStripMenuItem_Click ); - // - // deleteApplicationToolStripMenuItem - // - this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; - this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; - this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size( 170, 22 ); - this.deleteApplicationToolStripMenuItem.Text = "Delete application"; - this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler( this.deleteApplicationToolStripMenuItem_Click ); - // - // toolsStripMenuItem - // - this.toolsStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { - this.premadeConfigurationsToolStripMenuItem} ); - this.toolsStripMenuItem.Name = "toolsStripMenuItem"; - this.toolsStripMenuItem.Size = new System.Drawing.Size( 44, 20 ); - this.toolsStripMenuItem.Text = "Tools"; - // - // premadeConfigurationsToolStripMenuItem - // - this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] { - this.emulatorSetupToolStripMenuItem} ); - this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; - this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size( 155, 22 ); - this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; - // - // emulatorSetupToolStripMenuItem - // - this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; - this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size( 158, 22 ); - this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; - // - // treeView - // - this.treeView.AllowDrop = true; - this.treeView.HideSelection = false; - this.treeView.HotTracking = true; - this.treeView.LabelEdit = true; - this.treeView.Location = new System.Drawing.Point( 0, 27 ); - this.treeView.Name = "treeView"; - treeNode1.Name = "applicationNode"; - treeNode1.Text = "Applications"; - this.treeView.Nodes.AddRange( new System.Windows.Forms.TreeNode[] { - treeNode1} ); - this.treeView.Size = new System.Drawing.Size( 224, 576 ); - this.treeView.TabIndex = 8; - this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler( this.treeView_DragDrop ); - this.treeView.DragOver += new System.Windows.Forms.DragEventHandler( this.treeView_DragOver ); - this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler( this.treeView_AfterLabelEdit ); - this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler( this.treeView_AfterSelect ); - this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler( this.treeView_NodeMouseClick ); - this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler( this.treeView_DragEnter ); - this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler( this.treeView_BeforeLabelEdit ); - this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler( this.treeView_BeforeSelect ); - this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler( this.treeView_ItemDrag ); - // - // tabControl - // - this.tabControl.Controls.Add( this.detailsTabPage ); - this.tabControl.Controls.Add( this.directoryTabPage ); - this.tabControl.Controls.Add( this.viewTabPage ); - this.tabControl.Controls.Add( this.dbOptionsTabPage ); - this.tabControl.Location = new System.Drawing.Point( 230, 27 ); - this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 0; - this.tabControl.ShowToolTips = true; - this.tabControl.Size = new System.Drawing.Size( 505, 577 ); - this.tabControl.TabIndex = 2; - this.tabControl.Click += new System.EventHandler( this.dbOptionsTabPage_Click ); - this.tabControl.SelectedIndexChanged += new System.EventHandler( this.tabControl_SelectedIndexChanged ); - // - // detailsTabPage - // - this.detailsTabPage.BackColor = System.Drawing.SystemColors.Control; - this.detailsTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.detailsTabPage.Name = "detailsTabPage"; - this.detailsTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.detailsTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.detailsTabPage.TabIndex = 0; - this.detailsTabPage.Text = "Details"; - // - // directoryTabPage - // - this.directoryTabPage.BackColor = System.Drawing.SystemColors.Control; - this.directoryTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.directoryTabPage.Name = "directoryTabPage"; - this.directoryTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.directoryTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.directoryTabPage.TabIndex = 1; - this.directoryTabPage.Text = "Files"; - // - // viewTabPage - // - this.viewTabPage.BackColor = System.Drawing.SystemColors.Control; - this.viewTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.viewTabPage.Name = "viewTabPage"; - this.viewTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.viewTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.viewTabPage.TabIndex = 2; - this.viewTabPage.Text = "Views"; - // - // dbOptionsTabPage - // - this.dbOptionsTabPage.Controls.Add( this.generalFileItemOptionsGroupBox ); - this.dbOptionsTabPage.Location = new System.Drawing.Point( 4, 22 ); - this.dbOptionsTabPage.Name = "dbOptionsTabPage"; - this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding( 3 ); - this.dbOptionsTabPage.Size = new System.Drawing.Size( 497, 551 ); - this.dbOptionsTabPage.TabIndex = 3; - this.dbOptionsTabPage.Text = "DB options"; - this.dbOptionsTabPage.UseVisualStyleBackColor = true; - this.dbOptionsTabPage.Click += new System.EventHandler( this.dbOptionsTabPage_Click ); - // - // generalFileItemOptionsGroupBox - // - this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformComboBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removePlatformButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformTextBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addPlatformButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerComboBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeManufacturerButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerTextBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addManufacturerButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreComboBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.removeGenreButton ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreLabel ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreTextBox ); - this.generalFileItemOptionsGroupBox.Controls.Add( this.addGenreButton ); - this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point( 3, 6 ); - this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; - this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size( 488, 496 ); - this.generalFileItemOptionsGroupBox.TabIndex = 79; - this.generalFileItemOptionsGroupBox.TabStop = false; - // - // removePlatformComboBox - // - this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removePlatformComboBox.FormattingEnabled = true; - this.removePlatformComboBox.Location = new System.Drawing.Point( 99, 249 ); - this.removePlatformComboBox.Name = "removePlatformComboBox"; - this.removePlatformComboBox.Size = new System.Drawing.Size( 306, 21 ); - this.removePlatformComboBox.TabIndex = 92; - // - // removePlatformLabel - // - this.removePlatformLabel.AutoSize = true; - this.removePlatformLabel.Location = new System.Drawing.Point( 6, 252 ); - this.removePlatformLabel.Name = "removePlatformLabel"; - this.removePlatformLabel.Size = new System.Drawing.Size( 87, 13 ); - this.removePlatformLabel.TabIndex = 91; - this.removePlatformLabel.Text = "Remove platform"; - // - // removePlatformButton - // - this.removePlatformButton.Location = new System.Drawing.Point( 411, 249 ); - this.removePlatformButton.Name = "removePlatformButton"; - this.removePlatformButton.Size = new System.Drawing.Size( 62, 23 ); - this.removePlatformButton.TabIndex = 90; - this.removePlatformButton.Text = "Remove.."; - this.removePlatformButton.UseVisualStyleBackColor = true; - this.removePlatformButton.Click += new System.EventHandler( this.removePlatformButton_Click ); - // - // addPlatformLabel - // - this.addPlatformLabel.AutoSize = true; - this.addPlatformLabel.Location = new System.Drawing.Point( 6, 216 ); - this.addPlatformLabel.Name = "addPlatformLabel"; - this.addPlatformLabel.Size = new System.Drawing.Size( 72, 13 ); - this.addPlatformLabel.TabIndex = 87; - this.addPlatformLabel.Text = "Add platform.."; - // - // addPlatformTextBox - // - this.addPlatformTextBox.Location = new System.Drawing.Point( 99, 213 ); - this.addPlatformTextBox.Name = "addPlatformTextBox"; - this.addPlatformTextBox.Size = new System.Drawing.Size( 306, 20 ); - this.addPlatformTextBox.TabIndex = 88; - // - // addPlatformButton - // - this.addPlatformButton.Location = new System.Drawing.Point( 411, 213 ); - this.addPlatformButton.Name = "addPlatformButton"; - this.addPlatformButton.Size = new System.Drawing.Size( 62, 23 ); - this.addPlatformButton.TabIndex = 89; - this.addPlatformButton.Text = "Add.."; - this.addPlatformButton.UseVisualStyleBackColor = true; - this.addPlatformButton.Click += new System.EventHandler( this.addPlatformButton_Click ); - // - // removeManufacturerComboBox - // - this.removeManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removeManufacturerComboBox.FormattingEnabled = true; - this.removeManufacturerComboBox.Location = new System.Drawing.Point( 99, 165 ); - this.removeManufacturerComboBox.Name = "removeManufacturerComboBox"; - this.removeManufacturerComboBox.Size = new System.Drawing.Size( 306, 21 ); - this.removeManufacturerComboBox.TabIndex = 86; - // - // removeManufacturerLabel - // - this.removeManufacturerLabel.Location = new System.Drawing.Point( 6, 157 ); - this.removeManufacturerLabel.Name = "removeManufacturerLabel"; - this.removeManufacturerLabel.Size = new System.Drawing.Size( 82, 29 ); - this.removeManufacturerLabel.TabIndex = 85; - this.removeManufacturerLabel.Text = "Remove Manufacturer"; - // - // removeManufacturerButton - // - this.removeManufacturerButton.Location = new System.Drawing.Point( 411, 165 ); - this.removeManufacturerButton.Name = "removeManufacturerButton"; - this.removeManufacturerButton.Size = new System.Drawing.Size( 62, 23 ); - this.removeManufacturerButton.TabIndex = 84; - this.removeManufacturerButton.Text = "Remove.."; - this.removeManufacturerButton.UseVisualStyleBackColor = true; - this.removeManufacturerButton.Click += new System.EventHandler( this.removeManufacturerButton_Click ); - // - // addManufacturerLabel - // - this.addManufacturerLabel.Location = new System.Drawing.Point( 6, 121 ); - this.addManufacturerLabel.Name = "addManufacturerLabel"; - this.addManufacturerLabel.Size = new System.Drawing.Size( 82, 36 ); - this.addManufacturerLabel.TabIndex = 81; - this.addManufacturerLabel.Text = "Add Manufacturer.."; - // - // addManufacturerTextBox - // - this.addManufacturerTextBox.Location = new System.Drawing.Point( 99, 129 ); - this.addManufacturerTextBox.Name = "addManufacturerTextBox"; - this.addManufacturerTextBox.Size = new System.Drawing.Size( 306, 20 ); - this.addManufacturerTextBox.TabIndex = 82; - // - // addManufacturerButton - // - this.addManufacturerButton.Location = new System.Drawing.Point( 411, 129 ); - this.addManufacturerButton.Name = "addManufacturerButton"; - this.addManufacturerButton.Size = new System.Drawing.Size( 62, 23 ); - this.addManufacturerButton.TabIndex = 83; - this.addManufacturerButton.Text = "Add.."; - this.addManufacturerButton.UseVisualStyleBackColor = true; - this.addManufacturerButton.Click += new System.EventHandler( this.addManufacturerButton_Click ); - // - // removeGenreComboBox - // - this.removeGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.removeGenreComboBox.FormattingEnabled = true; - this.removeGenreComboBox.Location = new System.Drawing.Point( 99, 70 ); - this.removeGenreComboBox.Name = "removeGenreComboBox"; - this.removeGenreComboBox.Size = new System.Drawing.Size( 306, 21 ); - this.removeGenreComboBox.TabIndex = 80; - // - // removeGenreLabel - // - this.removeGenreLabel.AutoSize = true; - this.removeGenreLabel.Location = new System.Drawing.Point( 6, 73 ); - this.removeGenreLabel.Name = "removeGenreLabel"; - this.removeGenreLabel.Size = new System.Drawing.Size( 77, 13 ); - this.removeGenreLabel.TabIndex = 79; - this.removeGenreLabel.Text = "Remove genre"; - // - // removeGenreButton - // - this.removeGenreButton.Location = new System.Drawing.Point( 411, 70 ); - this.removeGenreButton.Name = "removeGenreButton"; - this.removeGenreButton.Size = new System.Drawing.Size( 62, 23 ); - this.removeGenreButton.TabIndex = 78; - this.removeGenreButton.Text = "Remove.."; - this.removeGenreButton.UseVisualStyleBackColor = true; - this.removeGenreButton.Click += new System.EventHandler( this.removeGenreButton_Click ); - // - // addGenreLabel - // - this.addGenreLabel.AutoSize = true; - this.addGenreLabel.Location = new System.Drawing.Point( 6, 37 ); - this.addGenreLabel.Name = "addGenreLabel"; - this.addGenreLabel.Size = new System.Drawing.Size( 62, 13 ); - this.addGenreLabel.TabIndex = 74; - this.addGenreLabel.Text = "Add genre.."; - // - // addGenreTextBox - // - this.addGenreTextBox.Location = new System.Drawing.Point( 99, 34 ); - this.addGenreTextBox.Name = "addGenreTextBox"; - this.addGenreTextBox.Size = new System.Drawing.Size( 306, 20 ); - this.addGenreTextBox.TabIndex = 75; - // - // addGenreButton - // - this.addGenreButton.Location = new System.Drawing.Point( 411, 34 ); - this.addGenreButton.Name = "addGenreButton"; - this.addGenreButton.Size = new System.Drawing.Size( 62, 23 ); - this.addGenreButton.TabIndex = 76; - this.addGenreButton.Text = "Add.."; - this.addGenreButton.UseVisualStyleBackColor = true; - this.addGenreButton.Click += new System.EventHandler( this.addGenreButton_Click ); - // - // SetupForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F ); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size( 747, 609 ); - this.Controls.Add( this.tabControl ); - this.Controls.Add( this.treeView ); - this.Controls.Add( this.menuStrip ); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MainMenuStrip = this.menuStrip; - this.Name = "SetupForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "SetupForm"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler( this.SetupForm_FormClosed ); - this.Load += new System.EventHandler( this.SetupForm_Load ); - this.menuStrip.ResumeLayout( false ); - this.menuStrip.PerformLayout(); - this.tabControl.ResumeLayout( false ); - this.dbOptionsTabPage.ResumeLayout( false ); - this.generalFileItemOptionsGroupBox.ResumeLayout( false ); - this.generalFileItemOptionsGroupBox.PerformLayout(); - this.ResumeLayout( false ); - this.PerformLayout(); + this.importGamebaseItemToolStripMenuItem}); + this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; + this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; + // + // mameImportToolStripMenuItem + // + this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; + this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(168, 22); + this.mameImportToolStripMenuItem.Text = "Import Mame"; + this.mameImportToolStripMenuItem.Click += new System.EventHandler(this.mameImportToolStripMenuItem_Click); + // + // importGamebaseItemToolStripMenuItem + // + this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; + this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(168, 22); + this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; + this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler(this.importGamebaseItemToolStripMenuItem_Click); + // + // deleteApplicationToolStripMenuItem + // + this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; + this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; + this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); + this.deleteApplicationToolStripMenuItem.Text = "Delete application"; + this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler(this.deleteApplicationToolStripMenuItem_Click); + // + // toolsStripMenuItem + // + this.toolsStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.premadeConfigurationsToolStripMenuItem}); + this.toolsStripMenuItem.Name = "toolsStripMenuItem"; + this.toolsStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.toolsStripMenuItem.Text = "Tools"; + // + // premadeConfigurationsToolStripMenuItem + // + this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.emulatorSetupToolStripMenuItem}); + this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; + this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(153, 22); + this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; + // + // emulatorSetupToolStripMenuItem + // + this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; + this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(155, 22); + this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; + // + // treeView + // + this.treeView.AllowDrop = true; + this.treeView.HideSelection = false; + this.treeView.HotTracking = true; + this.treeView.LabelEdit = true; + this.treeView.Location = new System.Drawing.Point(0, 27); + this.treeView.Name = "treeView"; + treeNode4.Name = "applicationNode"; + treeNode4.Text = "Applications"; + this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { + treeNode4}); + this.treeView.Size = new System.Drawing.Size(224, 576); + this.treeView.TabIndex = 8; + this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); + this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); + this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_AfterLabelEdit); + this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); + this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); + this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter); + this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_BeforeLabelEdit); + this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeSelect); + this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag); + // + // tabControl + // + this.tabControl.Controls.Add(this.detailsTabPage); + this.tabControl.Controls.Add(this.directoryTabPage); + this.tabControl.Controls.Add(this.viewTabPage); + this.tabControl.Controls.Add(this.dbOptionsTabPage); + this.tabControl.Location = new System.Drawing.Point(230, 27); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.ShowToolTips = true; + this.tabControl.Size = new System.Drawing.Size(505, 577); + this.tabControl.TabIndex = 2; + this.tabControl.Click += new System.EventHandler(this.dbOptionsTabPage_Click); + this.tabControl.Deselecting += new System.Windows.Forms.TabControlCancelEventHandler(this.tabControl_Deselecting); + + // + // detailsTabPage + // + this.detailsTabPage.BackColor = System.Drawing.SystemColors.Control; + this.detailsTabPage.Location = new System.Drawing.Point(4, 22); + this.detailsTabPage.Name = "detailsTabPage"; + this.detailsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.detailsTabPage.Size = new System.Drawing.Size(497, 551); + this.detailsTabPage.TabIndex = 0; + this.detailsTabPage.Text = "Details"; + // + // directoryTabPage + // + this.directoryTabPage.BackColor = System.Drawing.SystemColors.Control; + this.directoryTabPage.Location = new System.Drawing.Point(4, 22); + this.directoryTabPage.Name = "directoryTabPage"; + this.directoryTabPage.Padding = new System.Windows.Forms.Padding(3); + this.directoryTabPage.Size = new System.Drawing.Size(497, 551); + this.directoryTabPage.TabIndex = 1; + this.directoryTabPage.Text = "Files"; + // + // viewTabPage + // + this.viewTabPage.BackColor = System.Drawing.SystemColors.Control; + this.viewTabPage.Location = new System.Drawing.Point(4, 22); + this.viewTabPage.Name = "viewTabPage"; + this.viewTabPage.Padding = new System.Windows.Forms.Padding(3); + this.viewTabPage.Size = new System.Drawing.Size(497, 551); + this.viewTabPage.TabIndex = 2; + this.viewTabPage.Text = "Views"; + // + // dbOptionsTabPage + // + this.dbOptionsTabPage.Controls.Add(this.generalFileItemOptionsGroupBox); + this.dbOptionsTabPage.Location = new System.Drawing.Point(4, 22); + this.dbOptionsTabPage.Name = "dbOptionsTabPage"; + this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.dbOptionsTabPage.Size = new System.Drawing.Size(497, 551); + this.dbOptionsTabPage.TabIndex = 3; + this.dbOptionsTabPage.Text = "DB options"; + this.dbOptionsTabPage.UseVisualStyleBackColor = true; + this.dbOptionsTabPage.Click += new System.EventHandler(this.dbOptionsTabPage_Click); + // + // generalFileItemOptionsGroupBox + // + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); + this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(3, 6); + this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; + this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(488, 496); + this.generalFileItemOptionsGroupBox.TabIndex = 79; + this.generalFileItemOptionsGroupBox.TabStop = false; + // + // removePlatformComboBox + // + this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removePlatformComboBox.FormattingEnabled = true; + this.removePlatformComboBox.Location = new System.Drawing.Point(99, 249); + this.removePlatformComboBox.Name = "removePlatformComboBox"; + this.removePlatformComboBox.Size = new System.Drawing.Size(306, 21); + this.removePlatformComboBox.TabIndex = 92; + // + // removePlatformLabel + // + this.removePlatformLabel.AutoSize = true; + this.removePlatformLabel.Location = new System.Drawing.Point(6, 252); + this.removePlatformLabel.Name = "removePlatformLabel"; + this.removePlatformLabel.Size = new System.Drawing.Size(87, 13); + this.removePlatformLabel.TabIndex = 91; + this.removePlatformLabel.Text = "Remove platform"; + // + // removePlatformButton + // + this.removePlatformButton.Location = new System.Drawing.Point(411, 249); + this.removePlatformButton.Name = "removePlatformButton"; + this.removePlatformButton.Size = new System.Drawing.Size(62, 23); + this.removePlatformButton.TabIndex = 90; + this.removePlatformButton.Text = "Remove.."; + this.removePlatformButton.UseVisualStyleBackColor = true; + this.removePlatformButton.Click += new System.EventHandler(this.removePlatformButton_Click); + // + // addPlatformLabel + // + this.addPlatformLabel.AutoSize = true; + this.addPlatformLabel.Location = new System.Drawing.Point(6, 216); + this.addPlatformLabel.Name = "addPlatformLabel"; + this.addPlatformLabel.Size = new System.Drawing.Size(72, 13); + this.addPlatformLabel.TabIndex = 87; + this.addPlatformLabel.Text = "Add platform.."; + // + // addPlatformTextBox + // + this.addPlatformTextBox.Location = new System.Drawing.Point(99, 213); + this.addPlatformTextBox.Name = "addPlatformTextBox"; + this.addPlatformTextBox.Size = new System.Drawing.Size(306, 20); + this.addPlatformTextBox.TabIndex = 88; + // + // addPlatformButton + // + this.addPlatformButton.Location = new System.Drawing.Point(411, 213); + this.addPlatformButton.Name = "addPlatformButton"; + this.addPlatformButton.Size = new System.Drawing.Size(62, 23); + this.addPlatformButton.TabIndex = 89; + this.addPlatformButton.Text = "Add.."; + this.addPlatformButton.UseVisualStyleBackColor = true; + this.addPlatformButton.Click += new System.EventHandler(this.addPlatformButton_Click); + // + // removeManufacturerComboBox + // + this.removeManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removeManufacturerComboBox.FormattingEnabled = true; + this.removeManufacturerComboBox.Location = new System.Drawing.Point(99, 165); + this.removeManufacturerComboBox.Name = "removeManufacturerComboBox"; + this.removeManufacturerComboBox.Size = new System.Drawing.Size(306, 21); + this.removeManufacturerComboBox.TabIndex = 86; + // + // removeManufacturerLabel + // + this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); + this.removeManufacturerLabel.Name = "removeManufacturerLabel"; + this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); + this.removeManufacturerLabel.TabIndex = 85; + this.removeManufacturerLabel.Text = "Remove Manufacturer"; + // + // removeManufacturerButton + // + this.removeManufacturerButton.Location = new System.Drawing.Point(411, 165); + this.removeManufacturerButton.Name = "removeManufacturerButton"; + this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.removeManufacturerButton.TabIndex = 84; + this.removeManufacturerButton.Text = "Remove.."; + this.removeManufacturerButton.UseVisualStyleBackColor = true; + this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); + // + // addManufacturerLabel + // + this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); + this.addManufacturerLabel.Name = "addManufacturerLabel"; + this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); + this.addManufacturerLabel.TabIndex = 81; + this.addManufacturerLabel.Text = "Add Manufacturer.."; + // + // addManufacturerTextBox + // + this.addManufacturerTextBox.Location = new System.Drawing.Point(99, 129); + this.addManufacturerTextBox.Name = "addManufacturerTextBox"; + this.addManufacturerTextBox.Size = new System.Drawing.Size(306, 20); + this.addManufacturerTextBox.TabIndex = 82; + // + // addManufacturerButton + // + this.addManufacturerButton.Location = new System.Drawing.Point(411, 129); + this.addManufacturerButton.Name = "addManufacturerButton"; + this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.addManufacturerButton.TabIndex = 83; + this.addManufacturerButton.Text = "Add.."; + this.addManufacturerButton.UseVisualStyleBackColor = true; + this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); + // + // removeGenreComboBox + // + this.removeGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removeGenreComboBox.FormattingEnabled = true; + this.removeGenreComboBox.Location = new System.Drawing.Point(99, 70); + this.removeGenreComboBox.Name = "removeGenreComboBox"; + this.removeGenreComboBox.Size = new System.Drawing.Size(306, 21); + this.removeGenreComboBox.TabIndex = 80; + // + // removeGenreLabel + // + this.removeGenreLabel.AutoSize = true; + this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); + this.removeGenreLabel.Name = "removeGenreLabel"; + this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); + this.removeGenreLabel.TabIndex = 79; + this.removeGenreLabel.Text = "Remove genre"; + // + // removeGenreButton + // + this.removeGenreButton.Location = new System.Drawing.Point(411, 70); + this.removeGenreButton.Name = "removeGenreButton"; + this.removeGenreButton.Size = new System.Drawing.Size(62, 23); + this.removeGenreButton.TabIndex = 78; + this.removeGenreButton.Text = "Remove.."; + this.removeGenreButton.UseVisualStyleBackColor = true; + this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); + // + // addGenreLabel + // + this.addGenreLabel.AutoSize = true; + this.addGenreLabel.Location = new System.Drawing.Point(6, 37); + this.addGenreLabel.Name = "addGenreLabel"; + this.addGenreLabel.Size = new System.Drawing.Size(62, 13); + this.addGenreLabel.TabIndex = 74; + this.addGenreLabel.Text = "Add genre.."; + // + // addGenreTextBox + // + this.addGenreTextBox.Location = new System.Drawing.Point(99, 34); + this.addGenreTextBox.Name = "addGenreTextBox"; + this.addGenreTextBox.Size = new System.Drawing.Size(306, 20); + this.addGenreTextBox.TabIndex = 75; + // + // addGenreButton + // + this.addGenreButton.Location = new System.Drawing.Point(411, 34); + this.addGenreButton.Name = "addGenreButton"; + this.addGenreButton.Size = new System.Drawing.Size(62, 23); + this.addGenreButton.TabIndex = 76; + this.addGenreButton.Text = "Add.."; + this.addGenreButton.UseVisualStyleBackColor = true; + this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); + // + // SetupForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(747, 609); + this.Controls.Add(this.tabControl); + this.Controls.Add(this.treeView); + this.Controls.Add(this.menuStrip); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MainMenuStrip = this.menuStrip; + this.Name = "SetupForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SetupForm"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SetupForm_FormClosed); + this.Load += new System.EventHandler(this.SetupForm_Load); + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + this.tabControl.ResumeLayout(false); + this.dbOptionsTabPage.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -43,6 +43,7 @@ private bool profilesIsLoaded = false; private const string ROOTNODENAME = "Applications"; private const int POSITIONHOLDER = 10; + private int previousSelectedTabIndex = 0; #endregion @@ -470,7 +471,7 @@ return false; } - if (pageCurrentSettings.EntriesOK(currentApplication)) + if (pageCurrentSettings.ValidateEntries(currentApplication)) { if (appSettingsFileEditView.EntriesOK()) { @@ -696,8 +697,6 @@ private void SetupForm_Load(object sender, EventArgs e) { - - AttachFilesView(); AttachProgramsView(); UpdateTree(); @@ -893,24 +892,7 @@ treeView.SelectedNode = treeView.GetNodeAt(targetPoint); } - private void tabControl_SelectedIndexChanged(object sender, EventArgs e) - { - // save current applicationItem if switching to file-tab - if (tabControl.SelectedIndex == 1) - { - appSettingsFileEditView.SetupFileView(); - if (!SaveAppItem()) - { - tabControl.SelectedIndex = 0; - } - } - // save current applicationItem if switching from filesview to file-tab - if (tabControl.SelectedIndex == 0) - { - SaveAppItem(); - } - } private void SetupForm_FormClosed(object sender, FormClosedEventArgs e) { @@ -918,7 +900,7 @@ pageCurrentSettings = GetCurrentSettingsPage(); if (pageCurrentSettings != null) { - if (pageCurrentSettings.EntriesOK(currentApplication)) + if (pageCurrentSettings.ValidateEntries(currentApplication)) { pageCurrentSettings.SaveSettings(currentApplication); if (currentApplication != null) @@ -1161,6 +1143,18 @@ UpdateComboBoxes(); } - + + + private void tabControl_Deselecting(object sender, TabControlCancelEventArgs e) + { + // validate when leaving + if (tabControl.SelectedIndex == 0) + { + if (!SaveAppItem()) + { + e.Cancel = true; + } + } + } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -30,7 +30,6 @@ OnReadNewFile -= new MyEventHandler(applicationItem.ReadNewFile); } - private void ImportFileItem(FileInfo fileInfo) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -72,7 +72,6 @@ public MameImport(ApplicationItem applicationItem) { - currentApplication = applicationItem; OnReadNewFile += new MyEventHandler(currentApplication.ReadNewFile); } @@ -324,8 +323,6 @@ int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblManufacturer", "manufacturer", match.Groups["manufacturer"].Value); curFile.ManufacturerId = LexiconId; - - } mameHistoryNode = null; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -68,7 +68,6 @@ public override void Refresh(bool mpGuiMode) { - base.Refresh(mpGuiMode); Import(mpGuiMode); FixFileLinks(); LoadFiles(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -77,7 +77,6 @@ public override void Refresh(bool bGUIMode) { - base.Refresh(bGUIMode); DeleteFiles(); Import(bGUIMode); FixFileLinks(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -88,9 +88,9 @@ } + public override void Refresh(bool bGUIMode) { - base.Refresh(bGUIMode); DeleteFiles(); Import(bGUIMode); FixFileLinks(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-19 23:23:20 UTC (rev 847) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-20 08:53:11 UTC (rev 848) @@ -78,36 +78,30 @@ public FileItem() { - SetDefaultValues(); + fileID = -1; + appID = -1; + title = ""; + filename = ""; + imagefile = ""; + genreId = 1; + genreStyleId = 1; + country = ""; + manufacturer = ""; + manufacturerId = 1; + year = 1900; + rating = 5; + overview = ""; + platform = ""; + platformId = 1; + //isFolder = false; + lastT... [truncated message content] |