diff --git a/PS2_Manager/Core/Game.cs b/PS2_Manager/Core/Game.cs index 694b1fb..e71843d 100644 --- a/PS2_Manager/Core/Game.cs +++ b/PS2_Manager/Core/Game.cs @@ -167,11 +167,14 @@ public class Game public async Task CopyIsoWithProgressAsync() { Console.Info("Copying ISO file for " + this + "..."); - string targetDirectory = settings.library_path.GetValue(); - Util.CheckDir(Path.Combine(targetDirectory, "DVD")); + string targetDirectory = ""; + if (this.Icon.type == DiscType.DVD) + targetDirectory = Path.Combine(settings.library_path.GetValue(), "DVD"); + if (this.Icon.type == DiscType.CD) + targetDirectory = Path.Combine(settings.library_path.GetValue(), "CD"); string newFileName = $"{this.GameID}.{this.Name}.iso"; - string destPath = Path.Combine(Path.Combine(targetDirectory, "DVD"), newFileName); + string destPath = Path.Combine(targetDirectory, newFileName); const int bufferSize = 1024 * 1024; byte[] buffer = new byte[bufferSize]; diff --git a/PS2_Manager/Core/Globals.cs b/PS2_Manager/Core/Globals.cs index e6d4f3c..3b5a8a6 100644 --- a/PS2_Manager/Core/Globals.cs +++ b/PS2_Manager/Core/Globals.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; using Avalonia.Platform.Storage; +using Microsoft.VisualBasic.CompilerServices; namespace PS2_Manager.Core; diff --git a/PS2_Manager/MainWindow.axaml.cs b/PS2_Manager/MainWindow.axaml.cs index d357401..6983a18 100644 --- a/PS2_Manager/MainWindow.axaml.cs +++ b/PS2_Manager/MainWindow.axaml.cs @@ -136,6 +136,12 @@ public partial class MainWindow : Window private async void Control_OnLoaded(object? sender, RoutedEventArgs e) { + Util.CheckDir(settings.library_path.GetValue()); + Util.CheckDir(Path.Combine(settings.library_path.GetValue(), "DVD")); + Util.CheckDir(Path.Combine(settings.library_path.GetValue(), "CD")); + Util.CheckDir(Path.Combine(settings.library_path.GetValue(), "CFG")); + Util.CheckDir(Path.Combine(settings.library_path.GetValue(), "ART")); + Util.CheckDir(Path.Combine(settings.library_path.GetValue(), "VMC")); FetchGamesFromLibrary(); } @@ -144,9 +150,16 @@ public partial class MainWindow : Window SwitchView(true); Console.Info("Fetching games from library..."); List Games = new List(); - Util.CheckDir(Path.Combine(settings.library_path.GetValue(), "DVD")); - string[] files = Directory.GetFiles(Path.Combine(settings.library_path.GetValue(), "DVD")); - foreach (var file in files) + string[] filesDVDDir = Directory.GetFiles(Path.Combine(settings.library_path.GetValue(), "DVD")); + foreach (var file in filesDVDDir) + { + Game newGame = + new Game(file, true); + Games.Add(newGame); + Console.Success("Successfully fetched " + newGame); + } + string[] filesCDDir = Directory.GetFiles(Path.Combine(settings.library_path.GetValue(), "CD")); + foreach (var file in filesCDDir) { Game newGame = new Game(file, true);