Skip to content

Commit

Permalink
Added online version checker.
Browse files Browse the repository at this point in the history
Updated gdishrink blacklist. It's based on the huge list from Xerxes3rd.
  • Loading branch information
sonik-br committed Jan 18, 2021
1 parent bb7ba68 commit e96fba4
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 9 deletions.
9 changes: 8 additions & 1 deletion src/GDMENUCardManager/AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<FlowDocument>
<Paragraph>
<Bold>
<Run Text="{Binding TitleAndVersion, Mode=OneTime}"/> - by Sonik
GD MENU Card Manager - by Sonik
</Bold>
<LineBreak/>
Tool to manage games on SD card - For use with GDEMU/GDMENU
Expand Down Expand Up @@ -207,5 +207,12 @@

</FlowDocument>
</FlowDocumentScrollViewer>
<GroupBox Header="Version" Width="100" Height="80" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0 0 10 0">
<StackPanel>
<TextBlock Text="{Binding CurrentVersion, Mode=OneTime, StringFormat='Current: {0}'}"/>
<TextBlock Text="{Binding LatestVersion, Mode=OneWay, StringFormat='Latest: {0}'}"/>
<Button Click="ButtonVersion_Click">Check Online</Button>
</StackPanel>
</GroupBox>
</Grid>
</Window>
71 changes: 69 additions & 2 deletions src/GDMENUCardManager/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +17,39 @@ namespace GDMENUCardManager
/// <summary>
/// Interaction logic for AboutWindow.xaml
/// </summary>
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<Key> lastKeys = new Queue<Key>(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();
Expand Down Expand Up @@ -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; }
}
}
28 changes: 28 additions & 0 deletions src/GDMENUCardManager/GDMENUCardManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -48,6 +63,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -181,5 +197,17 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
8 changes: 8 additions & 0 deletions src/GDMENUCardManager/GDMENUCardManager.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/GDMENUCardManager/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<Window.Resources>
<ResourceDictionary>
Expand Down
5 changes: 4 additions & 1 deletion src/GDMENUCardManager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public partial class MainWindow : Window, IDropTarget, INotifyPropertyChanged

public ObservableCollection<DriveInfo> DriveList { get; private set; } = new ObservableCollection<DriveInfo>();

public string Version { get; } = "v1.2.2";


private bool _IsBusy;
public bool IsBusy
{
Expand Down Expand Up @@ -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;

Expand Down
33 changes: 29 additions & 4 deletions src/GDMENUCardManager/gdishrink_blacklist.txt
Original file line number Diff line number Diff line change
@@ -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)[!]
Expand Down

0 comments on commit e96fba4

Please sign in to comment.