Merge pull request 'add-version-to-install-button' (#36) from waffle.lord/SPT-AKI-Installer:add-version-to-install-button into master
Reviewed-on: CWX/SPT-AKI-Installer#36
This commit is contained in:
commit
4ec6cdf9f7
13
.idea/.idea.SPTInstaller/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.SPTInstaller/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/modules.xml
|
||||||
|
/contentModel.xml
|
||||||
|
/.idea.SPTInstaller.iml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
1
.idea/.idea.SPTInstaller/.idea/.name
generated
Normal file
1
.idea/.idea.SPTInstaller/.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
|||||||
|
SPTInstaller
|
14
.idea/.idea.SPTInstaller/.idea/avalonia.xml
generated
Normal file
14
.idea/.idea.SPTInstaller/.idea/avalonia.xml
generated
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AvaloniaProject">
|
||||||
|
<option name="projectPerEditor">
|
||||||
|
<map>
|
||||||
|
<entry key="SPTInstaller/CustomControls/DetailedPreCheckItem.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||||
|
<entry key="SPTInstaller/CustomControls/PreCheckItem.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||||
|
<entry key="SPTInstaller/CustomControls/SPTInstallButton.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||||
|
<entry key="SPTInstaller/Views/DetailedPreChecksView.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||||
|
<entry key="SPTInstaller/Views/PreChecksView.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
4
.idea/.idea.SPTInstaller/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.SPTInstaller/.idea/encodings.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
8
.idea/.idea.SPTInstaller/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.SPTInstaller/.idea/indexLayout.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/.idea.SPTInstaller/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.SPTInstaller/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<Label Grid.Column="1"
|
<Label Grid.Column="1"
|
||||||
Content="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
Content="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||||
Classes.bold="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}
|
Classes.bold="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
Converter={StaticResource ResourceKey=IsStateConverter},
|
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||||
ConverterParameter=Running}"
|
ConverterParameter=Running}"
|
||||||
/>
|
/>
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
<PackageIcon>icon.ico</PackageIcon>
|
<PackageIcon>icon.ico</PackageIcon>
|
||||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||||
<Configurations>Debug;Release;TEST</Configurations>
|
<Configurations>Debug;Release;TEST</Configurations>
|
||||||
<AssemblyVersion>2.16</AssemblyVersion>
|
<AssemblyVersion>2.17</AssemblyVersion>
|
||||||
<FileVersion>2.16</FileVersion>
|
<FileVersion>2.17</FileVersion>
|
||||||
|
<Company>SPT-AKI</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -5,6 +5,8 @@ using System.Windows.Input;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using DialogHostAvalonia;
|
using DialogHostAvalonia;
|
||||||
|
using Gitea.Api;
|
||||||
|
using Gitea.Client;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using SPTInstaller.Controllers;
|
using SPTInstaller.Controllers;
|
||||||
@ -25,7 +27,7 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
|
|
||||||
public ICommand DismissUpdateCommand { get; set; }
|
public ICommand DismissUpdateCommand { get; set; }
|
||||||
|
|
||||||
public InstallerUpdateInfo UpdateInfo { get; set; } = new InstallerUpdateInfo();
|
public InstallerUpdateInfo UpdateInfo { get; set; } = new();
|
||||||
|
|
||||||
private string _installPath;
|
private string _installPath;
|
||||||
public string InstallPath
|
public string InstallPath
|
||||||
@ -34,6 +36,14 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
set => this.RaiseAndSetIfChanged(ref _installPath, value);
|
set => this.RaiseAndSetIfChanged(ref _installPath, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _installButtonText;
|
||||||
|
|
||||||
|
public string InstallButtonText
|
||||||
|
{
|
||||||
|
get => _installButtonText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _installButtonText, value);
|
||||||
|
}
|
||||||
|
|
||||||
private bool _allowInstall;
|
private bool _allowInstall;
|
||||||
public bool AllowInstall
|
public bool AllowInstall
|
||||||
{
|
{
|
||||||
@ -62,11 +72,21 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
set => this.RaiseAndSetIfChanged(ref _cacheCheckState, value);
|
set => this.RaiseAndSetIfChanged(ref _cacheCheckState, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StatusSpinner.SpinnerState _installButtonCheckState;
|
||||||
|
public StatusSpinner.SpinnerState InstallButtonCheckState
|
||||||
|
{
|
||||||
|
get => _installButtonCheckState;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _installButtonCheckState, value);
|
||||||
|
}
|
||||||
|
|
||||||
public PreChecksViewModel(IScreen host) : base(host)
|
public PreChecksViewModel(IScreen host) : base(host)
|
||||||
{
|
{
|
||||||
var data = ServiceHelper.Get<InternalData?>();
|
var data = ServiceHelper.Get<InternalData?>();
|
||||||
var installer = ServiceHelper.Get<InstallController?>();
|
var installer = ServiceHelper.Get<InstallController?>();
|
||||||
|
|
||||||
|
InstallButtonText = "Please wait ...";
|
||||||
|
InstallButtonCheckState = StatusSpinner.SpinnerState.Pending;
|
||||||
|
|
||||||
if (data == null || installer == null)
|
if (data == null || installer == null)
|
||||||
{
|
{
|
||||||
NavigateTo(new MessageViewModel(HostScreen, Result.FromError("Failed to get required service for prechecks")));
|
NavigateTo(new MessageViewModel(HostScreen, Result.FromError("Failed to get required service for prechecks")));
|
||||||
@ -75,6 +95,11 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
|
|
||||||
data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath();
|
data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath();
|
||||||
|
|
||||||
|
data.TargetInstallPath = Environment.CurrentDirectory;
|
||||||
|
InstallPath = data.TargetInstallPath;
|
||||||
|
|
||||||
|
Log.Information($"Install Path: {FileHelper.GetRedactedPath(InstallPath)}");
|
||||||
|
|
||||||
#if !TEST
|
#if !TEST
|
||||||
if (data.OriginalGamePath == null)
|
if (data.OriginalGamePath == null)
|
||||||
{
|
{
|
||||||
@ -83,11 +108,6 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
data.TargetInstallPath = Environment.CurrentDirectory;
|
|
||||||
InstallPath = data.TargetInstallPath;
|
|
||||||
|
|
||||||
Log.Information($"Install Path: {FileHelper.GetRedactedPath(InstallPath)}");
|
|
||||||
|
|
||||||
if (data.OriginalGamePath == data.TargetInstallPath)
|
if (data.OriginalGamePath == data.TargetInstallPath)
|
||||||
{
|
{
|
||||||
Log.CloseAndFlush();
|
Log.CloseAndFlush();
|
||||||
@ -156,10 +176,38 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
// run prechecks
|
||||||
var result = await installer.RunPreChecks();
|
var result = await installer.RunPreChecks();
|
||||||
|
|
||||||
|
// check for updates
|
||||||
await UpdateInfo.CheckForUpdates(Assembly.GetExecutingAssembly().GetName()?.Version);
|
await UpdateInfo.CheckForUpdates(Assembly.GetExecutingAssembly().GetName()?.Version);
|
||||||
|
|
||||||
|
// get latest spt version
|
||||||
|
InstallButtonText = "Getting latest release ...";
|
||||||
|
InstallButtonCheckState = StatusSpinner.SpinnerState.Running;
|
||||||
|
|
||||||
|
var repo = new RepositoryApi(Configuration.Default);
|
||||||
|
var akiRepoReleases = await repo.RepoListReleasesAsync("SPT-AKI", "Stable-releases");
|
||||||
|
|
||||||
|
if (akiRepoReleases == null || akiRepoReleases.Count == 0)
|
||||||
|
{
|
||||||
|
InstallButtonText = "Could not get SPT releases from repo";
|
||||||
|
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var latestAkiRelease = akiRepoReleases.FindAll(x => !x.Prerelease)[0];
|
||||||
|
|
||||||
|
if (latestAkiRelease == null)
|
||||||
|
{
|
||||||
|
InstallButtonText = "Could not find the latest SPT release";
|
||||||
|
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InstallButtonText = $"Start Install: SPT v{latestAkiRelease.TagName}";
|
||||||
|
InstallButtonCheckState = StatusSpinner.SpinnerState.OK;
|
||||||
|
|
||||||
AllowDetailsButton = true;
|
AllowDetailsButton = true;
|
||||||
AllowInstall = result.Succeeded;
|
AllowInstall = result.Succeeded;
|
||||||
});
|
});
|
||||||
|
@ -24,14 +24,18 @@
|
|||||||
Margin="5"
|
Margin="5"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button Grid.Row="1" Grid.RowSpan="3" Grid.Column="3"
|
<Button Grid.Row="1" Grid.RowSpan="3" Grid.Column="3" Padding="20 10"
|
||||||
Content="Start Install" Padding="20 10"
|
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
FontSize="15" FontWeight="SemiBold"
|
FontSize="15" FontWeight="SemiBold"
|
||||||
Classes="yellow"
|
Classes="yellow"
|
||||||
IsEnabled="{Binding AllowInstall}"
|
IsEnabled="{Binding AllowInstall}"
|
||||||
Command="{Binding StartInstallCommand}"
|
Command="{Binding StartInstallCommand}"
|
||||||
/>
|
>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding InstallButtonText}" VerticalAlignment="Center" Foreground="Black"/>
|
||||||
|
<cc:StatusSpinner State="{Binding InstallButtonCheckState}" Margin="2" IsVisible="{Binding !AllowInstall}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="4" Grid.ColumnSpan="5">
|
<ScrollViewer Grid.Row="4" Grid.ColumnSpan="5">
|
||||||
<ItemsControl ItemsSource="{Binding PreChecks}">
|
<ItemsControl ItemsSource="{Binding PreChecks}">
|
||||||
|
@ -19,13 +19,18 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
/>
|
/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Grid.Column="2" Grid.Row="3" Content="Start Install" Padding="20 10"
|
<Button Grid.Column="2" Grid.Row="3" Padding="20 10"
|
||||||
Margin="10"
|
Margin="10"
|
||||||
FontSize="15" FontWeight="SemiBold"
|
FontSize="15" FontWeight="SemiBold"
|
||||||
Classes="yellow"
|
Classes="yellow"
|
||||||
IsEnabled="{Binding AllowInstall}"
|
IsEnabled="{Binding AllowInstall}"
|
||||||
Command="{Binding StartInstallCommand}"
|
Command="{Binding StartInstallCommand}"
|
||||||
/>
|
>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding InstallButtonText}" VerticalAlignment="Center" Foreground="Black"/>
|
||||||
|
<cc:StatusSpinner State="{Binding InstallButtonCheckState}" Margin="2" IsVisible="{Binding !AllowInstall}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<ItemsControl ItemsSource="{Binding PreChecks}" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" HorizontalAlignment="Center">
|
<ItemsControl ItemsSource="{Binding PreChecks}" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" HorizontalAlignment="Center">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user