added different installation methods
All checks were successful
Java CI / test (push) Successful in 1m27s
All checks were successful
Java CI / test (push) Successful in 1m27s
This commit is contained in:
parent
0479843d47
commit
b69cac606a
6 changed files with 21 additions and 4 deletions
|
@ -3,7 +3,7 @@
|
|||
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"
|
||||
Height="349"
|
||||
Height="389"
|
||||
Width="598"
|
||||
CanResize="False"
|
||||
x:Class="PS2_Manager.AddGameWindow"
|
||||
|
@ -38,6 +38,10 @@
|
|||
|
||||
<TextBlock Text="ISO Path"/>
|
||||
<TextBox Name="IsoPathBox" IsEnabled="False"/>
|
||||
|
||||
<TextBlock Text="Installation Method"/>
|
||||
<ComboBox Name="InstallationMethodBox" Margin="5,0" HorizontalAlignment="Stretch" SelectionChanged="InstallationMethodBox_OnSelectionChanged">
|
||||
</ComboBox>
|
||||
|
||||
<Button Name="InstallButton" Content="Install Game" HorizontalAlignment="Center"
|
||||
Background="#aa4de8"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
@ -22,6 +23,9 @@ public partial class AddGameWindow : Window
|
|||
{
|
||||
this.newGame = new Game(filePath);
|
||||
InitializeComponent();
|
||||
InstallationMethodBox.Items.Add("Move");
|
||||
InstallationMethodBox.Items.Add("Copy");
|
||||
InstallationMethodBox.SelectedItem = settings.preferred_installation_method.GetValue<string>() ?? "Move";
|
||||
}
|
||||
|
||||
private void RefreshPreview()
|
||||
|
@ -100,4 +104,9 @@ public partial class AddGameWindow : Window
|
|||
Console.Error("OpenFilePicker was called but Canceled or no Files selected");
|
||||
}
|
||||
}
|
||||
|
||||
private void InstallationMethodBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
settings.preferred_installation_method.SetValue(InstallationMethodBox.SelectionBoxItem?.ToString());
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ public static class ConfigUtils
|
|||
return;
|
||||
config.SetValue(getStrType(_type), getStrName(_type), _value.ToString());
|
||||
}
|
||||
public static T GetValue<T>(this Enum _type)
|
||||
public static T? GetValue<T>(this Enum _type)
|
||||
{
|
||||
if (!checkIfInitialized())
|
||||
return default(T);
|
||||
|
|
|
@ -119,6 +119,9 @@ public class Game
|
|||
{
|
||||
this.InstallProgress = new UpdateVar<double>();
|
||||
await this.CopyIsoWithProgressAsync();
|
||||
string installationMethod = settings.preferred_installation_method.GetValue<string>() ?? "Move";
|
||||
if(installationMethod == "Move")
|
||||
this.Uninstall();
|
||||
}
|
||||
|
||||
private Bitmap DownloadCover(Artwork.Type type)
|
||||
|
|
|
@ -35,7 +35,8 @@ public static class Globals
|
|||
|
||||
public enum settings
|
||||
{
|
||||
library_path
|
||||
library_path,
|
||||
preferred_installation_method
|
||||
}
|
||||
|
||||
public class UpdateVar<T>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<AssemblyVersion>1.0</AssemblyVersion>
|
||||
<FileVersion>1.0</FileVersion>
|
||||
<FileVersion>1.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Add table
Reference in a new issue