diff --git a/FGH3ChartBrowser.csproj b/FGH3ChartBrowser.csproj
index 46033ec..a962739 100644
--- a/FGH3ChartBrowser.csproj
+++ b/FGH3ChartBrowser.csproj
@@ -8,10 +8,10 @@
true
icon.png
favicon.ico
- 1.1.1.0
- 1.1.1.0
+ 1.2.0.0
+ 1.2.0.0
Debug;Release
- $(VersionPrefix)1.1.1
+ $(VersionPrefix)1.2.0
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 29190df..608dc01 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -1,11 +1,11 @@
-
+ Title="FastGH3 Chart Browser v1.2.0" Height="596" Width="800" ResizeMode="CanMinimize" Background="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}" Icon="/icon.png">
@@ -18,11 +18,11 @@
-
+
-
+
@@ -31,9 +31,20 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index bbf696f..47e438a 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -44,24 +44,82 @@ public partial class MainWindow : Window
public BackgroundWorker AlbumLoadBgWorker;
public string currentLoadingPhrase;
public SysConfig.Configuration config;
+ public BitmapSource bmpSrc;
+ public Bitmap bmp;
public MainWindow()
{
scanFolder = "";
songList = new List() { };
InitializeComponent();
+ RefreshSongInfo();
totalSongs = 0;
scannedSongs = 0;
SongsDataGrid.ItemsSource = songList;
ScanBgWorker = new BackgroundWorker();
AlbumLoadBgWorker = new BackgroundWorker();
- Thread.Sleep(10);
+ currentLoadingPhrase = "";
+ config = SysConfig.ConfigurationManager.OpenExeConfiguration(SysConfig.ConfigurationUserLevel.None);
+ bmpSrc = new BitmapImage();
+ bmp = new Bitmap(4,4);
LoadConfig();
}
+ private void RefreshSongInfo(SongEntry song)
+ {
+ LoadingPhraseTxt.Text = song.LoadingPhrase;
+ SongTitleTxt.Content = song.Title;
+ ArtistTxt.Text = song.Artist;
+ AlbumTxt.Text = "Album: " + song.Album;
+ GenreTxt.Text = "Genre: " + song.Genre;
+ string yearStr = "";
+ if (song.Year > 0) yearStr = int.Clamp(song.Year, 0, 99999).ToString();
+ YearTxt.Content = $"Year: {yearStr}";
+ LeadDiffTxt.Content = $"Lead Intensity: {int.Clamp(song.IntensityLead, 0, 99)}";
+ BassDiffTxt.Content = $"Bass Intensity: {int.Clamp(song.IntensityBass, 0, 99)}";
+ if (song.IntensityLead > 99) LeadDiffTxt.Content += "+";
+ if (song.IntensityBass > 99) BassDiffTxt.Content += "+";
+ string starsLead = "";
+ string starsBass = "";
+ if (song.IntensityLead >= 0)
+ {
+ int i = 1;
+ for (i = 1; i <= 9; i++)
+ {
+ if (i <= song.IntensityLead) starsLead += "★";
+ else if (i <= 6) starsLead += "☆";
+ }
+ if (song.IntensityLead > 9) starsLead += "+";
+ }
+ if (song.IntensityBass >= 0)
+ {
+ int i = 1;
+ for (i = 1; i <= 9; i++)
+ {
+ if (i <= song.IntensityBass) starsBass += "★";
+ else if (i <= 6) starsBass += "☆";
+ }
+ if (song.IntensityBass > 9) starsBass += "+";
+ }
+ LeadStarsTxt.Content = starsLead;
+ BassStarsTxt.Content = starsBass;
+ }
+ private void RefreshSongInfo()
+ {
+ LoadingPhraseTxt.Text = "";
+ SongTitleTxt.Content = "";
+ ArtistTxt.Text = "";
+ AlbumTxt.Text = "Album: ";
+ GenreTxt.Text = "Genre: ";
+ YearTxt.Content = "Year: ";
+ LeadDiffTxt.Content = "Lead Intensity: ";
+ BassDiffTxt.Content = "Bass Intensity: ";
+ LeadStarsTxt.Content = "☆☆☆☆☆☆";
+ BassStarsTxt.Content = "☆☆☆☆☆☆";
+ }
+
private void LoadConfig()
{
- config = SysConfig.ConfigurationManager.OpenExeConfiguration(SysConfig.ConfigurationUserLevel.None);
FGH3_Path_TxtBox.Text = config.AppSettings.Settings["fastgh3_exe_location"].Value;
if (String.IsNullOrEmpty(FGH3_Path_TxtBox.Text))
{
@@ -93,11 +151,11 @@ private void GH3PathBrowseBtn_Click(object sender, RoutedEventArgs e)
}
}
- private async void ScanSongs(object sender, DoWorkEventArgs e)
+ private async void ScanSongs(object? sender, DoWorkEventArgs e)
{
string searchPath = scanFolder;
- BackgroundWorker bw = sender as BackgroundWorker;
- if (!String.IsNullOrWhiteSpace(searchPath) && System.IO.Path.Exists(searchPath) && bw != null)
+ //BackgroundWorker bw = sender as BackgroundWorker;
+ if (!String.IsNullOrWhiteSpace(searchPath) && System.IO.Path.Exists(searchPath))
{
IEnumerable charts = Directory.EnumerateFiles(searchPath, "notes.chart", SearchOption.AllDirectories);
IEnumerable midis = Directory.EnumerateFiles(searchPath, "notes.mid", SearchOption.AllDirectories);
@@ -111,14 +169,14 @@ private async void ScanSongs(object sender, DoWorkEventArgs e)
foreach (string chart in charts)
{
FileInfo fileInfo = new FileInfo(chart);
- string chartDir = fileInfo.Directory.FullName;
+ string chartDir = "" + fileInfo.Directory?.FullName;
string[] songIniFiles = Directory.GetFiles(chartDir, "song.ini", SearchOption.TopDirectoryOnly);
if (songIniFiles != null)
{
if (songIniFiles.Length > 0)
{
- SongEntry songEntry = new SongEntry();
- IConfiguration config = null;
+ SongEntry songEntry = new SongEntry(chart);
+ IConfiguration songIniConfig = null;
string artist = "Unknown Artist";
string title = "Unknown Title";
string album = "Unknown Album";
@@ -128,21 +186,26 @@ private async void ScanSongs(object sender, DoWorkEventArgs e)
int year = 0;
try
{
- config = new ConfigurationBuilder().AddIniFile(songIniFiles[0]).Build();
- IConfigurationSection songSect = config.GetSection("song");
+ songIniConfig = new ConfigurationBuilder().AddIniFile(songIniFiles[0]).Build();
+ IConfigurationSection songSect = songIniConfig.GetSection("song");
artist = RemoveHtml(songSect["artist"] + "");
title = RemoveHtml(songSect["name"] + "");
album = RemoveHtml(songSect["album"] + "");
charter = RemoveHtml(songSect["charter"] + "");
genre = RemoveHtml(songSect["genre"] + "");
- loadingPhrase += RemoveHtml((songSect["loading_phrase"]+"").Replace("
", "\n"));
- int.TryParse(config.GetSection("song")["year"], out year);
+ loadingPhrase += RemoveHtml((songSect["loading_phrase"] + "").Replace("
", "\n"));
+ int.TryParse(songIniConfig.GetSection("song")["year"], out year);
+ int diffLead = 0;
+ int diffBass = 0;
+ int.TryParse(songIniConfig.GetSection("song")["diff_guitar"], out diffLead);
+ if (!int.TryParse(songIniConfig.GetSection("song")["diff_bass"], out diffBass))
+ {
+ int.TryParse(songIniConfig.GetSection("song")["diff_rhythm"], out diffBass);
+ }
+ songEntry.IntensityLead = int.Clamp(diffLead, 0, 100);
+ songEntry.IntensityBass = int.Clamp(diffBass, 0, 100);
}
catch { }
- if (String.IsNullOrWhiteSpace(artist)) artist = "Unknown Artist";
- if (String.IsNullOrWhiteSpace(title)) title = "Unknown Title";
- if (String.IsNullOrWhiteSpace(album)) album = "Unknown Album";
- if (String.IsNullOrWhiteSpace(charter)) charter = "Unknown Charter";
songEntry.Artist = "" + artist;
songEntry.Title = "" + title;
songEntry.Album = "" + album;
@@ -161,19 +224,19 @@ private async void ScanSongs(object sender, DoWorkEventArgs e)
totalSongs -= 1;
}
scanProgress = scannedSongs / totalSongs * 100;
- bw.ReportProgress(scanProgress);
+ // bw.ReportProgress(scanProgress);
}
foreach (string midi in midis)
{
FileInfo fileInfo = new FileInfo(midi);
- string chartDir = fileInfo.Directory.FullName;
+ string chartDir = "" + fileInfo.Directory?.FullName;
string[] songIniFiles = Directory.GetFiles(chartDir, "song.ini", SearchOption.TopDirectoryOnly);
if (songIniFiles != null)
{
if (songIniFiles.Length > 0)
{
- SongEntry songEntry = new SongEntry();
- IConfiguration config = null;
+ SongEntry songEntry = new SongEntry(midi);
+ IConfiguration songIniConfig = null;
string artist = "Unknown Artist";
string title = "Unknown Title";
string album = "Unknown Album";
@@ -183,21 +246,25 @@ private async void ScanSongs(object sender, DoWorkEventArgs e)
int year = 0;
try
{
- config = new ConfigurationBuilder().AddIniFile(songIniFiles[0]).Build();
- IConfigurationSection songSect = config.GetSection("song");
+ songIniConfig = new ConfigurationBuilder().AddIniFile(songIniFiles[0]).Build();
+ IConfigurationSection songSect = songIniConfig.GetSection("song");
artist = RemoveHtml(songSect["artist"] + "");
title = RemoveHtml(songSect["name"] + "");
album = RemoveHtml(songSect["album"] + "");
charter = RemoveHtml(songSect["charter"] + "");
genre = RemoveHtml(songSect["genre"] + "");
loadingPhrase += RemoveHtml((songSect["loading_phrase"] + "").Replace("
","\n"));
- int.TryParse(config.GetSection("song")["year"], out year);
+ int.TryParse(songIniConfig.GetSection("song")["year"], out year);
+ int diffLead = 0;
+ int diffBass = 0;
+ int.TryParse(songIniConfig.GetSection("song")["diff_guitar"], out diffLead); if (!int.TryParse(songIniConfig.GetSection("song")["diff_bass"], out diffBass))
+ {
+ int.TryParse(songIniConfig.GetSection("song")["diff_rhythm"], out diffBass);
+ }
+ songEntry.IntensityLead = int.Clamp(diffLead, 0, 100);
+ songEntry.IntensityBass = int.Clamp(diffBass, 0, 100);
}
catch { }
- if (String.IsNullOrWhiteSpace(artist)) artist = "Unknown Artist";
- if (String.IsNullOrWhiteSpace(title)) title = "Unknown Title";
- if (String.IsNullOrWhiteSpace(album)) album = "Unknown Album";
- if (String.IsNullOrWhiteSpace(charter)) charter = "Unknown Charter";
songEntry.Artist = "" + artist;
songEntry.Title = "" + title;
songEntry.Album = "" + album;
@@ -216,13 +283,12 @@ private async void ScanSongs(object sender, DoWorkEventArgs e)
totalSongs -= 1;
}
scanProgress = scannedSongs / totalSongs * 100;
- bw.ReportProgress(scanProgress);
+ //bw.ReportProgress(scanProgress);
}
foreach (string sngPath in sngs)
{
FileInfo fileInfo = new FileInfo(sngPath);
- // I think I got this done correctly...?
- SongEntry songEntry = new SongEntry();
+ SongEntry songEntry = new SongEntry(sngPath);
songEntry.Genre = "";
songEntry.LoadingPhrase = "";
songEntry.Year = 0;
@@ -235,18 +301,28 @@ private async void ScanSongs(object sender, DoWorkEventArgs e)
string charter = "";
string genre = "";
string loadingPhrase = "";
+ string diffLeadStr = "";
+ string diffBassStr = "";
+ int diffLead = 0;
+ int diffBass = 0;
sngData.meta.TryGetValue("artist", out artist);
sngData.meta.TryGetValue("name", out title);
sngData.meta.TryGetValue("album", out album);
sngData.meta.TryGetValue("genre", out genre);
sngData.meta.TryGetValue("charter", out charter);
sngData.meta.TryGetValue("loading_phrase", out loadingPhrase);
- songEntry.Title = "" + title;
- songEntry.Artist = "" + artist;
- songEntry.Album = "" + album;
- songEntry.Genre = "" + genre;
- songEntry.Charter = "" + charter;
- songEntry.LoadingPhrase = "" + loadingPhrase;
+ sngData.meta.TryGetValue("diff_guitar", out diffLeadStr);
+ sngData.meta.TryGetValue("diff_rhythm", out diffBassStr);
+ int.TryParse(diffLeadStr, out diffLead);
+ int.TryParse(diffBassStr, out diffBass);
+ songEntry.IntensityLead = int.Clamp(diffLead, 0, 100);
+ songEntry.IntensityBass = int.Clamp(diffBass, 0, 100);
+ songEntry.Title = "" + RemoveHtml(title);
+ songEntry.Artist = "" + RemoveHtml(artist);
+ songEntry.Album = "" + RemoveHtml(album);
+ songEntry.Genre = "" + RemoveHtml(genre);
+ songEntry.Charter = "" + RemoveHtml(charter);
+ songEntry.LoadingPhrase = "" + RemoveHtml(("" + loadingPhrase).Replace("
","\n"));
int year = 0;
int.TryParse(sngData.meta["year"], out year);
songEntry.Year = year;
@@ -270,6 +346,7 @@ private void UpdateScanProgress(object? sender, ProgressChangedEventArgs e)
}
+
private void FinishedScanning(object? sender, RunWorkerCompletedEventArgs e)
{
SongsDataGrid.ItemsSource = songList;
@@ -281,6 +358,11 @@ private void FinishedScanning(object? sender, RunWorkerCompletedEventArgs e)
ScanChartsBtn.IsEnabled = true;
}
+ private void AlbumClick(object sender, RoutedEventArgs e)
+ {
+ // TO DO: figure out making a popup with album image
+ }
+
private void ScanChartsBtn_Click(object sender, RoutedEventArgs e)
{
ScanChartsBtn.IsEnabled = false;
@@ -364,11 +446,14 @@ private void PlaySong()
if (index >= 0)
{
var entry = SongsDataGrid.SelectedItems[0];
- if (entry.GetType() == typeof(SongEntry))
+ if (entry != null)
{
- string shart = (entry as SongEntry).Path;
- if (System.IO.Path.Exists(FGH3_Path_TxtBox.Text))
- System.Diagnostics.Process.Start(FGH3_Path_TxtBox.Text, "\"" + shart + "\"");
+ if (entry.GetType() == typeof(SongEntry))
+ {
+ string shart = (entry as SongEntry)?.Path + "";
+ if (System.IO.Path.Exists(FGH3_Path_TxtBox.Text))
+ System.Diagnostics.Process.Start(FGH3_Path_TxtBox.Text, "\"" + shart + "\"");
+ }
}
}
}
@@ -379,9 +464,6 @@ private void FGH3SettingsBtn_Click(object sender, RoutedEventArgs e)
System.Diagnostics.Process.Start(FGH3_Path_TxtBox.Text, "-settings");
}
- public BitmapSource bmpSrc;
- public Bitmap bmp;
-
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern bool DeleteObject(IntPtr hObject);
@@ -421,7 +503,6 @@ private void SetAlbumArt(object? sender, RunWorkerCompletedEventArgs? e)
AlbumRect.Fill = new ImageBrush(bmpSrc);
AlbumRect.Visibility = Visibility.Visible;
}
-
private void SongsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (SongsDataGrid.SelectedItem != null)
@@ -431,7 +512,7 @@ private void SongsDataGrid_SelectionChanged(object sender, SelectionChangedEvent
{
SongEntry song = (SongEntry)entry;
currentLoadingPhrase = song.LoadingPhrase;
- LoadingPhraseTxt.Text = song.LoadingPhrase;
+ RefreshSongInfo(song);
if (song.Path.ToLower().EndsWith(".chart") || song.Path.ToLower().EndsWith(".mid"))
{
string? folder = new FileInfo(song.Path).DirectoryName;
@@ -439,13 +520,13 @@ private void SongsDataGrid_SelectionChanged(object sender, SelectionChangedEvent
if (albumCandidates.Length > 0)
{
LoadAlbumArtFromBitmap(albumCandidates[0]);
+ SetAlbumArt(null, null);
}
else AlbumRect.Visibility = Visibility.Hidden;
}
if (song.Path.EndsWith(".sng"))
{
-
try
{
Sng sng = Sng.Load(song.Path);
@@ -471,7 +552,7 @@ private void SongsDataGrid_SelectionChanged(object sender, SelectionChangedEvent
AlbumRect.Visibility = Visibility.Hidden;
}
}
- catch (Exception ex) { }
+ catch { }
}
}
}
@@ -482,6 +563,24 @@ private void SongsDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs
{
// PlaySong(); // TO DO: Find a better way to implement quickly selecting a song to play?
}
+
+ private void OpenInExplorerBtn_Click(object sender, RoutedEventArgs e)
+ {
+ if (SongsDataGrid.SelectedItem != null)
+ {
+ var entry = SongsDataGrid.SelectedItem;
+ if (entry.GetType() == typeof(SongEntry))
+ {
+ SongEntry song = (SongEntry)entry;
+ FileInfo fileInfo = new FileInfo(song.Path);
+ string songDir = "" + fileInfo.Directory?.FullName;
+ if (File.Exists(song.Path))
+ System.Diagnostics.Process.Start("explorer.exe", $"/select, \"{song.Path}\"");
+ else
+ System.Diagnostics.Process.Start("explorer.exe", songDir);
+ }
+ }
+ }
}
public class SongEntry
{
@@ -493,5 +592,21 @@ public class SongEntry
public string Genre { get; set; }
public string Path { get; set; }
public string LoadingPhrase { get; set; }
+ public int IntensityLead { get; set; }
+ public int IntensityBass { get; set; }
+
+ public SongEntry(string path = "", string artist = "Unknown Artist", string title = "Unknown Title", string album = "Unknown Album", string charter = "", int year = 0, string genre = "", string loadingPhrase = "", int intensityLead = 0, int intensityBass = 0)
+ {
+ Artist = artist;
+ Title = title;
+ Album = album;
+ Charter = charter;
+ Year = year;
+ Genre = genre;
+ Path = path;
+ LoadingPhrase = loadingPhrase;
+ IntensityLead = intensityLead;
+ IntensityBass = intensityBass;
+ }
}
}
\ No newline at end of file