diff --git a/MedLaunch/MainWindow.xaml b/MedLaunch/MainWindow.xaml
index 9a7b780..d8079f2 100644
--- a/MedLaunch/MainWindow.xaml
+++ b/MedLaunch/MainWindow.xaml
@@ -94,9 +94,7 @@
-
+
diff --git a/MedLaunch/MainWindow.xaml.cs b/MedLaunch/MainWindow.xaml.cs
index ac87848..d169535 100644
--- a/MedLaunch/MainWindow.xaml.cs
+++ b/MedLaunch/MainWindow.xaml.cs
@@ -4426,6 +4426,19 @@ private void rbSettings_Netplay_Checked(object sender, RoutedEventArgs e)
if (SettingsDirtyFlag == true)
ConfigsVisualHandler.SaveSettings(SettingGroup.NetplaySettings);
}
+
+ private async void AuditScrapedData_Click(object sender, RoutedEventArgs e)
+ {
+ MainWindow mw = Application.Current.Windows.OfType().FirstOrDefault();
+ await mw.ShowChildWindowAsync(new ScrapedDataAudit()
+ {
+ IsModal = true,
+ AllowMove = false,
+ Title = "Scraped Data Folder Audit",
+ CloseOnOverlay = false,
+ ShowCloseButton = false
+ }, RootGrid);
+ }
}
/*
public class SliderIgnoreDelta : Slider
diff --git a/MedLaunch/MedLaunch.csproj b/MedLaunch/MedLaunch.csproj
index ce71436..3cc91e0 100644
--- a/MedLaunch/MedLaunch.csproj
+++ b/MedLaunch/MedLaunch.csproj
@@ -358,6 +358,9 @@
+
+ ScrapedDataAudit.xaml
+
Designer
@@ -403,6 +406,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
diff --git a/MedLaunch/ScrapedDataAudit.xaml b/MedLaunch/ScrapedDataAudit.xaml
new file mode 100644
index 0000000..b4771fb
--- /dev/null
+++ b/MedLaunch/ScrapedDataAudit.xaml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MedLaunch/ScrapedDataAudit.xaml.cs b/MedLaunch/ScrapedDataAudit.xaml.cs
new file mode 100644
index 0000000..0fa47ba
--- /dev/null
+++ b/MedLaunch/ScrapedDataAudit.xaml.cs
@@ -0,0 +1,141 @@
+using MahApps.Metro.SimpleChildWindow;
+using MedLaunch.Models;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace MedLaunch
+{
+ ///
+ /// Interaction logic for ScrapedDataAudit.xaml
+ ///
+ public partial class ScrapedDataAudit : ChildWindow
+ {
+ public List Data { get; set; }
+ public string BaseFolder { get; set; }
+ public List Master { get; set; }
+
+ public ScrapedDataAudit()
+ {
+ InitializeComponent();
+
+ Data = new List();
+
+ // load the MasterGames.json
+ if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\System\\MasterGames.json"))
+ {
+ MessageBox.Show("Unable to locate the MasterGames.json file! MedLaunch re-install may be necessary..");
+ this.Close();
+ }
+
+ string json = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\System\\MasterGames.json");
+ Master = JsonConvert.DeserializeObject>(json);
+
+ // enumerate game data folder
+ BaseFolder = AppDomain.CurrentDomain.BaseDirectory + "\\Data\\Games";
+
+ var fol = Directory.GetDirectories(BaseFolder);
+ foreach (var d in fol)
+ {
+ string fName = System.IO.Path.GetFileName(d);
+
+ // check whether folder name is a valid number
+ int n;
+ bool isNumeric = int.TryParse(fName, out n);
+ if (isNumeric == false)
+ continue;
+
+ // build folderdata object
+ FolderData fd = new FolderData();
+ fd.FolderName = n;
+
+ // find gdbid from Master
+ var g = (from a in Master
+ where a.GamesDbId == n
+ select a).FirstOrDefault();
+
+ // is result empty?
+ if (g == null)
+ continue;
+
+ fd.GameName = g.TGDBData.GamesDBTitle;
+ fd.System = GSystem.GetSystemName(Convert.ToInt32(g.MedLaunchSystemId));
+
+ // now check whether it is linked anywhere in the database
+ var search = from a in Game.GetGames()
+ where a.gdbId == n
+ select a;
+
+ if (search.Count() > 0)
+ {
+ fd.IsLinked = true;
+ }
+ else
+ {
+ fd.IsLinked = false;
+ }
+
+ // add to list
+ Data.Add(fd);
+ }
+
+ Data.OrderBy(a => a.FolderName);
+
+ // populate the datagrid
+ dgAudit.ItemsSource = Data;
+ }
+
+ private void CloseSec_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void btnLocal_Click(object sender, RoutedEventArgs e)
+ {
+ // get the id
+ var r = (FolderData)dgAudit.SelectedItem;
+ string gdbid = r.FolderName.ToString();
+
+ // open the folder in windows explorer
+ string dirPath = System.AppDomain.CurrentDomain.BaseDirectory + @"\Data\Games\" + gdbid;
+ // check folder exists
+ if (Directory.Exists(dirPath))
+ {
+ // open the folder
+ Process.Start(dirPath);
+ }
+ }
+
+ private void btnOnline_Click(object sender, RoutedEventArgs e)
+ {
+ // get the id
+ var r = (FolderData)dgAudit.SelectedItem;
+ string gdbid = r.FolderName.ToString();
+
+ // open thegamesdb.net url in the default browser
+ string url = @"http://thegamesdb.net/game/" + gdbid;
+ Process.Start(url);
+ }
+ }
+
+ public class FolderData
+ {
+ public int FolderName { get; set; } // gdbid
+ public string System { get; set; }
+ public string GameName { get; set; }
+ public bool IsLinked { get; set; }
+ }
+}