From: <Chr...@us...> - 2008-03-25 08:02:48
|
Revision: 1511 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1511&view=rev Author: Chreekar Date: 2008-03-25 01:02:43 -0700 (Tue, 25 Mar 2008) Log Message: ----------- execute PC games, ROMItem has a field for genre Modified Paths: -------------- trunk/plugins/MyEmulators/Readme.txt trunk/plugins/MyEmulators/myEmulators/Class1.cs trunk/plugins/MyEmulators/myEmulators/DB.cs trunk/plugins/MyEmulators/myEmulators/Emulator.cs trunk/plugins/MyEmulators/myEmulators/Properties/AssemblyInfo.cs trunk/plugins/MyEmulators/myEmulators/ROMItem.cs trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs trunk/plugins/MyEmulators/myEmulators/setupForm.cs trunk/plugins/MyEmulators/myEmulators/setupForm.resx trunk/plugins/MyEmulators/output.rar Modified: trunk/plugins/MyEmulators/Readme.txt =================================================================== --- trunk/plugins/MyEmulators/Readme.txt 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/Readme.txt 2008-03-25 08:02:43 UTC (rev 1511) @@ -6,6 +6,17 @@ CHANGELOG ------------------------------------------- +v1.9 +-Execute PC games, or other programs without + arguments. See USAGE below for instructions. +-Support for using .bat files as emulators +-Added a column for genre, or type of game, + which can be used to filter games via the + context menu in MP. The translation files + will have to be updated with two new + strings, shown in the TRANSLATION section + below. + v1.8 -A couple more skin files are now included -More flexible passing of arguments, see USAGE @@ -110,6 +121,14 @@ By pressing a ROM, that one is loaded in the correct emulator. +To execute PC games or other programs dir- +ectly without arguments, check "Execute +without arguments" in that Emulator prop- +erties window. When the button corresponding +to that program is pressed in the main +screen of the plugin no list will be showed, +but instead the program will launch. + Whenever something is changed in the setup, a star in the title bar appears. After pres- sing Apply, the ROM database will be updated. @@ -161,6 +180,8 @@ Line 7 - Select grade for this game Line 8 - Set grade to Line 9 - No grade +Line 10 - Filter by genre +Line 11 - Show all Note that the setup is not translated, only the buttons in the main program. If you want Modified: trunk/plugins/MyEmulators/myEmulators/Class1.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/Class1.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/Class1.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -19,7 +19,7 @@ //To compare with the current marked private int previouslySelectedIndex; //Translation strings - private String[] translation = { "View: List", "View: Large Icons", "View: Icons", "Most played", "Recently played", "Top graded", "Select grade for this game", "Set grade to", "No grade" }; + private String[] translation = { "View: List", "View: Large Icons", "View: Icons", "Most played", "Recently played", "Top graded", "Select grade for this game", "Set grade to", "No grade", "Filter by genre", "Show all" }; //The header label [SkinControlAttribute(9)] protected GUILabelControl headerText = null; @@ -130,7 +130,7 @@ Emulator[] loaded = DB.loadEmus(); for (int i = 0; i < loaded.Length; i++) { - emulators.Add(new Emulator(loaded[i].getEmulator_path(), loaded[i].getROM_path(), loaded[i].getName(), loaded[i].getFilter(), loaded[i].isQuotesUsed(), loaded[i].View)); + emulators.Add(new Emulator(loaded[i].getEmulator_path(), loaded[i].getROM_path(), loaded[i].getName(), loaded[i].getFilter(), loaded[i].isQuotesUsed(), loaded[i].View, loaded[i].isNoArguments())); } _autoHideTopbar = true; _autoHideTopbarType = AutoHideTopBar.Yes; @@ -240,24 +240,49 @@ if (dlg != null) { dlg.Reset(); - dlg.SetHeading(translation[6]); - for (int i = 1; i < 11; i++) - { - dlg.Add(new GUIListItem(translation[7] + " " + i)); - } - dlg.Add(new GUIListItem(translation[8])); + dlg.SetHeading(Options.getStringOption("shown_name")); + dlg.Add(new GUIListItem(translation[6])); + dlg.Add(new GUIListItem(translation[9])); dlg.DoModal(GetID); - if (dlg.SelectedId > 0 && dlg.SelectedId <= 10) + //Set grade + if (dlg.SelectedId == 1) { - item.Grade = dlg.SelectedId; - DB.saveROM(item); - displayStars(dlg.SelectedId); + dlg.Reset(); + dlg.SetHeading(translation[6]); + for (int i = 1; i < 11; i++) + { + dlg.Add(new GUIListItem(translation[7] + " " + i)); + } + dlg.Add(new GUIListItem(translation[8])); + dlg.DoModal(GetID); + if (dlg.SelectedId > 0 && dlg.SelectedId <= 10) + { + item.Grade = dlg.SelectedId; + DB.saveROM(item); + displayStars(dlg.SelectedId); + } + else if (dlg.SelectedId == 11) + { + item.Grade = 0; + DB.saveROM(item); + displayStars(0); + } } - else if (dlg.SelectedId == 11) + //Filter by genre + else if (dlg.SelectedId == 2) { - item.Grade = 0; - DB.saveROM(item); - displayStars(0); + dlg.Reset(); + dlg.SetHeading(translation[9]); + dlg.Add(new GUIListItem(translation[10])); + String[] genres = DB.getGenres(); + for (int i = 0; i < genres.Length; i++) + { + dlg.Add(new GUIListItem(genres[i])); + } + dlg.DoModal(GetID); + + //TODO: Take action + } } } @@ -354,15 +379,30 @@ { //Checks which emulator has been selected indexOfEmulator = ((GUIFacadeControl)control).SelectedListItemIndex; - switch (emulators[indexOfEmulator].View) + //If it should be executed directly without arguments + if (emulators[indexOfEmulator].isNoArguments()) { - case (0): { lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; button_viewAs.Label = translation[1]; break; } - case (1): { lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; button_viewAs.Label = translation[2]; break; } - case (2): { lstEmulators.View = GUIFacadeControl.ViewMode.List; button_viewAs.Label = translation[0]; break; } + Log.Info("My Emulators - Executing: {0} without arguments", emulators[indexOfEmulator].getEmulator_path()); + System.Diagnostics.Process.Start(emulators[indexOfEmulator].getEmulator_path()); + if (Options.getBoolOption("shutdownonlaunch")) + { + Log.Info("My Emulators - Shutting down MediaPortal{0}", ""); + Application.Exit(); + } } - isInFolder = true; - //Fills the list with files from the directory - refreshROMList(true); + else + { + //Open the games associated with that emulator + switch (emulators[indexOfEmulator].View) + { + case (0): { lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; button_viewAs.Label = translation[1]; break; } + case (1): { lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; button_viewAs.Label = translation[2]; break; } + case (2): { lstEmulators.View = GUIFacadeControl.ViewMode.List; button_viewAs.Label = translation[0]; break; } + } + isInFolder = true; + //Fills the list with files from the directory + refreshROMList(true); + } } } //The buttons on the left have been pushed Modified: trunk/plugins/MyEmulators/myEmulators/DB.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/DB.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/DB.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -36,7 +36,7 @@ } //TODO: REMEMBER to put the correct version number! - private static int current_version = 180; + private static int current_version = 190; public static void launch() { @@ -79,7 +79,7 @@ SQLiteResultSet result = sqlDB.Execute("SELECT * FROM " + tableEmuName + ";"); for (int i = 0; i < result.Rows.Count; i++) { - Emulator item = new Emulator(result.GetField(i, 0), result.GetField(i, 1), result.GetField(i, 2), result.GetField(i, 3), Boolean.Parse(result.GetField(i, 4)), 2); + Emulator item = new Emulator(result.GetField(i, 0), result.GetField(i, 1), result.GetField(i, 2), result.GetField(i, 3), Boolean.Parse(result.GetField(i, 4)), 2, false); item.resetOldName(); item.setFlag('C'); loaded.Add(item); @@ -92,6 +92,35 @@ saveEmu(loaded[i]); } } + if (Options.getIntOption("version") < 190) + { + //Add column noarguments to emulator table + List<Emulator> loaded = new List<Emulator>(); + SQLiteResultSet result = sqlDB.Execute("SELECT * FROM " + tableEmuName + ";"); + for (int i = 0; i < result.Rows.Count; i++) + { + Emulator item = new Emulator(decode(result.GetField(i, 0)), decode(result.GetField(i, 1)), decode(result.GetField(i, 2)), result.GetField(i, 3), Boolean.Parse(result.GetField(i, 4)), DatabaseUtility.GetAsInt(result, i, 5), false); + item.resetOldName(); + item.setFlag('C'); + loaded.Add(item); + } + sqlDB.Execute("DROP TABLE " + tableEmuName + ";"); + createDBs(); + saveOptions(); + for (int i = 0; i < loaded.Count; i++) + { + saveEmu(loaded[i]); + } + //Add column genre to ROM table + try + { + sqlDB.Execute("ALTER TABLE " + tableROMName + " ADD genre varchar(30) NOT NULL DEFAULT 'No genre'"); + } + catch (Exception) + { + //If no DB existed + } + } if (Options.getIntOption("version") < current_version) { Options.updateIntOption("version", current_version); @@ -121,9 +150,9 @@ { //DatabaseUtility.SetPragmas(sqlDB); String query; - query = "CREATE TABLE " + tableEmuName + "(emulator_path char(80) NOT NULL, ROM_path char(80) NOT NULL, emulator_name char(25) NOT NULL, filter char(20) NOT NULL, usequotes char(5) NOT NULL, view char(1) NOT NULL, PRIMARY KEY(emulator_name));"; + query = "CREATE TABLE " + tableEmuName + "(emulator_path char(80) NOT NULL, ROM_path char(80) NOT NULL, emulator_name char(25) NOT NULL, filter char(20) NOT NULL, usequotes char(5) NOT NULL, view char(1) NOT NULL, noarguments char(5), PRIMARY KEY(emulator_name));"; DatabaseUtility.AddTable(sqlDB, tableEmuName, query); - query = "CREATE TABLE " + tableROMName + "(path char(80) NOT NULL, name char(50) NOT NULL, emulator char(25) NOT NULL, grade int(1), count int NOT NULL, dateplayed int NOT NULL, description text, PRIMARY KEY(path), FOREIGN KEY(emulator) REFERENCES " + tableEmuName + "(emulator_name) ON DELETE CASCADE ON UPDATE CASCADE);"; + query = "CREATE TABLE " + tableROMName + "(path char(80) NOT NULL, name char(50) NOT NULL, emulator char(25) NOT NULL, grade int(1), count int NOT NULL, dateplayed int NOT NULL, description text, genre varchar(30) NOT NULL, PRIMARY KEY(path), FOREIGN KEY(emulator) REFERENCES " + tableEmuName + "(emulator_name) ON DELETE CASCADE ON UPDATE CASCADE);"; DatabaseUtility.AddTable(sqlDB, tableROMName, query); query = "CREATE TABLE " + tableOptionsName + "(name char(20) NOT NULL, value char(20) NOT NULL, variable_type char(6) NOT NULL, PRIMARY KEY(name));"; DatabaseUtility.AddTable(sqlDB, tableOptionsName, query); @@ -153,7 +182,7 @@ //DEBUG //MessageBox.Show("NEW ENTRY"); Log.Info("My Emulators - Inserting emulator: {0}", item.getName()); - query = "INSERT INTO " + tableEmuName + " VALUES('" + encode(item.getEmulator_path()) + "','" + encode(item.getROM_path()) + "','" + encode(item.getName()) + "','" + item.getFilter() + "','" + item.isQuotesUsed() + "','" + item.View + "');"; + query = "INSERT INTO " + tableEmuName + " VALUES('" + encode(item.getEmulator_path()) + "','" + encode(item.getROM_path()) + "','" + encode(item.getName()) + "','" + item.getFilter() + "','" + item.isQuotesUsed() + "','" + item.View + "','" + item.isNoArguments() + "');"; sqlDB.Execute(query); } //Updated entry, did not change name @@ -162,7 +191,7 @@ //DEBUG //MessageBox.Show("UPDATED - SAME NAME"); Log.Info("My Emulators - Updating emulator with same name: {0}", item.getName()); - query = "UPDATE " + tableEmuName + " SET emulator_path='" + encode(item.getEmulator_path()) + "',ROM_path='" + encode(item.getROM_path()) + "',filter='" + item.getFilter() + "',usequotes='" + item.isQuotesUsed() + "',view='" + item.View + "' WHERE emulator_name='" + encode(item.getName()) + "';"; + query = "UPDATE " + tableEmuName + " SET emulator_path='" + encode(item.getEmulator_path()) + "',ROM_path='" + encode(item.getROM_path()) + "',filter='" + item.getFilter() + "',usequotes='" + item.isQuotesUsed() + "',view='" + item.View + "',noarguments='" + item.isNoArguments() + "' WHERE emulator_name='" + encode(item.getName()) + "';"; item.setFlag('-'); sqlDB.Execute(query); } @@ -172,7 +201,7 @@ //DEBUG //MessageBox.Show("UPDATED - CHANGED NAME"); Log.Info("My Emulators - Updating emulator with new name: {0}", item.getName()); - query = "UPDATE " + tableEmuName + " SET emulator_path='" + encode(item.getEmulator_path()) + "',ROM_path='" + encode(item.getROM_path()) + "',emulator_name='" + encode(item.getName()) + "',filter='" + item.getFilter() + "',usequotes='" + item.isQuotesUsed() + "',view='" + item.View + "' WHERE emulator_name='" + encode(item.getOldName()) + "';"; + query = "UPDATE " + tableEmuName + " SET emulator_path='" + encode(item.getEmulator_path()) + "',ROM_path='" + encode(item.getROM_path()) + "',emulator_name='" + encode(item.getName()) + "',filter='" + item.getFilter() + "',usequotes='" + item.isQuotesUsed() + "',view='" + item.View + "',noarguments='" + item.isNoArguments() + "' WHERE emulator_name='" + encode(item.getOldName()) + "';"; item.setFlag('-'); sqlDB.Execute(query); } @@ -189,7 +218,7 @@ SQLiteResultSet result = sqlDB.Execute(query); for (int i = 0; i < result.Rows.Count; i++) { - Emulator item = new Emulator(decode(result.GetField(i, 0)), decode(result.GetField(i, 1)), decode(result.GetField(i, 2)), result.GetField(i, 3), Boolean.Parse(result.GetField(i, 4)), DatabaseUtility.GetAsInt(result, i, 5)); + Emulator item = new Emulator(decode(result.GetField(i, 0)), decode(result.GetField(i, 1)), decode(result.GetField(i, 2)), result.GetField(i, 3), Boolean.Parse(result.GetField(i, 4)), DatabaseUtility.GetAsInt(result, i, 5), Boolean.Parse(result.GetField(i, 6))); retur.Add(item); } } @@ -237,10 +266,11 @@ item.Count = Int32.Parse(result.GetField(0, 4)); item.DatePlayed = Int32.Parse(result.GetField(0, 5)); item.Description = decode(result.GetField(0, 6)); + item.Genre = decode(result.GetField(0, 7)); } else { - query = "INSERT INTO " + tableROMName + " VALUES('" + encode(item.getPath()) + "','" + encode(item.getTitle()) + "','" + encode(item.getParent()) + "'," + item.Grade + "," + item.Count + "," + item.DatePlayed + ",'" + encode(item.Description) + "');"; + query = "INSERT INTO " + tableROMName + " VALUES('" + encode(item.getPath()) + "','" + encode(item.getTitle()) + "','" + encode(item.getParent()) + "'," + item.Grade + "," + item.Count + "," + item.DatePlayed + ",'" + encode(item.Description) + "','" + encode(item.Genre) + "');"; sqlDB.Execute(query); } retur.Add(item); @@ -282,7 +312,7 @@ { if (lst[a].getName() == emu) { - ROMItem item = new ROMItem(decode(result.GetField(i, 0)), decode(result.GetField(i, 1)), lst[a], DatabaseUtility.GetAsInt(result, i, 3), DatabaseUtility.GetAsInt(result, i, 4), DatabaseUtility.GetAsInt(result, i, 5), decode(result.GetField(i, 6))); + ROMItem item = new ROMItem(decode(result.GetField(i, 0)), decode(result.GetField(i, 1)), lst[a], DatabaseUtility.GetAsInt(result, i, 3), DatabaseUtility.GetAsInt(result, i, 4), DatabaseUtility.GetAsInt(result, i, 5), decode(result.GetField(i, 6)), decode(result.GetField(i, 7))); retur.Add(item); } } @@ -297,7 +327,7 @@ public static void saveROM(ROMItem item) { - sqlDB.Execute("UPDATE " + tableROMName + " SET name='" + encode(item.getTitle()) + "',grade='" + item.Grade + "',count='" + item.Count + "',dateplayed='" + item.DatePlayed + "',description='" + encode(item.Description) + "' WHERE path='" + encode(item.getPath()) + "';"); + sqlDB.Execute("UPDATE " + tableROMName + " SET name='" + encode(item.getTitle()) + "',grade='" + item.Grade + "',count='" + item.Count + "',dateplayed='" + item.DatePlayed + "',description='" + encode(item.Description) + "',genre='" + encode(item.Genre) + "' WHERE path='" + encode(item.getPath()) + "';"); } //Check which files will be shown @@ -431,5 +461,21 @@ Options.addStringOption(result.GetField(i, 0), result.GetField(i, 1)); } } + + public static String[] getGenres() + { + List<String> genres = new List<String>(); + SQLiteResultSet result = sqlDB.Execute("SELECT genre FROM " + tableROMName + ";"); + for (int i = 0; i < result.Rows.Count; i++) + { + String item = result.GetField(i, 0); + if (!genres.Contains(item)) + { + genres.Add(item); + } + } + genres.Sort(); + return genres.ToArray(); + } } } Modified: trunk/plugins/MyEmulators/myEmulators/Emulator.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/Emulator.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/Emulator.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -16,6 +16,7 @@ private int view; private char flag; private bool usequotes; + private bool noarguments; private List<Emulator> emulators; private List<ROMItem> ROMs; private Label label1; @@ -31,19 +32,22 @@ private Button button3; private Button button4; private CheckBox checkbox1; + private CheckBox checkbox2; public Emulator() { init("", "", "", "*.*"); usequotes = true; + noarguments = false; view = 2; } - public Emulator(string emulator_path, string ROM_path, string name, string filter, bool usequotes, int view) + public Emulator(string emulator_path, string ROM_path, string name, string filter, bool usequotes, int view, bool noarguments) { init(emulator_path, ROM_path, name, filter); this.usequotes = usequotes; this.view = view; + this.noarguments = noarguments; } private void init(string emulator_path, string ROM_path, string name, string filter) @@ -60,13 +64,14 @@ textbox4.Text = filter; } - public void update(string emulator_path, string ROM_path, string name, string filter, bool usequotes) + public void update(string emulator_path, string ROM_path, string name, string filter, bool usequotes, bool noarguments) { textbox1.Text = emulator_path; textbox2.Text = ROM_path; textbox3.Text = name; textbox4.Text = filter; checkbox1.Checked = usequotes; + checkbox2.Checked = noarguments; } public String getEmulator_path() @@ -123,6 +128,11 @@ return usequotes; } + public bool isNoArguments() + { + return noarguments; + } + //TODO: this is how getters och setters work public int View { @@ -153,9 +163,9 @@ groupbox.Top = y; groupbox2 = new GroupBox(); - groupbox2.Text = "Advanced (change only in case of problems)"; + groupbox2.Text = "Advanced"; groupbox2.Width = 336; - groupbox2.Height = 50; + groupbox2.Height = 70; groupbox2.Left = x; groupbox2.Top = groupbox.Bottom + 10; @@ -212,6 +222,14 @@ checkbox1.CheckedChanged += new System.EventHandler(this.useQuotesChanged); checkbox1.Checked = usequotes; + checkbox2 = new CheckBox(); + checkbox2.Text = "Execute without arguments"; + checkbox2.Left = x + 6; + checkbox2.Top = y + 200; + checkbox2.Width = 325; + checkbox2.CheckedChanged += new EventHandler(this.useArgumentsChanged); + checkbox2.Checked = noarguments; + button1 = new Button(); button1.Text = "..."; button1.Width = 26; @@ -230,13 +248,13 @@ button3.Text = "Cancel"; button3.Width = 70; button3.Left = x; - button3.Top = y + 227; + button3.Top = y + 247; button3.Click += new System.EventHandler(this.Cancel_Click); button4 = new Button(); button4.Text = "OK"; button4.Width = 70; button4.Left = x + 266; - button4.Top = y + 227; + button4.Top = y + 247; button4.Click += new System.EventHandler(this.OK_Click); ToolTip tooltip1 = new ToolTip(); @@ -247,6 +265,10 @@ tooltip3.SetToolTip(textbox3, "This will be the visible text in Media Portal"); ToolTip tooltip4 = new ToolTip(); tooltip4.SetToolTip(textbox4, "Separate with ;. Eg: *.nes;*.rom"); + ToolTip tooltip5 = new ToolTip(); + tooltip5.SetToolTip(checkbox1, "Uncheck to correct compability issues with Project64 among others"); + ToolTip tooltip6 = new ToolTip(); + tooltip6.SetToolTip(checkbox2, "To use PC games, check this and enter the path to the game in the topmost box"); owner.AcceptButton = button4; owner.CancelButton = button3; @@ -260,6 +282,7 @@ owner.Controls.Add(textbox3); owner.Controls.Add(textbox4); owner.Controls.Add(checkbox1); + owner.Controls.Add(checkbox2); owner.Controls.Add(button1); owner.Controls.Add(button2); owner.Controls.Add(button3); @@ -273,7 +296,7 @@ try { OpenFileDialog dialog = new OpenFileDialog(); - dialog.Filter = "Executables|*.exe"; + dialog.Filter = "Executables (*.exe, *.bat)|*.exe;*.bat"; dialog.CheckFileExists = true; dialog.RestoreDirectory = true; if (dialog.ShowDialog() == DialogResult.OK) @@ -303,6 +326,28 @@ { usequotes = ((CheckBox)sender).Checked; } + private void useArgumentsChanged(object sender, EventArgs e) + { + noarguments = ((CheckBox)sender).Checked; + if (noarguments) + { + textbox2.Enabled = false; + textbox2.Text = "not applicable"; + button2.Enabled = false; + textbox4.Enabled = false; + textbox4.Text = "not applicable"; + checkbox1.Enabled = false; + } + else + { + textbox2.Text = ""; + textbox2.Enabled = true; + button2.Enabled = true; + textbox4.Text = "*.*"; + textbox4.Enabled = true; + checkbox1.Enabled = true; + } + } private void updateFlag(object sender, EventArgs e) { setFlag('C'); @@ -323,7 +368,7 @@ { throw new Exception(); } - else if (!ROM_path.Contains("\\") || !emulator_path.Contains("\\")) + else if ((!checkbox2.Checked && !ROM_path.Contains("\\")) || !emulator_path.Contains("\\")) { throw new Exception(); } @@ -340,7 +385,7 @@ //Saves the information if (indexInList < 0) { - Emulator temp = new Emulator(emulator_path, ROM_path, emulator_name, filter, usequotes, view); + Emulator temp = new Emulator(emulator_path, ROM_path, emulator_name, filter, usequotes, view, noarguments); temp.resetOldName(); temp.setFlag(flag); emulators.Add(temp); @@ -352,6 +397,7 @@ emulators[indexInList].textbox3.Text = emulator_name; emulators[indexInList].textbox4.Text = filter; emulators[indexInList].usequotes = usequotes; + emulators[indexInList].noarguments = noarguments; emulators[indexInList].oldname = oldname; emulators[indexInList].flag = flag; emulators[indexInList].view = view; Modified: trunk/plugins/MyEmulators/myEmulators/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/Properties/AssemblyInfo.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/Properties/AssemblyInfo.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.1.8.0")] -[assembly: AssemblyFileVersion("0.1.8.0")] +[assembly: AssemblyVersion("0.1.9.0")] +[assembly: AssemblyFileVersion("0.1.9.0")] Modified: trunk/plugins/MyEmulators/myEmulators/ROMItem.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/ROMItem.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/ROMItem.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -14,18 +14,19 @@ private String name; private int count; private char flag; + private String genre; public ROMItem(String path, Emulator parent) { - init(path, null, parent, 0, 0, 0, ""); + init(path, null, parent, 0, 0, 0, "", "No genre"); } - public ROMItem(String path, String name, Emulator parent, int grade, int count, int dateplayed, String description) + public ROMItem(String path, String name, Emulator parent, int grade, int count, int dateplayed, String description, String genre) { - init(path, name, parent, grade, count, dateplayed, description); + init(path, name, parent, grade, count, dateplayed, description, genre); } - public void init(String path, String name, Emulator parent, int grade, int count, int dateplayed, String description) + public void init(String path, String name, Emulator parent, int grade, int count, int dateplayed, String description, String genre) { this.path = path; this.name = name; @@ -34,6 +35,7 @@ this.count = count; this.dateplayed = dateplayed; this.description = description; + this.genre = genre; flag = '-'; Label = getTitle(); } @@ -107,6 +109,18 @@ } } + public String Genre + { + get + { + return genre; + } + set + { + genre = value; + } + } + public int Count { get Modified: trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -40,13 +40,6 @@ this.add = new System.Windows.Forms.Button(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.ROM_DB_List_Path = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ROM_DB_List_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ROM_DB_List_Emulator = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ROM_DB_List_Grade = new System.Windows.Forms.DataGridViewComboBoxColumn(); - this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Dateplayed = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ROM_DB_List_Description = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); @@ -57,6 +50,14 @@ this.shutdownonload = new System.Windows.Forms.CheckBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.apply = new System.Windows.Forms.Button(); + this.ROM_DB_List_Path = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ROM_DB_List_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ROM_DB_List_Emulator = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ROM_DB_List_Grade = new System.Windows.Forms.DataGridViewComboBoxColumn(); + this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Dateplayed = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ROM_DB_List_Description = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Genre = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -141,7 +142,7 @@ listBox1.Size = new System.Drawing.Size(225, 147); listBox1.TabIndex = 29; listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick_1); - listBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(listBox1_KeyDown); + listBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox1_KeyDown); // // label1 // @@ -185,63 +186,14 @@ this.ROM_DB_List_Grade, this.Count, this.Dateplayed, - this.ROM_DB_List_Description}); + this.ROM_DB_List_Description, + this.Genre}); this.dataGridView1.Location = new System.Drawing.Point(8, 6); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Size = new System.Drawing.Size(343, 218); this.dataGridView1.TabIndex = 1; this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit); // - // ROM_DB_List_Path - // - this.ROM_DB_List_Path.HeaderText = "Path"; - this.ROM_DB_List_Path.MaxInputLength = 80; - this.ROM_DB_List_Path.Name = "ROM_DB_List_Path"; - this.ROM_DB_List_Path.ReadOnly = true; - this.ROM_DB_List_Path.ToolTipText = "The absolute path to the game"; - // - // ROM_DB_List_Name - // - this.ROM_DB_List_Name.HeaderText = "Name"; - this.ROM_DB_List_Name.MaxInputLength = 50; - this.ROM_DB_List_Name.Name = "ROM_DB_List_Name"; - this.ROM_DB_List_Name.ToolTipText = "The name shown in MediaPortal"; - // - // ROM_DB_List_Emulator - // - this.ROM_DB_List_Emulator.HeaderText = "Emulator"; - this.ROM_DB_List_Emulator.Name = "ROM_DB_List_Emulator"; - this.ROM_DB_List_Emulator.ReadOnly = true; - this.ROM_DB_List_Emulator.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.ROM_DB_List_Emulator.ToolTipText = "The emulator used for launching the game"; - // - // ROM_DB_List_Grade - // - this.ROM_DB_List_Grade.HeaderText = "Grade"; - this.ROM_DB_List_Grade.Name = "ROM_DB_List_Grade"; - this.ROM_DB_List_Grade.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.ROM_DB_List_Grade.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.ROM_DB_List_Grade.ToolTipText = "A score between 1 and 10"; - this.ROM_DB_List_Grade.Width = 50; - // - // Count - // - this.Count.HeaderText = "Play count"; - this.Count.Name = "Count"; - this.Count.Width = 60; - // - // Dateplayed - // - this.Dateplayed.HeaderText = "Date played"; - this.Dateplayed.Name = "Dateplayed"; - this.Dateplayed.Width = 80; - // - // ROM_DB_List_Description - // - this.ROM_DB_List_Description.HeaderText = "Description"; - this.ROM_DB_List_Description.Name = "ROM_DB_List_Description"; - this.ROM_DB_List_Description.Width = 200; - // // tabPage3 // this.tabPage3.Controls.Add(this.comboBox1); @@ -348,6 +300,62 @@ this.apply.UseVisualStyleBackColor = true; this.apply.Click += new System.EventHandler(this.apply_Click); // + // ROM_DB_List_Path + // + this.ROM_DB_List_Path.HeaderText = "Path"; + this.ROM_DB_List_Path.MaxInputLength = 80; + this.ROM_DB_List_Path.Name = "ROM_DB_List_Path"; + this.ROM_DB_List_Path.ReadOnly = true; + this.ROM_DB_List_Path.ToolTipText = "The absolute path to the game"; + // + // ROM_DB_List_Name + // + this.ROM_DB_List_Name.HeaderText = "Name"; + this.ROM_DB_List_Name.MaxInputLength = 50; + this.ROM_DB_List_Name.Name = "ROM_DB_List_Name"; + this.ROM_DB_List_Name.ToolTipText = "The name shown in MediaPortal"; + // + // ROM_DB_List_Emulator + // + this.ROM_DB_List_Emulator.HeaderText = "Emulator"; + this.ROM_DB_List_Emulator.Name = "ROM_DB_List_Emulator"; + this.ROM_DB_List_Emulator.ReadOnly = true; + this.ROM_DB_List_Emulator.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.ROM_DB_List_Emulator.ToolTipText = "The emulator used for launching the game"; + // + // ROM_DB_List_Grade + // + this.ROM_DB_List_Grade.HeaderText = "Grade"; + this.ROM_DB_List_Grade.Name = "ROM_DB_List_Grade"; + this.ROM_DB_List_Grade.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.ROM_DB_List_Grade.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.ROM_DB_List_Grade.ToolTipText = "A score between 1 and 10"; + this.ROM_DB_List_Grade.Width = 50; + // + // Count + // + this.Count.HeaderText = "Play count"; + this.Count.Name = "Count"; + this.Count.Width = 60; + // + // Dateplayed + // + this.Dateplayed.HeaderText = "Date played"; + this.Dateplayed.Name = "Dateplayed"; + this.Dateplayed.Width = 80; + // + // ROM_DB_List_Description + // + this.ROM_DB_List_Description.HeaderText = "Description"; + this.ROM_DB_List_Description.Name = "ROM_DB_List_Description"; + this.ROM_DB_List_Description.Width = 200; + // + // Genre + // + this.Genre.HeaderText = "Genre"; + this.Genre.MaxInputLength = 30; + this.Genre.Name = "Genre"; + // // setupForm // this.AcceptButton = this.save; @@ -394,6 +402,10 @@ private System.Windows.Forms.Label label2; private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.Button apply; + private System.Windows.Forms.CheckBox display_desc; + private System.Windows.Forms.CheckBox display_stars; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.DataGridViewTextBoxColumn ROM_DB_List_Path; private System.Windows.Forms.DataGridViewTextBoxColumn ROM_DB_List_Name; private System.Windows.Forms.DataGridViewTextBoxColumn ROM_DB_List_Emulator; @@ -401,10 +413,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn Count; private System.Windows.Forms.DataGridViewTextBoxColumn Dateplayed; private System.Windows.Forms.DataGridViewTextBoxColumn ROM_DB_List_Description; - private System.Windows.Forms.CheckBox display_desc; - private System.Windows.Forms.CheckBox display_stars; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.DataGridViewTextBoxColumn Genre; private static System.Windows.Forms.ListBox listBox1; } } \ No newline at end of file Modified: trunk/plugins/MyEmulators/myEmulators/setupForm.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/setupForm.cs 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/setupForm.cs 2008-03-25 08:02:43 UTC (rev 1511) @@ -66,7 +66,7 @@ { continue; } - else if (!item.getROM_path().Contains("\\") || !item.getEmulator_path().Contains("\\")) + else if ((!item.isNoArguments() && !item.getROM_path().Contains("\\")) || !item.getEmulator_path().Contains("\\")) { throw new FieldAccessException(); } @@ -128,6 +128,7 @@ { ROMs[i].Description = ""; } + ROMs[i].Genre = ((DataGridViewTextBoxCell)row.Cells[7]).Value.ToString(); DB.saveROM(ROMs[i]); } if (close) @@ -151,7 +152,7 @@ Emulator[] loaded = DB.loadEmus(); for (int i = 0; i < loaded.Length; i++) { - Emulator item = new Emulator(loaded[i].getEmulator_path(), loaded[i].getROM_path(), loaded[i].getName(), loaded[i].getFilter(), loaded[i].isQuotesUsed(), loaded[i].View); + Emulator item = new Emulator(loaded[i].getEmulator_path(), loaded[i].getROM_path(), loaded[i].getName(), loaded[i].getFilter(), loaded[i].isQuotesUsed(), loaded[i].View, loaded[i].isNoArguments()); emulators.Add(item); listBox1.Items.Add(loaded[i].getName()); } @@ -218,7 +219,7 @@ Form tempForm = new Form(); tempForm.Text = "Emulator properties"; tempForm.Width = 365; - tempForm.Height = 294; + tempForm.Height = 314; tempForm.ShowIcon = false; tempForm.FormBorderStyle = FormBorderStyle.FixedSingle; Emulator tempEmulator = new Emulator(); @@ -229,7 +230,7 @@ else { tempEmulator.show(tempForm, emulators, emulators.IndexOf(emulator),emulator.getName()); - tempEmulator.update(emulator.getEmulator_path(), emulator.getROM_path(), emulator.getName(), emulator.getFilter(), emulator.isQuotesUsed()); + tempEmulator.update(emulator.getEmulator_path(), emulator.getROM_path(), emulator.getName(), emulator.getFilter(), emulator.isQuotesUsed(), emulator.isNoArguments()); } tempForm.ShowDialog(); } @@ -353,6 +354,10 @@ textcell = new DataGridViewTextBoxCell(); textcell.Value = ROMs[i].Description; row.Cells.Add(textcell); + //Eight cell + textcell = new DataGridViewTextBoxCell(); + textcell.Value = ROMs[i].Genre; + row.Cells.Add(textcell); dataGridView1.Rows.Add(row); } } Modified: trunk/plugins/MyEmulators/myEmulators/setupForm.resx =================================================================== --- trunk/plugins/MyEmulators/myEmulators/setupForm.resx 2008-03-25 08:02:00 UTC (rev 1510) +++ trunk/plugins/MyEmulators/myEmulators/setupForm.resx 2008-03-25 08:02:43 UTC (rev 1511) @@ -138,6 +138,9 @@ <metadata name="ROM_DB_List_Description.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="Genre.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> Modified: trunk/plugins/MyEmulators/output.rar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |