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. |