fixed some minor issues with CDs
All checks were successful
Java CI / test (push) Successful in 1m25s

This commit is contained in:
WeeXnes 2025-04-27 21:48:23 +02:00
parent 1eaf8c2580
commit bc0ac93f3f
3 changed files with 23 additions and 6 deletions

View file

@ -167,11 +167,14 @@ public class Game
public async Task CopyIsoWithProgressAsync()
{
Console.Info("Copying ISO file for " + this + "...");
string targetDirectory = settings.library_path.GetValue<string>();
Util.CheckDir(Path.Combine(targetDirectory, "DVD"));
string targetDirectory = "";
if (this.Icon.type == DiscType.DVD)
targetDirectory = Path.Combine(settings.library_path.GetValue<string>(), "DVD");
if (this.Icon.type == DiscType.CD)
targetDirectory = Path.Combine(settings.library_path.GetValue<string>(), "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];

View file

@ -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;

View file

@ -136,6 +136,12 @@ public partial class MainWindow : Window
private async void Control_OnLoaded(object? sender, RoutedEventArgs e)
{
Util.CheckDir(settings.library_path.GetValue<string>());
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "DVD"));
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "CD"));
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "CFG"));
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "ART"));
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "VMC"));
FetchGamesFromLibrary();
}
@ -144,9 +150,16 @@ public partial class MainWindow : Window
SwitchView(true);
Console.Info("Fetching games from library...");
List<Game> Games = new List<Game>();
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "DVD"));
string[] files = Directory.GetFiles(Path.Combine(settings.library_path.GetValue<string>(), "DVD"));
foreach (var file in files)
string[] filesDVDDir = Directory.GetFiles(Path.Combine(settings.library_path.GetValue<string>(), "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<string>(), "CD"));
foreach (var file in filesCDDir)
{
Game newGame =
new Game(file, true);