From 5fef4047e1eae46a5b2df7ad70f38d795a38546e Mon Sep 17 00:00:00 2001 From: David Pierron Date: Fri, 7 Sep 2018 11:21:20 +0200 Subject: [PATCH 1/3] added an html exporter --- games.xslt | 137 ++++++++++++++++++++++++++++++++++++++++++++++ index.html | 9 +++ missinggames.xslt | 33 +++++++++++ searchicon.png | Bin 0 -> 860 bytes transform.ps1 | 19 +++++++ 5 files changed, 198 insertions(+) create mode 100644 games.xslt create mode 100644 index.html create mode 100644 missinggames.xslt create mode 100644 searchicon.png create mode 100644 transform.ps1 diff --git a/games.xslt b/games.xslt new file mode 100644 index 0000000..b1dda3b --- /dev/null +++ b/games.xslt @@ -0,0 +1,137 @@ + + + + + + + + + +

Back

+

games listed.

+ + + + + + + + + + + + Cover + + + + + + + + + + + + + + + + + + + + + + + +
TitleDeveloper
+ + + icon + + + icon + + +
+ + +
+
+ diff --git a/index.html b/index.html new file mode 100644 index 0000000..fe55b8d --- /dev/null +++ b/index.html @@ -0,0 +1,9 @@ + + +

My Switch Games

+

XCI cartridge backups

+

NSP eShop downloads

+

Missing games (from scene release list)

+ + + \ No newline at end of file diff --git a/missinggames.xslt b/missinggames.xslt new file mode 100644 index 0000000..c3b7b7f --- /dev/null +++ b/missinggames.xslt @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searchicon.png b/searchicon.png new file mode 100644 index 0000000000000000000000000000000000000000..71f06afc1129f30bdec28e7fe0cf5b561a86e5c4 GIT binary patch literal 860 zcmeAS@N?(olHy`uVBq!ia0vp^q9Dw{1|(OCFP#RY7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`0h7I;J!GcX91fH32|H2DgkAXAdJy9>kr_Wm>bK}yOB9MgfuXaTV%Lx5PS zAy81Y#5JNMC9x#cD!C{XNHG{07#iyunCKcBgcz7vnOa&InClvtTNxPiId%r3Xvob^ z$xN%nt>M3n;ai{vNstY}`DrEPiAAXl<>lpinR(g8$%zH2dih1^v)|cB0Tl^?6oq7# z^%3q`z_28r;sTP9gZ_qy4z zf4u$Ht}(^DA%W6xn-~ z?UpUw9XrcM?M_gK5dXEvh4PoPwyv5lv4q(#MNmNUQZxHAqvbaecg9@n-*%*A;g;LE zdMt}7-?7X%sCiG|pv{~|lQgG#Jt^90a#}rbLxj$cB?{$165W66?B)4NxaU09RkoXd zzUJVA70u#-$_8x5G#JW&=Et>gw=(^#*>`@?{2TATU&%1>IkY21;A4Gv)8U5>U#nup z-DU;6un}6+^3*MLU7ODVlN5uetDnm{r-UW| D%HLGi literal 0 HcmV?d00001 diff --git a/transform.ps1 b/transform.ps1 new file mode 100644 index 0000000..323dd7d --- /dev/null +++ b/transform.ps1 @@ -0,0 +1,19 @@ +try +{ + $XsltSettings = New-Object System.Xml.Xsl.XsltSettings($true, $false); + $XslPath = New-Object System.Xml.Xsl.XslCompiledTransform + $XslPath = New-Object System.Xml.Xsl.XslCompiledTransform + $XslPath.Load("missinggames.xslt",$XsltSettings, $null) + $XslPath.Transform("nswdb.xml", "missinggames.xml") + $XslPath = New-Object System.Xml.Xsl.XslCompiledTransform + $XslPath.Load("games.xslt") + $XslPath.Transform("SBM_Local.xml", "SBM_Local.html") + $XslPath.Transform("SBM_NSP_Local.xml", "SBM_NSP_Local.html") + $XslPath.Transform("missinggames.xml", "missing.html") + + Write-Host "Done !" +} +catch +{ + Write-Host $_.Exception -ForegroundColor Red +} \ No newline at end of file From 48d6a12c237200046d918db2ee67efeae83417c3 Mon Sep 17 00:00:00 2001 From: David Pierron Date: Fri, 7 Sep 2018 20:27:18 +0200 Subject: [PATCH 2/3] added a ImportedDate metadata ; also as a column in Local and EShop tables --- Switch Backup Manager/FileData.cs | 3 ++ Switch Backup Manager/Form1.Designer.cs | 37 +++++++++++++++++++------ Switch Backup Manager/Form1.cs | 6 ++++ Switch Backup Manager/Util.cs | 8 +++++- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Switch Backup Manager/FileData.cs b/Switch Backup Manager/FileData.cs index d848e5f..4e4f8b8 100644 --- a/Switch Backup Manager/FileData.cs +++ b/Switch Backup Manager/FileData.cs @@ -45,6 +45,7 @@ public FileData () //Default constructor this.Description = ""; this.Publisher = ""; this.ReleaseDate = ""; + this.ImportedDate = ""; this.NumberOfPlayers = ""; this.Categories = new List(); this.ESRB = 0; @@ -58,6 +59,7 @@ public FileData(string FilePath, string FileName, string FileNameWithExt, string string DistributionType, int IdScene, string ContentType, string Version, bool HasExtendedInfo, string Description, string Publisher, string ReleaseDate, string NumberOfPlayers, List Categories, int ESRB) { + this.ImportedDate = ""; this.FilePath = FilePath; this.FileName = FileName; this.FileNameWithExt = FileNameWithExt; @@ -97,6 +99,7 @@ public FileData(string FilePath, string FileName, string FileNameWithExt, string this.ESRB = ESRB; } + public string ImportedDate { get; set; } public string FilePath { get; set; } public string FileName { get; set; } public string FileNameWithExt { get; set; } diff --git a/Switch Backup Manager/Form1.Designer.cs b/Switch Backup Manager/Form1.Designer.cs index 26cd0b3..653f35e 100644 --- a/Switch Backup Manager/Form1.Designer.cs +++ b/Switch Backup Manager/Form1.Designer.cs @@ -68,6 +68,7 @@ private void InitializeComponent() this.olvColumnReleaseDateLocal = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.olvColumnNumberOfPlayersLocal = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.olvColumnCategoriesLocal = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.olvColumnImportedDateLocal = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.contextMenuLocalList = new System.Windows.Forms.ContextMenuStrip(this.components); this.showInExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripSeparator(); @@ -321,6 +322,7 @@ private void InitializeComponent() this.olvColumnNumberOfPlayersEshop = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.olvColumnCategoriesEShop = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.olvColumnContentTypeEShop = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.olvColumnImportedDateEShop = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.contextMenuEShopList = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItemEShopShowInExplorer = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemEShopUpdateInfo = new System.Windows.Forms.ToolStripMenuItem(); @@ -756,6 +758,7 @@ private void InitializeComponent() this.OLVLocalFiles.AllColumns.Add(this.olvColumnReleaseDateLocal); this.OLVLocalFiles.AllColumns.Add(this.olvColumnNumberOfPlayersLocal); this.OLVLocalFiles.AllColumns.Add(this.olvColumnCategoriesLocal); + this.OLVLocalFiles.AllColumns.Add(this.olvColumnImportedDateLocal); this.OLVLocalFiles.CellEditUseWholeCell = false; this.OLVLocalFiles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.olvColumnTitleIDLocal, @@ -775,7 +778,8 @@ private void InitializeComponent() this.olvColumnSDKVersionLocal, this.olvColumnReleaseDateLocal, this.olvColumnNumberOfPlayersLocal, - this.olvColumnCategoriesLocal}); + this.olvColumnCategoriesLocal, + this.olvColumnImportedDateLocal}); this.OLVLocalFiles.ContextMenuStrip = this.contextMenuLocalList; this.OLVLocalFiles.Cursor = System.Windows.Forms.Cursors.Default; this.OLVLocalFiles.Dock = System.Windows.Forms.DockStyle.Fill; @@ -911,6 +915,13 @@ private void InitializeComponent() this.olvColumnCategoriesLocal.AspectName = "Categories"; this.olvColumnCategoriesLocal.Text = "Category"; // + // olvColumnImportedDateLocal + // + this.olvColumnImportedDateLocal.AspectName = "ImportedDate"; + this.olvColumnImportedDateLocal.IsEditable = false; + this.olvColumnImportedDateLocal.Text = "Imported Date"; + this.olvColumnImportedDateLocal.Width = 200; + // // contextMenuLocalList // this.contextMenuLocalList.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -2838,7 +2849,7 @@ private void InitializeComponent() this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Name = "tabPage4"; this.tabPage4.Padding = new System.Windows.Forms.Padding(3); - this.tabPage4.Size = new System.Drawing.Size(1517, 490); + this.tabPage4.Size = new System.Drawing.Size(1519, 492); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "E-shop files"; this.tabPage4.UseVisualStyleBackColor = true; @@ -2849,7 +2860,7 @@ private void InitializeComponent() this.panel10.Dock = System.Windows.Forms.DockStyle.Fill; this.panel10.Location = new System.Drawing.Point(3, 31); this.panel10.Name = "panel10"; - this.panel10.Size = new System.Drawing.Size(1511, 456); + this.panel10.Size = new System.Drawing.Size(1513, 458); this.panel10.TabIndex = 11; // // OLVEshop @@ -2870,6 +2881,7 @@ private void InitializeComponent() this.OLVEshop.AllColumns.Add(this.olvColumnNumberOfPlayersEshop); this.OLVEshop.AllColumns.Add(this.olvColumnCategoriesEShop); this.OLVEshop.AllColumns.Add(this.olvColumnContentTypeEShop); + this.OLVEshop.AllColumns.Add(this.olvColumnImportedDateEShop); this.OLVEshop.CellEditUseWholeCell = false; this.OLVEshop.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.olvColumnTitleIDEShop, @@ -2887,7 +2899,8 @@ private void InitializeComponent() this.olvColumnReleaseDateEshop, this.olvColumnNumberOfPlayersEshop, this.olvColumnCategoriesEShop, - this.olvColumnContentTypeEShop}); + this.olvColumnContentTypeEShop, + this.olvColumnImportedDateEShop}); this.OLVEshop.ContextMenuStrip = this.contextMenuEShopList; this.OLVEshop.Cursor = System.Windows.Forms.Cursors.Default; this.OLVEshop.Dock = System.Windows.Forms.DockStyle.Fill; @@ -2896,7 +2909,7 @@ private void InitializeComponent() this.OLVEshop.Location = new System.Drawing.Point(0, 0); this.OLVEshop.Name = "OLVEshop"; this.OLVEshop.ShowGroups = false; - this.OLVEshop.Size = new System.Drawing.Size(1511, 456); + this.OLVEshop.Size = new System.Drawing.Size(1513, 458); this.OLVEshop.TabIndex = 3; this.OLVEshop.UseCellFormatEvents = true; this.OLVEshop.UseCompatibleStateImageBehavior = false; @@ -2911,7 +2924,7 @@ private void InitializeComponent() // this.olvColumnTitleIDEShop.AspectName = "TitleID"; this.olvColumnTitleIDEShop.Text = "Title ID"; - this.olvColumnTitleIDEShop.Width = 118; + this.olvColumnTitleIDEShop.Width = 200; // // olvColumnGameNameEShop // @@ -3005,6 +3018,12 @@ private void InitializeComponent() this.olvColumnContentTypeEShop.AspectName = "ContentType"; this.olvColumnContentTypeEShop.Text = "Content Type"; // + // olvColumnImportedDateEShop + // + this.olvColumnImportedDateEShop.AspectName = "ImportedDate"; + this.olvColumnImportedDateEShop.IsEditable = false; + this.olvColumnImportedDateEShop.Text = "Imported Date"; + // // contextMenuEShopList // this.contextMenuEShopList.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -3126,7 +3145,7 @@ private void InitializeComponent() this.panel11.Dock = System.Windows.Forms.DockStyle.Top; this.panel11.Location = new System.Drawing.Point(3, 3); this.panel11.Name = "panel11"; - this.panel11.Size = new System.Drawing.Size(1511, 28); + this.panel11.Size = new System.Drawing.Size(1513, 28); this.panel11.TabIndex = 10; // // panel13 @@ -3139,7 +3158,7 @@ private void InitializeComponent() this.panel13.Controls.Add(this.label5); this.panel13.Controls.Add(this.cbxFilterEshop); this.panel13.Dock = System.Windows.Forms.DockStyle.Right; - this.panel13.Location = new System.Drawing.Point(798, 0); + this.panel13.Location = new System.Drawing.Point(800, 0); this.panel13.Name = "panel13"; this.panel13.Size = new System.Drawing.Size(713, 28); this.panel13.TabIndex = 1; @@ -4515,6 +4534,8 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5; + private BrightIdeasSoftware.OLVColumn olvColumnImportedDateLocal; + private BrightIdeasSoftware.OLVColumn olvColumnImportedDateEShop; } } diff --git a/Switch Backup Manager/Form1.cs b/Switch Backup Manager/Form1.cs index 567eaa6..1d344e4 100644 --- a/Switch Backup Manager/Form1.cs +++ b/Switch Backup Manager/Form1.cs @@ -2909,6 +2909,9 @@ private void textBoxFilterLocal_TextChanged(object sender, EventArgs e) case "Category": filterText.Columns = new[] { olvColumnCategoriesLocal }; break; + case "Imported Date": + filterText.Columns = new[] { olvColumnImportedDateLocal }; + break; default: filterText = null; break; @@ -3517,6 +3520,9 @@ private void textBoxFilterEShop_TextChanged(object sender, EventArgs e) case "Category": filterText.Columns = new[] { olvColumnCategoriesEShop }; break; + case "Imported Date": + filterText.Columns = new[] { olvColumnImportedDateEShop}; + break; default: filterText = null; break; diff --git a/Switch Backup Manager/Util.cs b/Switch Backup Manager/Util.cs index a78eb48..7153aea 100644 --- a/Switch Backup Manager/Util.cs +++ b/Switch Backup Manager/Util.cs @@ -992,6 +992,7 @@ public static bool WriteFileDataToXML(FileData data, string xml) new XElement("ReleaseDate", data.ReleaseDate), new XElement("NumberOfPlayers", data.NumberOfPlayers), new XElement("ESRB", data.ESRB), + new XElement("ImportedDate", data.ImportedDate), new XElement("Categories", categories) ); if (xml == LOCAL_FILES_DB) @@ -1770,7 +1771,7 @@ public static bool CheckXCI(string file) public static FileData GetFileDataNSP(string file) { FileData data = new FileData(); - + data.ImportedDate = DateTime.UtcNow.ToString("yyyyMMddHHmmss"); data.FilePath = file; data.FileName = Path.GetFileNameWithoutExtension(file); data.FileNameWithExt = Path.GetFileName(file); @@ -2239,6 +2240,7 @@ where x.Length > 1 public static FileData GetFileData(string filepath) { FileData result = new FileData(); + result.ImportedDate = DateTime.UtcNow.ToString("yyyyMMddHHmmss"); //Basic Info result.FilePath = filepath; result.FileName = Path.GetFileNameWithoutExtension(filepath); @@ -2694,6 +2696,10 @@ public static FileData GetFileData(XElement xe) try { result.TitleID = xe.Attribute("TitleID").Value; + if (xe.Element("ImportedDate") != null) + { + result.ImportedDate = xe.Element("ImportedDate").Value; + } if (xe.Element("TitleIDBaseGame") != null) { result.TitleIDBaseGame = xe.Element("TitleIDBaseGame").Value; From c4f99ec690bcc840fa6a71286d6f4452dccd0a56 Mon Sep 17 00:00:00 2001 From: David Pierron Date: Sat, 8 Sep 2018 09:30:03 +0200 Subject: [PATCH 3/3] added an "all games" page so it is easy to check if a game is already in the database --- .gitignore | 13 ++++++- .vscode/tasks.json | 29 ++++++++++++++++ allgames.xslt | 30 ++++++++++++++++ games.xslt | 87 ++++++++++++++++++++++++++++++++++------------ index.html | 1 + transform.ps1 | 11 ++++++ 6 files changed, 148 insertions(+), 23 deletions(-) create mode 100644 .vscode/tasks.json create mode 100644 allgames.xslt diff --git a/.gitignore b/.gitignore index 3c4efe2..eed88f5 100644 --- a/.gitignore +++ b/.gitignore @@ -258,4 +258,15 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc +cache +allgames.html +index.html +missing.html +SBM_Local.html +SBM_NSP_Local.html +allgames.xml +missinggames.xml +nswdb.xml +SBM_Local.xml +SBM_NSP_Local.xml diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..d3314f4 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Run XSL transformers", + "type": "shell", + "command": "./transform.sh", + "windows": { + "command": ".\\transform.ps1" + }, + "args": [ + "y" + ], + "options": { + "cwd": "${workspaceRoot}" + }, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + } + } + ] +} \ No newline at end of file diff --git a/allgames.xslt b/allgames.xslt new file mode 100644 index 0000000..4ce6da3 --- /dev/null +++ b/allgames.xslt @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + xci + + + + + + + nsp + + + + + + + + diff --git a/games.xslt b/games.xslt index b1dda3b..0762e18 100644 --- a/games.xslt +++ b/games.xslt @@ -32,6 +32,10 @@ padding: 12px; } +#myTable th { + cursor: pointer; +} + #myTable tr { border-bottom: 1px solid #ddd; } @@ -60,18 +64,21 @@ function myFunction() { table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { - tds = tr[i].getElementsByTagName("td"); - display = "none" - for (j = 0; j < tds.length; j++) { - td = tds[j] - if (td && (td.getAttribute("id") == "GameName" || td.getAttribute("id") == "Developer")) { - if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { - display = ""; - break; - } - } + id = tr[i].getAttribute("id"); + if (id != "header") { + tds = tr[i].getElementsByTagName("td"); + display = "none" + for (j = 0; j < tds.length; j++) { + td = tds[j] + if (td && (td.getAttribute("id") == "GameName" || td.getAttribute("id") == "Developer")) { + if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { + display = ""; + break; + } + } + } + tr[i].style.display = display; } - tr[i].style.display = display; } } @@ -82,25 +89,38 @@ function myFunction2() { table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { - title = tr[i].getAttribute("title"); - if (!filter || (title && title.toUpperCase().indexOf(filter) > -1)) { - tr[i].style.display = ""; - } else { - tr[i].style.display = "none"; + id = tr[i].getAttribute("id"); + if (id != "header") { + title = tr[i].getAttribute("title"); + if (!filter || (title && title.toUpperCase().indexOf(filter) > -1)) { + tr[i].style.display = ""; + } else { + tr[i].style.display = "none"; + } } } } ]]> - - - - Cover - - + + + + + + + + + + + + + + + + @@ -125,12 +145,35 @@ function myFunction2() { + + + + + +
+ diff --git a/index.html b/index.html index fe55b8d..c06b2af 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@

My Switch Games

XCI cartridge backups

NSP eShop downloads

+

All games

Missing games (from scene release list)

diff --git a/transform.ps1 b/transform.ps1 index 323dd7d..3ad0bd1 100644 --- a/transform.ps1 +++ b/transform.ps1 @@ -1,7 +1,13 @@ +param ( + [string]$openResult = "n" +) try { + write-output $openResult $XsltSettings = New-Object System.Xml.Xsl.XsltSettings($true, $false); $XslPath = New-Object System.Xml.Xsl.XslCompiledTransform + $XslPath.Load("allgames.xslt",$XsltSettings, $null) + $XslPath.Transform("nswdb.xml", "allgames.xml") $XslPath = New-Object System.Xml.Xsl.XslCompiledTransform $XslPath.Load("missinggames.xslt",$XsltSettings, $null) $XslPath.Transform("nswdb.xml", "missinggames.xml") @@ -10,8 +16,13 @@ try $XslPath.Transform("SBM_Local.xml", "SBM_Local.html") $XslPath.Transform("SBM_NSP_Local.xml", "SBM_NSP_Local.html") $XslPath.Transform("missinggames.xml", "missing.html") + $XslPath.Transform("allgames.xml", "allgames.html") Write-Host "Done !" + + if ($openResult -eq "y") { + ./index.html + } } catch {