diff --git a/ChovySign-GUI/App.axaml b/ChovySign-GUI/App.axaml
index 5d4d197..7dc808a 100644
--- a/ChovySign-GUI/App.axaml
+++ b/ChovySign-GUI/App.axaml
@@ -57,15 +57,27 @@
+
+
diff --git a/ChovySign-GUI/ChovySign-GUI.csproj b/ChovySign-GUI/ChovySign-GUI.csproj
index c90598c..3c6343b 100644
--- a/ChovySign-GUI/ChovySign-GUI.csproj
+++ b/ChovySign-GUI/ChovySign-GUI.csproj
@@ -9,12 +9,13 @@
+
-
-
+
+
Never
@@ -30,4 +31,9 @@
+
+
+
+
+
diff --git a/ChovySign-GUI/Global/BrowseButton.axaml b/ChovySign-GUI/Global/BrowseButton.axaml
new file mode 100644
index 0000000..8b84e0d
--- /dev/null
+++ b/ChovySign-GUI/Global/BrowseButton.axaml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ChovySign-GUI/Global/BrowseButton.axaml.cs b/ChovySign-GUI/Global/BrowseButton.axaml.cs
new file mode 100644
index 0000000..c3e3fb2
--- /dev/null
+++ b/ChovySign-GUI/Global/BrowseButton.axaml.cs
@@ -0,0 +1,143 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace ChovySign_GUI.Global
+{
+ public partial class BrowseButton : UserControl
+ {
+ private string fileTypeName;
+ private string extension;
+
+ public event EventHandler? FileChanged;
+
+ protected virtual void OnFileChanged(EventArgs e)
+ {
+ if(FileChanged is not null)
+ FileChanged(this, e);
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return extension.Replace(".", "");
+ }
+ set
+ {
+ extension = value;
+ }
+ }
+ public string FileTypeName
+ {
+ get
+ {
+ return fileTypeName;
+ }
+ set
+ {
+ fileTypeName = value;
+ }
+ }
+ public string Watermark
+ {
+ get
+ {
+ return this.filePath.Watermark;
+ }
+ set
+ {
+ this.filePath.Watermark = value;
+ }
+ }
+ public string Label
+ {
+ get
+ {
+ string? lbl = this.browseLabel.Content as String;
+ if (lbl is null) return "";
+ else return lbl;
+ }
+ set
+ {
+ this.browseLabel.Content = value;
+ }
+ }
+ public bool ContainsFile
+ {
+ get
+ {
+ return (File.Exists(this.filePath.Text) && Path.GetExtension(this.filePath.Text).Equals("." + Extension, StringComparison.InvariantCultureIgnoreCase));
+ }
+ }
+ public string FilePath
+ {
+ get
+ {
+ if (!ContainsFile) return "";
+ return this.filePath.Text;
+ }
+ set
+ {
+ this.filePath.Text = value;
+ }
+ }
+
+ private async void browseClick(object sender, RoutedEventArgs e)
+ {
+ Button? btn = sender as Button;
+ if (btn is Button)
+ {
+ btn.IsEnabled = false;
+
+ OpenFileDialog browseDialog = new OpenFileDialog();
+ if (extension != "")
+ {
+ browseDialog.Filters = new List();
+ FileDialogFilter filter = new FileDialogFilter();
+ filter.Extensions.Add(extension);
+ filter.Name = fileTypeName;
+ browseDialog.Filters.Add(filter);
+ browseDialog.Title = "Select a " + fileTypeName + " file.";
+ }
+ else
+ {
+ browseDialog.Title = "Select a file.";
+ }
+
+
+ Window? currentWindow = this.VisualRoot as Window;
+ if (currentWindow is not Window) throw new Exception("could not find current window");
+
+ string[]? selectedFiles = await browseDialog.ShowAsync(currentWindow);
+ if (selectedFiles is not null && selectedFiles.Length > 0)
+ this.FilePath = selectedFiles.First();
+
+ btn.IsEnabled = true;
+
+ OnFileChanged(new EventArgs());
+ }
+ }
+
+ public BrowseButton()
+ {
+ InitializeComponent();
+
+ this.filePath.KeyUp += onKeyPress;
+
+ this.extension = "";
+ this.fileTypeName = "All Files";
+ }
+
+ private void onKeyPress(object? sender, KeyEventArgs e)
+ {
+ OnFileChanged(new EventArgs());
+ }
+ }
+}
diff --git a/ChovySign-GUI/Global/KeySelector.axaml b/ChovySign-GUI/Global/KeySelector.axaml
index 0084c48..ab89492 100644
--- a/ChovySign-GUI/Global/KeySelector.axaml
+++ b/ChovySign-GUI/Global/KeySelector.axaml
@@ -2,10 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="35"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="40"
x:Class="ChovySign_GUI.Global.KeySelector">
-
+
diff --git a/ChovySign-GUI/Global/LabeledTextBox.axaml b/ChovySign-GUI/Global/LabeledTextBox.axaml
new file mode 100644
index 0000000..f45ac33
--- /dev/null
+++ b/ChovySign-GUI/Global/LabeledTextBox.axaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ChovySign-GUI/Global/LabeledTextBox.axaml.cs b/ChovySign-GUI/Global/LabeledTextBox.axaml.cs
new file mode 100644
index 0000000..7986419
--- /dev/null
+++ b/ChovySign-GUI/Global/LabeledTextBox.axaml.cs
@@ -0,0 +1,49 @@
+using Avalonia.Controls;
+
+namespace ChovySign_GUI.Global
+{
+ public partial class LabeledTextBox : UserControl
+ {
+ public string Label
+ {
+ get
+ {
+ string? lbl = this.lblTxt.Content as string;
+ if (lbl is null) return "";
+ else return lbl;
+ }
+ set
+ {
+ this.lblTxt.Content = value;
+ }
+ }
+
+ public string Watermark
+ {
+ get
+ {
+ return this.txtBox.Watermark;
+ }
+ set
+ {
+ this.txtBox.Watermark = value;
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ return this.txtBox.Text;
+ }
+ set
+ {
+ this.txtBox.Text = value;
+ }
+ }
+ public LabeledTextBox()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ChovySign-GUI/Global/MessageBox.axaml b/ChovySign-GUI/Global/MessageBox.axaml
new file mode 100644
index 0000000..9ba3d78
--- /dev/null
+++ b/ChovySign-GUI/Global/MessageBox.axaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ChovySign-GUI/Global/MessageBox.axaml.cs b/ChovySign-GUI/Global/MessageBox.axaml.cs
new file mode 100644
index 0000000..65d9079
--- /dev/null
+++ b/ChovySign-GUI/Global/MessageBox.axaml.cs
@@ -0,0 +1,77 @@
+using System.Threading.Tasks;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+
+namespace ChovySign_GUI.Global
+{
+ partial class MessageBox : Window
+ {
+ public enum MessageBoxButtons
+ {
+ Ok,
+ OkCancel,
+ YesNo,
+ YesNoCancel
+ }
+
+ public enum MessageBoxResult
+ {
+ Ok,
+ Cancel,
+ Yes,
+ No
+ }
+
+ public MessageBox()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ public static Task Show(Window parent, string text, string title, MessageBoxButtons buttons)
+ {
+ var msgbox = new MessageBox()
+ {
+ Title = title
+ };
+ msgbox.FindControl("Text").Text = text;
+ var buttonPanel = msgbox.FindControl("Buttons");
+
+ var res = MessageBoxResult.Ok;
+
+ void AddButton(string caption, MessageBoxResult r, bool def = false)
+ {
+ var btn = new Button { Content = caption };
+ btn.Click += (_, __) => {
+ res = r;
+ msgbox.Close();
+ };
+ buttonPanel.Children.Add(btn);
+ if (def)
+ res = r;
+ }
+
+ if (buttons == MessageBoxButtons.Ok || buttons == MessageBoxButtons.OkCancel)
+ AddButton("Ok", MessageBoxResult.Ok, true);
+ if (buttons == MessageBoxButtons.YesNo || buttons == MessageBoxButtons.YesNoCancel)
+ {
+ AddButton("Yes", MessageBoxResult.Yes);
+ AddButton("No", MessageBoxResult.No, true);
+ }
+
+ if (buttons == MessageBoxButtons.OkCancel || buttons == MessageBoxButtons.YesNoCancel)
+ AddButton("Cancel", MessageBoxResult.Cancel, true);
+
+
+ var tcs = new TaskCompletionSource();
+ msgbox.Closed += delegate { tcs.TrySetResult(res); };
+ if (parent != null)
+ msgbox.ShowDialog(parent);
+ else msgbox.Show();
+ return tcs.Task;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/ChovySign-GUI/Global/ProgressStatus.axaml b/ChovySign-GUI/Global/ProgressStatus.axaml
index 0d5c2f7..ef262e7 100644
--- a/ChovySign-GUI/Global/ProgressStatus.axaml
+++ b/ChovySign-GUI/Global/ProgressStatus.axaml
@@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="60"
x:Class="ChovySign_GUI.Global.ProgressStatus">
diff --git a/ChovySign-GUI/MainWindow.axaml b/ChovySign-GUI/MainWindow.axaml
index 5d7e3d7..42f4cab 100644
--- a/ChovySign-GUI/MainWindow.axaml
+++ b/ChovySign-GUI/MainWindow.axaml
@@ -2,152 +2,21 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:Global="clr-namespace:ChovySign_GUI.Global"
+ xmlns:Ps1="clr-namespace:ChovySign_GUI.Ps1"
xmlns:Psp="clr-namespace:ChovySign_GUI.Psp"
- mc:Ignorable="d" d:DesignWidth="850" d:DesignHeight="850"
+ mc:Ignorable="d" d:DesignWidth="850" d:DesignHeight="950"
x:Class="ChovySign_GUI.MainWindow"
Title="Chovy Sign V2">
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
diff --git a/ChovySign-GUI/Ps1/CueSelector.axaml b/ChovySign-GUI/Ps1/CueSelector.axaml
new file mode 100644
index 0000000..de33878
--- /dev/null
+++ b/ChovySign-GUI/Ps1/CueSelector.axaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ChovySign-GUI/Ps1/CueSelector.axaml.cs b/ChovySign-GUI/Ps1/CueSelector.axaml.cs
new file mode 100644
index 0000000..82be030
--- /dev/null
+++ b/ChovySign-GUI/Ps1/CueSelector.axaml.cs
@@ -0,0 +1,88 @@
+using Avalonia.Controls;
+using System;
+using System.Collections.Generic;
+
+namespace ChovySign_GUI.Ps1
+{
+ public partial class CueSelector : UserControl
+ {
+ public event EventHandler? DiscsSelected;
+
+ protected virtual void OnDiscsSelected(EventArgs e)
+ {
+ if (DiscsSelected is not null)
+ DiscsSelected(this, e);
+ }
+
+
+ public string[] Discs
+ {
+ get
+ {
+ List discList = new List();
+
+ if (discCue1.ContainsFile) discList.Add(discCue1.FilePath);
+ else if (discCue2.ContainsFile) discList.Add(discCue2.FilePath);
+ else if (discCue3.ContainsFile) discList.Add(discCue3.FilePath);
+ else if (discCue4.ContainsFile) discList.Add(discCue4.FilePath);
+ else if (discCue5.ContainsFile) discList.Add(discCue5.FilePath);
+
+ return discList.ToArray();
+ }
+ }
+
+ public bool AnyDiscsSelected
+ {
+ get
+ {
+ return Discs.Length > 0;
+ }
+ }
+
+ private void clearAllAfter(int amt)
+ {
+ if (amt < 1) { discCue1.FilePath = ""; discCue1.IsEnabled = false; }
+ else discCue1.IsEnabled = true;
+
+ if (amt < 2) { discCue2.FilePath = ""; discCue2.IsEnabled = false; }
+ else discCue2.IsEnabled = true;
+
+ if (amt < 3) { discCue3.FilePath = ""; discCue3.IsEnabled = false; }
+ else discCue3.IsEnabled = true;
+
+ if (amt < 4) { discCue4.FilePath = ""; discCue4.IsEnabled = false; }
+ else discCue4.IsEnabled = true;
+
+ if (amt < 5) { discCue5.FilePath = ""; discCue5.IsEnabled = false; }
+ else discCue5.IsEnabled = true;
+ }
+
+ private void disableCueBoxes()
+ {
+ if (!discCue1.ContainsFile) clearAllAfter(1);
+ else if (!discCue2.ContainsFile) clearAllAfter(2);
+ else if (!discCue3.ContainsFile) clearAllAfter(3);
+ else if (!discCue4.ContainsFile) clearAllAfter(4);
+ else if (!discCue5.ContainsFile) clearAllAfter(5);
+ }
+
+ public CueSelector()
+ {
+ InitializeComponent();
+ disableCueBoxes();
+
+ discCue1.FileChanged += onFileChange;
+ discCue2.FileChanged += onFileChange;
+ discCue3.FileChanged += onFileChange;
+ discCue4.FileChanged += onFileChange;
+ discCue5.FileChanged += onFileChange;
+
+ }
+
+ private void onFileChange(object? sender, System.EventArgs e)
+ {
+ disableCueBoxes();
+ OnDiscsSelected(new EventArgs());
+ }
+ }
+}
diff --git a/ChovySign-GUI/Ps1/GameInfoSelector.axaml b/ChovySign-GUI/Ps1/GameInfoSelector.axaml
new file mode 100644
index 0000000..b902c43
--- /dev/null
+++ b/ChovySign-GUI/Ps1/GameInfoSelector.axaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ChovySign-GUI/Ps1/GameInfoSelector.axaml.cs b/ChovySign-GUI/Ps1/GameInfoSelector.axaml.cs
new file mode 100644
index 0000000..9c3ac5f
--- /dev/null
+++ b/ChovySign-GUI/Ps1/GameInfoSelector.axaml.cs
@@ -0,0 +1,149 @@
+using Avalonia.Controls;
+using Avalonia.Media.Imaging;
+using ChovySign_GUI.Global;
+using GameBuilder.Pops;
+using LibChovy.Art;
+using System;
+using System.IO;
+using System.Threading.Tasks;
+
+#pragma warning disable CS8601 // Possible null reference assignment.
+// beacuse im checking if its null in the setter, but visual studio doesnt seem to understand :d
+
+namespace ChovySign_GUI.Ps1
+{
+ public partial class GameInfoSelector : UserControl
+ {
+
+ private byte[] iconCache;
+ private byte[] pic0Cache;
+ private byte[] pic1Cache;
+
+ public byte[] Icon0
+ {
+ get
+ {
+ return iconCache;
+ }
+ set
+ {
+ if(value is not null)
+ iconCache = value;
+
+ loadIcon(iconCache);
+ }
+ }
+
+ public byte[] Pic0
+ {
+ get
+ {
+ return pic0Cache;
+ }
+ set
+ {
+ if (value is not null)
+ pic0Cache = value;
+ }
+ }
+
+ public byte[] Pic1
+ {
+ get
+ {
+ return pic1Cache;
+ }
+ set
+ {
+ if (value is not null)
+ pic1Cache = value;
+ }
+ }
+
+
+ private void loadIcon(byte[] imageData)
+ {
+ using (MemoryStream imageStream = new MemoryStream(imageData))
+ this.iconPreview.Source = new Bitmap(imageStream);
+ }
+
+ public async Task GetGameInfo(string cueFile)
+ {
+ try
+ {
+ DiscInfo disc = new DiscInfo(cueFile);
+ this.gameTitle.Text = disc.DiscName;
+
+ byte[] newCover = await Downloader.DownloadCover(disc);
+ loadIcon(newCover);
+ iconCache = newCover;
+ }
+ catch (Exception) { }
+ }
+
+ private async Task doLoad(BrowseButton imgFile, int width, int height)
+ {
+ imgFile.IsEnabled = false;
+
+ if (imgFile.FilePath != "")
+ {
+ try
+ {
+ byte[] imageData = await Resizer.LoadImage(imgFile.FilePath, width, height);
+
+ imgFile.IsEnabled = true;
+ return imageData;
+ }
+ catch (Exception)
+ {
+ Window? currentWindow = this.VisualRoot as Window;
+ if (currentWindow is not Window) throw new Exception("could not find current window");
+
+ await MessageBox.Show(currentWindow, "The image you selected is could not be loaded!", "Invalid image.", MessageBox.MessageBoxButtons.Ok);
+
+ imgFile.FilePath = "";
+ };
+ }
+
+ imgFile.IsEnabled = true;
+ return null;
+ }
+
+ private async void onIconChange(object? sender, EventArgs e)
+ {
+ BrowseButton? button = sender as BrowseButton;
+ if (button is null) return;
+ Icon0 = await doLoad(button, 80, 80);
+ }
+ private async void onPic0Change(object? sender, EventArgs e)
+ {
+ BrowseButton? button = sender as BrowseButton;
+ if (button is null) return;
+ Pic0 = await doLoad(button, 310, 180);
+ }
+ private async void onPic1Change(object? sender, EventArgs e)
+ {
+ BrowseButton? button = sender as BrowseButton;
+ if (button is null) return;
+ Pic1 = await doLoad(button, 480, 272);
+ }
+
+ public GameInfoSelector()
+ {
+ InitializeComponent();
+ iconCache = LibChovy.Resources.ICON0;
+ pic0Cache = LibChovy.Resources.PIC0;
+ pic1Cache = LibChovy.Resources.PIC1;
+
+ loadIcon(iconCache);
+
+ this.iconFile.FileChanged += onIconChange;
+ this.pic0File.FileChanged += onPic0Change;
+ this.pic1File.FileChanged += onPic1Change;
+
+ }
+
+ }
+}
+
+#pragma warning restore CS8601 // Possible null reference assignment.
diff --git a/ChovySign-GUI/PS1CD.PNG b/ChovySign-GUI/Ps1/PS1CD.PNG
similarity index 100%
rename from ChovySign-GUI/PS1CD.PNG
rename to ChovySign-GUI/Ps1/PS1CD.PNG
diff --git a/ChovySign-GUI/Ps1/Ps1Tab.axaml b/ChovySign-GUI/Ps1/Ps1Tab.axaml
new file mode 100644
index 0000000..ad7b553
--- /dev/null
+++ b/ChovySign-GUI/Ps1/Ps1Tab.axaml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ChovySign-GUI/Ps1/Ps1Tab.axaml.cs b/ChovySign-GUI/Ps1/Ps1Tab.axaml.cs
new file mode 100644
index 0000000..ae592e0
--- /dev/null
+++ b/ChovySign-GUI/Ps1/Ps1Tab.axaml.cs
@@ -0,0 +1,27 @@
+using Avalonia.Controls;
+using System.Linq;
+
+namespace ChovySign_GUI.Ps1
+{
+ public partial class Ps1Tab : UserControl
+ {
+ public Ps1Tab()
+ {
+ InitializeComponent();
+ discSelector.DiscsSelected += onDiscSelected;
+
+ progressStatus.IsEnabled = false;
+ }
+
+ private void onDiscSelected(object? sender, System.EventArgs e)
+ {
+ CueSelector? cueSelector = sender as CueSelector;
+ if (cueSelector is null) return;
+
+ if (cueSelector.AnyDiscsSelected)
+ _ = this.gameInfo.GetGameInfo(cueSelector.Discs.First());
+ else
+ progressStatus.IsEnabled = false;
+ }
+ }
+}
diff --git a/ChovySign-GUI/Psp/IsoSelector.axaml b/ChovySign-GUI/Psp/IsoSelector.axaml
index 6870dec..c84654e 100644
--- a/ChovySign-GUI/Psp/IsoSelector.axaml
+++ b/ChovySign-GUI/Psp/IsoSelector.axaml
@@ -2,10 +2,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="200"
+ xmlns:Global="clr-namespace:ChovySign_GUI.Global"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="145"
x:Class="ChovySign_GUI.Psp.IsoSelector">
-
+
@@ -16,25 +17,10 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/ChovySign-GUI/Psp/PspTab.axaml b/ChovySign-GUI/Psp/PspTab.axaml
index 3a5b32d..9d36a81 100644
--- a/ChovySign-GUI/Psp/PspTab.axaml
+++ b/ChovySign-GUI/Psp/PspTab.axaml
@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
xmlns:Psp="clr-namespace:ChovySign_GUI.Psp"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="900"
x:Class="ChovySign_GUI.Psp.PspTab">
@@ -15,7 +15,7 @@
-
+
@@ -26,6 +26,6 @@
-
+
diff --git a/ChovySign-GUI/Psp/PspTab.axaml.cs b/ChovySign-GUI/Psp/PspTab.axaml.cs
index b1250b9..495af51 100644
--- a/ChovySign-GUI/Psp/PspTab.axaml.cs
+++ b/ChovySign-GUI/Psp/PspTab.axaml.cs
@@ -7,6 +7,8 @@ namespace ChovySign_GUI.Psp
public PspTab()
{
InitializeComponent();
+
+ this.progressStatus.IsEnabled = false;
}
}
}
diff --git a/ChovySign-GUI/UMD.png b/ChovySign-GUI/Psp/UMD.PNG
similarity index 100%
rename from ChovySign-GUI/UMD.png
rename to ChovySign-GUI/Psp/UMD.PNG
diff --git a/GameBuilder/Pops/DiscInfo.cs b/GameBuilder/Pops/DiscInfo.cs
index 87337d0..b78a45c 100644
--- a/GameBuilder/Pops/DiscInfo.cs
+++ b/GameBuilder/Pops/DiscInfo.cs
@@ -13,8 +13,8 @@ namespace GameBuilder.Pops
public class DiscInfo
{
private string cueFile;
- private string? discName;
- private string? discId;
+ private string discName;
+ private string discId;
public string CueFile
{
@@ -89,7 +89,7 @@ namespace GameBuilder.Pops
discName = binUtil.ReadCDStr(0x20);
}
}
-
+ if (discName == "") discName = Path.GetFileNameWithoutExtension(cueFile);
if (discId is null) discId = "SLUS00001";
}
diff --git a/LibChovy/ArtDownloader.cs b/LibChovy/Art/Downloader.cs
similarity index 88%
rename from LibChovy/ArtDownloader.cs
rename to LibChovy/Art/Downloader.cs
index 4f04a99..fd7db12 100644
--- a/LibChovy/ArtDownloader.cs
+++ b/LibChovy/Art/Downloader.cs
@@ -6,9 +6,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace LibChovy
+namespace LibChovy.Art
{
- internal class ArtDownloader
+ public class Downloader
{
private const string coverApi = "https://raw.githubusercontent.com/xlenore/psx-covers/main/covers/";
private static HttpClient httpClient = new HttpClient();
@@ -41,9 +41,9 @@ namespace LibChovy
}
}
}
-
+
}
- catch (Exception e) { Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); return Resources.ICON0; }
+ catch (Exception) { return Resources.ICON0; }
}
}
diff --git a/LibChovy/Art/Resizer.cs b/LibChovy/Art/Resizer.cs
new file mode 100644
index 0000000..8f35f83
--- /dev/null
+++ b/LibChovy/Art/Resizer.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LibChovy.Art
+{
+ public class Resizer
+ {
+ public static async Task LoadImage(string imagePath, int width=80, int height=80)
+ {
+ return await LoadImage(await File.ReadAllBytesAsync(imagePath), width, height);
+ }
+ public static async Task LoadImage(byte[] imageData, int width=80, int height=80)
+ {
+ using (Image img = Image.Load(imageData))
+ {
+ img.Mutate(x => x.Resize(width, height));
+ using (MemoryStream png = new MemoryStream())
+ {
+ await img.SaveAsPngAsync(png);
+ return png.ToArray();
+ }
+ }
+ }
+ }
+}
diff --git a/LibChovy/PopsParameters.cs b/LibChovy/PopsParameters.cs
index 8c51f8e..a864ac0 100644
--- a/LibChovy/PopsParameters.cs
+++ b/LibChovy/PopsParameters.cs
@@ -1,5 +1,6 @@
using GameBuilder.Pops;
using GameBuilder.Psp;
+using LibChovy.Art;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -70,7 +71,7 @@ namespace LibChovy
{
if (icon0 is null)
{
- byte[] coverImg = ArtDownloader.DownloadCover(FirstDisc).Result;
+ byte[] coverImg = Downloader.DownloadCover(FirstDisc).Result;
icon0 = coverImg;
return coverImg;
}