diff --git a/src/GDMENUCardManager/AboutWindow.xaml b/src/GDMENUCardManager/AboutWindow.xaml index de18f65..b1e1e5a 100644 --- a/src/GDMENUCardManager/AboutWindow.xaml +++ b/src/GDMENUCardManager/AboutWindow.xaml @@ -11,7 +11,7 @@ - - by Sonik + GD MENU Card Manager - by Sonik Tool to manage games on SD card - For use with GDEMU/GDMENU @@ -207,5 +207,12 @@ + + + + + + + diff --git a/src/GDMENUCardManager/AboutWindow.xaml.cs b/src/GDMENUCardManager/AboutWindow.xaml.cs index cee8dd5..0e1d389 100644 --- a/src/GDMENUCardManager/AboutWindow.xaml.cs +++ b/src/GDMENUCardManager/AboutWindow.xaml.cs @@ -1,6 +1,12 @@ using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Linq; +using System.Net; +using System.Net.Http; +using System.Runtime.CompilerServices; +using System.Runtime.Serialization.Json; +using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -11,13 +17,39 @@ namespace GDMENUCardManager /// /// Interaction logic for AboutWindow.xaml /// - public partial class AboutWindow : Window + public partial class AboutWindow : Window, INotifyPropertyChanged { - public string TitleAndVersion { get; set; } + public string CurrentVersion { get; set; } + + private string _LatestVersion = "?"; + public string LatestVersion + { + get { return _LatestVersion; } + set { _LatestVersion = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LatestVersion))); } + } + + private static HttpClient _Client = null; + private HttpClient Client + { + get + { + if (_Client == null) + { + _Client = new HttpClient(); + _Client.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.github.v3+json"); + _Client.DefaultRequestHeaders.UserAgent.ParseAdd(@"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; + } + return _Client; + } + } private readonly Queue lastKeys = new Queue(10); private readonly Key[] konamiCodeKeys = new Key[] { Key.Up, Key.Up, Key.Down, Key.Down, Key.Left, Key.Right, Key.Left, Key.Right, Key.B, Key.A }; + public event PropertyChangedEventHandler PropertyChanged; + + public AboutWindow() { InitializeComponent(); @@ -51,5 +83,40 @@ private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation. Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled = true; } + + private async void ButtonVersion_Click(object sender, RoutedEventArgs e) + { + var btn = (Button)sender; + var oldContent = btn.Content; + btn.IsEnabled = false; + btn.Content = "Checking..."; + try + { + using (var response = await Client.GetAsync("https://api.github.com/repos/sonik-br/GDMENUCardManager/releases/latest", new CancellationTokenSource(10000).Token))//token for time out + { + response.EnsureSuccessStatusCode(); + using (var stream = await response.Content.ReadAsStreamAsync()) + { + var serializer = new DataContractJsonSerializer(typeof(GitLatest)); + var obj = serializer.ReadObject(stream) as GitLatest; + LatestVersion = obj.tag_name; + } + } + } + catch + { + LatestVersion = "Error"; + } + finally + { + btn.IsEnabled = true; + btn.Content = oldContent; + } + } + } + + public class GitLatest + { + public string tag_name { get; set; } } } diff --git a/src/GDMENUCardManager/GDMENUCardManager.csproj b/src/GDMENUCardManager/GDMENUCardManager.csproj index 3882f51..45e41fb 100644 --- a/src/GDMENUCardManager/GDMENUCardManager.csproj +++ b/src/GDMENUCardManager/GDMENUCardManager.csproj @@ -14,6 +14,21 @@ 4 true true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true AnyCPU @@ -48,6 +63,7 @@ + @@ -181,5 +197,17 @@ PreserveNewest + + + False + Microsoft .NET Framework 4.5.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + \ No newline at end of file diff --git a/src/GDMENUCardManager/GDMENUCardManager.csproj.user b/src/GDMENUCardManager/GDMENUCardManager.csproj.user index 1dec02f..c6834b6 100644 --- a/src/GDMENUCardManager/GDMENUCardManager.csproj.user +++ b/src/GDMENUCardManager/GDMENUCardManager.csproj.user @@ -2,5 +2,13 @@ ProjectFiles + + + + + + + en-US + false \ No newline at end of file diff --git a/src/GDMENUCardManager/MainWindow.xaml b/src/GDMENUCardManager/MainWindow.xaml index 7ab7565..835ec43 100644 --- a/src/GDMENUCardManager/MainWindow.xaml +++ b/src/GDMENUCardManager/MainWindow.xaml @@ -7,7 +7,7 @@ xmlns:conv="clr-namespace:GDMENUCardManager.Converter" xmlns:dd="urn:gong-wpf-dragdrop" mc:Ignorable="d" - Title="GD MENU Card Manager 1.2.1" Height="700" Width="800" MinHeight="400" MinWidth="800" + Title="{Binding Version, Mode=OneTime, StringFormat='GD MENU Card Manager {0}'}" Height="700" Width="800" MinHeight="400" MinWidth="800" WindowStartupLocation="CenterScreen"> diff --git a/src/GDMENUCardManager/MainWindow.xaml.cs b/src/GDMENUCardManager/MainWindow.xaml.cs index 0ceadb1..b349133 100644 --- a/src/GDMENUCardManager/MainWindow.xaml.cs +++ b/src/GDMENUCardManager/MainWindow.xaml.cs @@ -55,6 +55,9 @@ public partial class MainWindow : Window, IDropTarget, INotifyPropertyChanged public ObservableCollection DriveList { get; private set; } = new ObservableCollection(); + public string Version { get; } = "v1.2.2"; + + private bool _IsBusy; public bool IsBusy { @@ -1134,7 +1137,7 @@ private async void ButtonSaveChanges_Click(object sender, RoutedEventArgs e) private void ButtonAbout_Click(object sender, RoutedEventArgs e) { //new AboutWindow() { Title = $"{this.Title} - by Sonik", Owner = this }.ShowDialog(); - new AboutWindow() { TitleAndVersion = this.Title, Owner = this }.ShowDialog(); + new AboutWindow() { CurrentVersion = Version, Owner = this }.ShowDialog(); return; IsBusy = true; diff --git a/src/GDMENUCardManager/gdishrink_blacklist.txt b/src/GDMENUCardManager/gdishrink_blacklist.txt index 62bece9..cd224c8 100644 --- a/src/GDMENUCardManager/gdishrink_blacklist.txt +++ b/src/GDMENUCardManager/gdishrink_blacklist.txt @@ -1,22 +1,47 @@ 5737;T41903N;4X4 EVO v1.001 (2000)(GOD)(US)[!] +E60D;T40509D 50;Aqua GT v1.000 (2000)(Take 2)(PAL)(M3)[!] E9E3;T15130N;Atari Anniversary Edition v1.001 (2001)(Infogrames)(US)[!][compilation] -5966;T-8117N;Bust-A-Move 4 v1.001 (2000)(Acclaim)(US)[!] +22A2;T44102N;BANG! - Gunship Elite v1.003 (2000)(Red Storm)(US)[!] +5966;T-8117N;Bust-A-Move 4 v1.001 (2000)(Acclaim)(US)[!][3S] +65E8;T40602N;Centipede v1.004 (1999)(Hasbro)(US)[!] +7544;T-8120N;Dave Mirra Freestyle BMX v1.001 (2000)(Acclaim)(US)[!][0K055A, B, D, E] 1800;T-8113N;Ducati World - Racing Challenge v1.000 (2001)(Acclaim)(US)[!] +CA6E;T22903D 50;Exhibition of Speed v1.000 (2000)(Titus)(PAL)(M6)[!] +5BE4;T45401D 50;GK - Giant Killers v1.400 (2001)(AAA Game)(PAL)[!] 7CD6;T-40502-N;Hidden & Dangerous v1.100 (2000)(Take 2)(US)[!] +0793;T7001D 50;Jimmy White's 2 - Cueball v1.100 (1999)(Virgin)(PAL)[!] +9807;T44302N;King of Fighters Evolution, The v1.000 (2000)(Agetec)(US)(M4)[!] +0EDC;T15116N;Looney Tunes Space Race v1.000 (2000)(Infogrames)(US)(M3)[!] +32DD;T40208N;Magforce Racing v1.001 (2000)(Crave)(US)(M5)[!] 076A;T11010N;Maximum Pool v1.004 (2000)(Sierra)(US)[!] +D596;T-9714N;Midway's Greatest Arcade Hits Volume 2 v1.001 (2001)(Midway)(US)[!][compilation] +5580;T1404N;Ms. Pac-Man - Maze Madness v1.000 (2000)(Namco)(US)[!] +4EFF;T10004N;MTV Sports - Skateboarding Featuring Andy Macdonald v1.002 (2000)(THQ)(US)[!] +E570;T40214N;Next Tetris, The - On-line Edition v1.100 (2000)(Crave)(US)[!] +CF3D;T-9703N;NFL Blitz 2000 v1.002 (1999)(Midway)(US)[!] +01AD;T-9703N;NFL Blitz 2000 v2.000 (1999)(Midway)(US)[!] +F9D5;T-8115N;NFL QB Club 2001 v1.001 (2000)(Acclaim)(US)[!] +EE95;T-8101N;NFL Quarterback Club 2000 v1.030 (1999)(Acclaim)(US)[!] 715E;T9504M;Nightmare Creatures II v1.000 (2000)(Konami)(US)[!] +5046;T-17713N;POD - Speedzone v1.002 (2000)(Ubi Soft)(US)[!] 4780;T40403N;Q-bert v1.003 (2000)(Majesco)(US)[!] DFDB;T41902N;Railroad Tycoon II - Gold Edition v1.004 (2000)(GOD)(US)[!] +F9C0;T40219N;Razor Freestyle Scooter v1.000 (2001)(Crave)(US)[!] 5D92;T1205N;Resident Evil 2 v1.001 (2000)(Capcom)(US)(Disc 1 of 2)[!][Leon] ... (Disc 2 of 2)[!][Claire] CC8A;T22901N;Roadsters v1.007 (2000)(Titus)(US)[!] A9CF;T40207N;SnoCross - Championship Racing v1.000 (2000)(Crave)(US)[!] +812F;T-8116N;South Park Rally v1.001 (2000)(Acclaim)(US)[!] +044D;T17718N;Speed Devils - Online Racing v1.002 (2000)(Ubi Soft)(US)[!] +D255;T-8118N;Spirit of Speed 1937 v1.001 (2000)(LJN)(US)[!] DAF7;T40209N;StarLancer v1.002 (2000)(Crave)(US)[!] A394;T12509N;Super Runabout - San Francisco Edition v1.005 (2000)(Interplay)(US)[!] 9577;TAXI2;Taxi 2 - Le Jeu v1.000 (2000)(Ubi Soft)(PAL)(FR)[!] 97D4;T40401N;Tom Clancy's Rainbow Six v1.004 (2000)(Majesco - Red Storm)(US)[!] -DA5E;T-36806N;Tomb Raider - The Last Revelation v1.001 (2000)(EIDOS)(US)[!] -D1D8;T36812N;Tomb Raider Chronicles v1.000 (2000)(EIDOS)(US)[!] -716B;T36810N;Urban Chaos v1.000 (2000)(EIDOS)(US)(en-fr)[!] +DA5E;T-36806N;Tomb Raider - The Last Revelation v1.001 (2000)(Eidos)(US)[!] +D1D8;T36812N;Tomb Raider Chronicles v1.000 (2000)(Eidos)(US)[!] +7AFB;MK-5109505;UEFA Dream Soccer v1.003 (2000)(Sega)(PAL)(M4)[!] +C114;T40204N;Ultimate Fighting Championship v1.001 (2000)(Crave)(US)[!] +716B;T36810N;Urban Chaos v1.000 (2000)(Eidos)(US)(en-fr)[!] DF23;T11011N;Who Wants to Beat Up a Millionaire v1.004 (2000)(Simon & Schuster)(US)[!] 5BF0;T42101N 00;Wild Metal v1.003 (2000)(Rockstar - Take 2)(US)(M6)[!] 4DB7;T40601N;Worms Armageddon v1.001 (1999)(MicroProse)(US)[!]