Compare commits
No commits in common. "8e8d7d534f2de1da4137044160fba5ff1ff3a4f8" and "8c446a6e812a658af74a774fd8484e1ef21b7d9a" have entirely different histories.
8e8d7d534f
...
8c446a6e81
2
.idea/.idea.SPTInstaller/.idea/avalonia.xml
generated
2
.idea/.idea.SPTInstaller/.idea/avalonia.xml
generated
@ -8,12 +8,10 @@
|
||||
<entry key="SPTInstaller/CustomControls/CacheInfo.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/DetailedPreCheckItem.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/MainInstallerButton.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/PreCheckDetails.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/PreCheckItem.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/ProgressableTaskItem.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/SPTInstallButton.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/UpdateButton.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/CustomControls/UpdateInfoCard.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/Views/DetailedPreChecksView.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
<entry key="SPTInstaller/Views/MainWindow.axaml" value="SPTInstaller/SPTInstaller.csproj" />
|
||||
|
@ -21,7 +21,6 @@
|
||||
<Color x:Key="AKI_White">#FFFFFF</Color>
|
||||
<Color x:Key="AKI_Gray">#282828</Color>
|
||||
<Color x:Key="AKI_DarkGrayBlue">#323947</Color>
|
||||
<Color x:Key="AKI_LightGrayBlue">#444259</Color>
|
||||
|
||||
<!-- Brushes -->
|
||||
<SolidColorBrush x:Key="AKI_Foreground_Light" Color="{StaticResource AKI_White}"/>
|
||||
@ -29,7 +28,6 @@
|
||||
<SolidColorBrush x:Key="AKI_Background_Dark" Color="{StaticResource AKI_DarkGray}"/>
|
||||
<SolidColorBrush x:Key="AKI_Brush_Yellow" Color="{StaticResource AKI_Yellow}"/>
|
||||
<SolidColorBrush x:Key="AKI_Brush_DarkGrayBlue" Color="{StaticResource AKI_DarkGrayBlue}"/>
|
||||
<SolidColorBrush x:Key="AKI_Brush_LightGrayBlue" Color="{StaticResource AKI_LightGrayBlue}"/>
|
||||
<SolidColorBrush x:Key="AKI_Brush_Lighter" Color="Gainsboro"/>
|
||||
|
||||
<!-- Path Geometry -->
|
||||
|
@ -123,13 +123,16 @@
|
||||
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml -->
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Background" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_White}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Background_Dark}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button:pointerover">
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource AKI_LightGrayBlue}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource AKI_LightGrayBlue}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_White}"/>
|
||||
<Setter Property="Background" Value="{StaticResource AKI_Background_Light}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_Yellow}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</Style>
|
||||
|
||||
@ -156,7 +159,6 @@
|
||||
<Style Selector="Button.yellow:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="Gold"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Background_Dark}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</Style>
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
using SPTInstaller.CustomControls;
|
||||
|
||||
namespace SPTInstaller.Converters;
|
||||
|
||||
public class StateSpinnerStateToColorConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
if (value is not StatusSpinner.SpinnerState state)
|
||||
return null;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case StatusSpinner.SpinnerState.Pending:
|
||||
return new SolidColorBrush(Colors.Gray);
|
||||
case StatusSpinner.SpinnerState.Running:
|
||||
return new SolidColorBrush(Colors.DodgerBlue);
|
||||
case StatusSpinner.SpinnerState.OK:
|
||||
return new SolidColorBrush(Colors.ForestGreen);
|
||||
case StatusSpinner.SpinnerState.Warning:
|
||||
return new SolidColorBrush(Colors.Goldenrod);
|
||||
case StatusSpinner.SpinnerState.Error:
|
||||
return new SolidColorBrush(Colors.Crimson);
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
@ -10,22 +10,22 @@
|
||||
<convt:StatusSpinnerIsProcessingConverter x:Key="IsInProcessingStateConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,AUTO,10,AUTO,*">
|
||||
<cc:StatusSpinner Grid.Column="1" State="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
<Grid ColumnDefinitions="AUTO,10,AUTO,10,AUTO">
|
||||
<cc:StatusSpinner State="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IsVisible="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||
Converter={StaticResource IsInProcessingStateConverter}}"
|
||||
/>
|
||||
|
||||
<Path Grid.Column="1" Data="{StaticResource Cache}" Fill="DodgerBlue" Margin="0 6 0 0"
|
||||
<Path Data="{StaticResource Cache}" Fill="DodgerBlue" Margin="0 6 0 0"
|
||||
IsVisible="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||
Converter={StaticResource IsInProcessingStateConverter},
|
||||
ConverterParameter=invert}"
|
||||
/>
|
||||
/>
|
||||
|
||||
<Label Grid.Column="3" Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
<Label Grid.Column="2" Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Margin="0 2 0 0"
|
||||
/>
|
||||
<Button Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Content="What's this?" Classes="link" HorizontalAlignment="Center"
|
||||
<Button Grid.Column="4" Content="What's this?" Classes="link"
|
||||
Command="{Binding ShowCacheDialogCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@ -63,9 +63,7 @@ public partial class WhyCacheThoughDialog : UserControl
|
||||
|
||||
if (!downloadsFolder.Exists)
|
||||
{
|
||||
var message = "Could not get downloads folder :(";
|
||||
Log.Error($"[MV_0] {message}");
|
||||
AdditionalInfo = message;
|
||||
AdditionalInfo = "Could not get downloads folder :(";
|
||||
AdditionalInfoColor = "red";
|
||||
_movePatcherState = -1;
|
||||
return;
|
||||
@ -75,15 +73,13 @@ public partial class WhyCacheThoughDialog : UserControl
|
||||
|
||||
if (_foundPatcher == null || !_foundPatcher.Exists)
|
||||
{
|
||||
var message = "Could not find a patcher file in your downloads folder";
|
||||
Log.Warning($"[MV_0] {message}");
|
||||
AdditionalInfo = message;
|
||||
AdditionalInfo =
|
||||
"Could not find a patcher file in your downloads folder";
|
||||
|
||||
AdditionalInfoColor = "red";
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Information($"[MV_0] Found patcher for move: {_foundPatcher.Name}");
|
||||
AdditionalInfo = $"Click again to move the below patcher file to the cache folder\n{_foundPatcher?.Name ?? "-SOMETHING WENT WRONG-"}";
|
||||
AdditionalInfoColor = "#FFC107";
|
||||
_movePatcherState = 1;
|
||||
@ -93,9 +89,7 @@ public partial class WhyCacheThoughDialog : UserControl
|
||||
{
|
||||
var cacheFilePath = Path.Join(DownloadCacheHelper.CachePath, "patcher");
|
||||
_foundPatcher?.MoveTo(cacheFilePath, true);
|
||||
var message = "Patcher was moved into cache :D";
|
||||
Log.Information($"[MV_1] {message}");
|
||||
AdditionalInfo = message;
|
||||
AdditionalInfo = "Patch was moved into cache :D";
|
||||
AdditionalInfoColor = "ForestGreen";
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -105,9 +99,6 @@ public partial class WhyCacheThoughDialog : UserControl
|
||||
Log.Error(ex, "Failed to move downloaded patcher file into cache");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.Error("[MV_ ] Move state is broken :(");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,60 +2,41 @@
|
||||
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:model="using:SPTInstaller.Models"
|
||||
xmlns:cvt="using:SPTInstaller.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SPTInstaller.CustomControls.PreCheckDetails">
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:StateSpinnerStateToColorConverter x:Key="colorConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Panel>
|
||||
<!-- show when nothing is selected -->
|
||||
<!-- show when nothing is selected -->
|
||||
<Label Content="Select a Pre-Check to see more info" FontSize="20"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsVisible="{Binding HasSelection, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={x:Static BoolConverters.Not}}"
|
||||
IsVisible="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
||||
/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding PreChecks}" VerticalAlignment="Stretch">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="model:PreCheckBase">
|
||||
<!-- selected precheck details -->
|
||||
<Grid RowDefinitions="10, *, Auto, 10" ColumnDefinitions="10, 10, *, 10" VerticalAlignment="Stretch"
|
||||
IsVisible="{Binding IsSelected}"
|
||||
>
|
||||
<Rectangle Grid.Row="1" Grid.Column="1" Width="3" Fill="{Binding State, Converter={StaticResource colorConverter}}"
|
||||
HorizontalAlignment="Left"/>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left">
|
||||
<Label Content="{Binding Name}"
|
||||
FontSize="20"
|
||||
/>
|
||||
<Rectangle Height="1" Fill="Gray" Margin="0 10"/>
|
||||
<TextBlock Text="{Binding PreCheckDetails}"
|
||||
TextWrapping="Wrap"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Classes="yellow"
|
||||
IsVisible="{Binding ActionButtonIsVisible}"
|
||||
CornerRadius="15"
|
||||
Margin="0 10"
|
||||
Command="{Binding ActionButtonCommand}"
|
||||
Content="{Binding ActionButtonText}"
|
||||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<!-- selected precheck details -->
|
||||
<Grid RowDefinitions="10, *, Auto, 10" ColumnDefinitions="10, 10, *, 10"
|
||||
IsVisible="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
>
|
||||
<Rectangle Grid.Row="1" Grid.Column="1" Width="3" Fill="{Binding BarColor, RelativeSource={RelativeSource AncestorType=UserControl}}" HorizontalAlignment="Left"/>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left">
|
||||
<Label Content="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
FontSize="20"
|
||||
/>
|
||||
<Rectangle Height="1" Fill="Gray" Margin="0 10"/>
|
||||
<TextBlock Text="{Binding Details, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
TextWrapping="Wrap"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Classes="yellow"
|
||||
IsVisible="{Binding ShowAction, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CornerRadius="15"
|
||||
Margin="0 10"
|
||||
Command="{Binding ActionCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Content="{Binding ActionButtonText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
</Panel>
|
||||
</UserControl>
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using SPTInstaller.Models;
|
||||
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
@ -12,21 +11,57 @@ public partial class PreCheckDetails : UserControl
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<ObservableCollection<PreCheckBase>> PreChecksProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, ObservableCollection<PreCheckBase>>(nameof(PreChecks));
|
||||
public static readonly StyledProperty<string> PreCheckNameProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, string>(nameof(PreCheckName));
|
||||
|
||||
public ObservableCollection<PreCheckBase> PreChecks
|
||||
public string PreCheckName
|
||||
{
|
||||
get => GetValue(PreChecksProperty);
|
||||
set => SetValue(PreChecksProperty, value);
|
||||
get => GetValue(PreCheckNameProperty);
|
||||
set => SetValue(PreCheckNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> HasSelectionProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, bool>(nameof(HasSelection));
|
||||
public static readonly StyledProperty<string> DetailsProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, string>(nameof(Details));
|
||||
|
||||
public bool HasSelection
|
||||
public string Details
|
||||
{
|
||||
get => GetValue(HasSelectionProperty);
|
||||
set => SetValue(HasSelectionProperty, value);
|
||||
get => GetValue(DetailsProperty);
|
||||
set => SetValue(DetailsProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> ActionButtonTextProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, string>(nameof(ActionButtonText));
|
||||
|
||||
public string ActionButtonText
|
||||
{
|
||||
get => GetValue(ActionButtonTextProperty);
|
||||
set => SetValue(ActionButtonTextProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<ICommand> ActionCommandProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, ICommand>(nameof(ActionCommand));
|
||||
|
||||
public ICommand ActionCommand
|
||||
{
|
||||
get => GetValue(ActionCommandProperty);
|
||||
set => SetValue(ActionCommandProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> ShowActionProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, bool>(nameof(ShowAction));
|
||||
|
||||
public bool ShowAction
|
||||
{
|
||||
get => GetValue(ShowActionProperty);
|
||||
set => SetValue(ShowActionProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> BarColorProperty =
|
||||
AvaloniaProperty.Register<PreCheckDetails, string>(nameof(BarColor));
|
||||
|
||||
public string BarColor
|
||||
{
|
||||
get => GetValue(BarColorProperty);
|
||||
set => SetValue(BarColorProperty, value);
|
||||
}
|
||||
}
|
@ -38,7 +38,8 @@
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.selected">
|
||||
<Setter Property="Background" Value="{StaticResource AKI_Brush_LightGrayBlue}" />
|
||||
<Setter Property="Background" Value="{StaticResource AKI_Brush_DarkGrayBlue}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource AKI_Yellow}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
@ -1,47 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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"
|
||||
x:Class="SPTInstaller.CustomControls.UpdateButton">
|
||||
<UserControl.Styles>
|
||||
<StyleInclude Source="../Assets/Styles.axaml"/>
|
||||
</UserControl.Styles>
|
||||
|
||||
<Panel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="!Updating" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
<Binding Path="UpdateAvailable" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
</MultiBinding>
|
||||
</StackPanel.IsVisible>
|
||||
<Button Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CornerRadius="20 0 0 20"
|
||||
Classes="yellow"
|
||||
Command="{Binding UpdateCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
|
||||
<Button Content="Not now" CornerRadius="0 20 20 0"
|
||||
Command="{Binding DismissCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<Panel Margin="0 10">
|
||||
<Panel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.Or}">
|
||||
<Binding Path="Updating" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
<Binding Path="CheckingForUpdate" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
</MultiBinding>
|
||||
</Panel.IsVisible>
|
||||
<ProgressBar CornerRadius="20" VerticalAlignment="Stretch"
|
||||
Value="{Binding DownloadProgress, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IsIndeterminate="{Binding IsIndeterminate, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
<Label Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="Black" FontWeight="SemiBold"/>
|
||||
</Panel>
|
||||
</Panel>
|
||||
</UserControl>
|
@ -1,85 +0,0 @@
|
||||
using System.Windows.Input;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public partial class UpdateButton : UserControl
|
||||
{
|
||||
public UpdateButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> InfoTextProperty = AvaloniaProperty.Register<UpdateButton, string>(
|
||||
"InfoText");
|
||||
|
||||
public string InfoText
|
||||
{
|
||||
get => GetValue(InfoTextProperty);
|
||||
set => SetValue(InfoTextProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> CheckingForUpdateProperty = AvaloniaProperty.Register<UpdateButton, bool>(
|
||||
"CheckingForUpdate");
|
||||
|
||||
public bool CheckingForUpdate
|
||||
{
|
||||
get => GetValue(CheckingForUpdateProperty);
|
||||
set => SetValue(CheckingForUpdateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<ICommand> DismissCommandProperty = AvaloniaProperty.Register<UpdateButton, ICommand>(
|
||||
"DismissCommand");
|
||||
|
||||
public ICommand DismissCommand
|
||||
{
|
||||
get => GetValue(DismissCommandProperty);
|
||||
set => SetValue(DismissCommandProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<ICommand> UpdateCommandProperty = AvaloniaProperty.Register<UpdateButton, ICommand>(
|
||||
"UpdateCommand");
|
||||
|
||||
public ICommand UpdateCommand
|
||||
{
|
||||
get => GetValue(UpdateCommandProperty);
|
||||
set => SetValue(UpdateCommandProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> UpdatingProperty = AvaloniaProperty.Register<UpdateButton, bool>(
|
||||
"Updating");
|
||||
|
||||
public bool Updating
|
||||
{
|
||||
get => GetValue(UpdatingProperty);
|
||||
set => SetValue(UpdatingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<int> DownloadProgressProperty = AvaloniaProperty.Register<UpdateButton, int>(
|
||||
"DownloadProgress");
|
||||
|
||||
public int DownloadProgress
|
||||
{
|
||||
get => GetValue(DownloadProgressProperty);
|
||||
set => SetValue(DownloadProgressProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsIndeterminateProperty = AvaloniaProperty.Register<UpdateButton, bool>(
|
||||
"IsIndeterminate");
|
||||
|
||||
public bool IsIndeterminate
|
||||
{
|
||||
get => GetValue(IsIndeterminateProperty);
|
||||
set => SetValue(IsIndeterminateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> UpdateAvailableProperty = AvaloniaProperty.Register<UpdateButton, bool>(
|
||||
"UpdateAvailable");
|
||||
|
||||
public bool UpdateAvailable
|
||||
{
|
||||
get => GetValue(UpdateAvailableProperty);
|
||||
set => SetValue(UpdateAvailableProperty, value);
|
||||
}
|
||||
}
|
@ -66,16 +66,13 @@ public static class DownloadCacheHelper
|
||||
if (FileHashHelper.CheckHash(cacheFile, expectedHash))
|
||||
{
|
||||
fileInCache = cacheFile;
|
||||
Log.Information("Hashes MATCH");
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.Warning("Hashes DO NOT MATCH");
|
||||
return false;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch
|
||||
{
|
||||
Log.Error(ex, "Something went wrong during hashing");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -176,16 +176,15 @@ public static class FileHelper
|
||||
var problemNames = new Dictionary<string, PathCheckType>()
|
||||
{
|
||||
{ "Desktop", PathCheckType.EndsWith },
|
||||
{ "Documents", PathCheckType.EndsWith },
|
||||
{ "scoped_dir", PathCheckType.Contains },
|
||||
{ "Downloads", PathCheckType.Contains },
|
||||
{ "Downloads", PathCheckType.EndsWith },
|
||||
{ "Documents", PathCheckType.EndsWith},
|
||||
{ "OneDrive", PathCheckType.Contains },
|
||||
{ "NextCloud", PathCheckType.Contains },
|
||||
{ "DropBox", PathCheckType.Contains },
|
||||
{ "Google", PathCheckType.Contains },
|
||||
{ "Program Files", PathCheckType.Contains },
|
||||
{ "Program Files (x86)", PathCheckType.Contains },
|
||||
{ "Drive Root", PathCheckType.DriveRoot }
|
||||
{ "Program Files", PathCheckType.Contains},
|
||||
{ "Program Files (x86)", PathCheckType.Contains},
|
||||
{ "Drive Root", PathCheckType.DriveRoot}
|
||||
};
|
||||
|
||||
foreach (var name in problemNames)
|
||||
|
@ -25,15 +25,16 @@ public class SetupClientTask : InstallerTaskBase
|
||||
|
||||
var progress = new Progress<double>((d) => { SetStatus(null, null, (int)Math.Floor(d)); });
|
||||
|
||||
SetStatus("Preparing 7z", "", null, ProgressStyle.Indeterminate);
|
||||
|
||||
if (!FileHelper.StreamAssemblyResourceOut("7z.dll", Path.Join(DownloadCacheHelper.CachePath, "7z.dll")))
|
||||
{
|
||||
return Result.FromError("Failed to prepare 7z");
|
||||
}
|
||||
|
||||
if (_data.PatchNeeded)
|
||||
{
|
||||
SetStatus("Preparing 7z", "", null, ProgressStyle.Indeterminate);
|
||||
|
||||
if (!FileHelper.StreamAssemblyResourceOut("7z.dll", Path.Join(DownloadCacheHelper.CachePath, "7z.dll")))
|
||||
{
|
||||
return Result.FromError("Failed to prepare 7z");
|
||||
}
|
||||
|
||||
// extract patcher files
|
||||
SetStatus("Extrating Patcher", "", 0);
|
||||
|
||||
|
@ -20,11 +20,11 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
set => this.RaiseAndSetIfChanged(ref _updateInfoText, value);
|
||||
}
|
||||
|
||||
private bool _show = false;
|
||||
public bool Show
|
||||
private bool _showCard = false;
|
||||
public bool ShowCard
|
||||
{
|
||||
get => _show;
|
||||
set => this.RaiseAndSetIfChanged(ref _show, value);
|
||||
get => _showCard;
|
||||
set => this.RaiseAndSetIfChanged(ref _showCard, value);
|
||||
}
|
||||
|
||||
private bool _updating = false;
|
||||
@ -89,7 +89,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
|
||||
private async Task<string> DownloadNewInstaller()
|
||||
{
|
||||
UpdateInfoText = $"Downloading installer v{_newVersion}";
|
||||
UpdateInfoText = $"Downloading new installer v{_newVersion}";
|
||||
|
||||
var progress = new Progress<double>(x => DownloadProgress = (int)x);
|
||||
|
||||
@ -112,7 +112,21 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
}
|
||||
|
||||
UpdateInfoText = infoText;
|
||||
Show = updateAvailable;
|
||||
|
||||
if (!updateAvailable)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
// delay card dismiss
|
||||
await Task.Delay(TimeSpan.FromSeconds(2));
|
||||
ShowCard = updateAvailable;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowCard = updateAvailable;
|
||||
}
|
||||
|
||||
CheckingForUpdates = false;
|
||||
UpdateAvailable = updateAvailable;
|
||||
}
|
||||
@ -123,7 +137,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
return;
|
||||
|
||||
UpdateInfoText = "Checking for installer updates";
|
||||
Show = true;
|
||||
ShowCard = true;
|
||||
CheckingForUpdates = true;
|
||||
|
||||
try
|
||||
@ -158,7 +172,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
|
||||
NewInstallerUrl = latest.Assets[0].BrowserDownloadUrl;
|
||||
|
||||
EndCheck($"Update available: v{latestVersion}", true);
|
||||
EndCheck($"Update available, version {latestVersion}", true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
<PackageIcon>icon.ico</PackageIcon>
|
||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;TEST</Configurations>
|
||||
<AssemblyVersion>2.54</AssemblyVersion>
|
||||
<FileVersion>2.54</FileVersion>
|
||||
<AssemblyVersion>2.52</AssemblyVersion>
|
||||
<FileVersion>2.52</FileVersion>
|
||||
<Company>SPT-AKI</Company>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -19,13 +19,7 @@ namespace SPTInstaller.ViewModels;
|
||||
|
||||
public class PreChecksViewModel : ViewModelBase
|
||||
{
|
||||
private bool _hasPreCheckSelected;
|
||||
|
||||
public bool HasPreCheckSelected
|
||||
{
|
||||
get => _hasPreCheckSelected;
|
||||
set => this.RaiseAndSetIfChanged(ref _hasPreCheckSelected, value);
|
||||
}
|
||||
public PreCheckDetailInfo SelectedPreCheck { get; set; } = new();
|
||||
|
||||
public ObservableCollection<PreCheckBase> PreChecks { get; set; } = new(ServiceHelper.GetAll<PreCheckBase>());
|
||||
|
||||
@ -208,8 +202,30 @@ public class PreChecksViewModel : ViewModelBase
|
||||
if (check.Id == precheck.Id)
|
||||
{
|
||||
precheck.IsSelected = true;
|
||||
SelectedPreCheck.Name = precheck.Name;
|
||||
SelectedPreCheck.Details = precheck.PreCheckDetails;
|
||||
SelectedPreCheck.ActionButtonText = precheck.ActionButtonText;
|
||||
SelectedPreCheck.ActionButtonCommand = precheck.ActionButtonCommand;
|
||||
SelectedPreCheck.ShowActionButton = precheck.ActionButtonIsVisible;
|
||||
|
||||
HasPreCheckSelected = true;
|
||||
switch (precheck.State)
|
||||
{
|
||||
case StatusSpinner.SpinnerState.Pending:
|
||||
SelectedPreCheck.BarColor = "gray";
|
||||
break;
|
||||
case StatusSpinner.SpinnerState.Running:
|
||||
SelectedPreCheck.BarColor = "dodgerblue";
|
||||
break;
|
||||
case StatusSpinner.SpinnerState.OK:
|
||||
SelectedPreCheck.BarColor = "forestgreen";
|
||||
break;
|
||||
case StatusSpinner.SpinnerState.Warning:
|
||||
SelectedPreCheck.BarColor = "gold";
|
||||
break;
|
||||
case StatusSpinner.SpinnerState.Error:
|
||||
SelectedPreCheck.BarColor = "red";
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -220,7 +236,7 @@ public class PreChecksViewModel : ViewModelBase
|
||||
|
||||
StartInstallCommand = ReactiveCommand.Create(async () =>
|
||||
{
|
||||
UpdateInfo.Show = false;
|
||||
UpdateInfo.ShowCard = false;
|
||||
NavigateTo(new InstallViewModel(HostScreen));
|
||||
});
|
||||
|
||||
@ -233,7 +249,7 @@ public class PreChecksViewModel : ViewModelBase
|
||||
|
||||
DismissUpdateCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
UpdateInfo.Show = false;
|
||||
UpdateInfo.ShowCard = false;
|
||||
});
|
||||
|
||||
|
||||
|
@ -20,10 +20,14 @@
|
||||
/>
|
||||
|
||||
<!-- selected precheck details grid -->
|
||||
<cc:PreCheckDetails Grid.Row="2" Grid.Column="1"
|
||||
PreChecks="{Binding PreChecks}"
|
||||
HasSelection="{Binding HasPreCheckSelected}"
|
||||
/>
|
||||
<cc:PreCheckDetails Grid.Row="2" Grid.Column="1"
|
||||
PreCheckName="{Binding SelectedPreCheck.Name}"
|
||||
Details="{Binding SelectedPreCheck.Details}"
|
||||
ActionButtonText="{Binding SelectedPreCheck.ActionButtonText}"
|
||||
ActionCommand="{Binding SelectedPreCheck.ActionButtonCommand}"
|
||||
ShowAction="{Binding SelectedPreCheck.ActionButtonIsVisible}"
|
||||
BarColor="{Binding SelectedPreCheck.BarColor}"
|
||||
/>
|
||||
|
||||
<!-- info card vertical separator -->
|
||||
<Rectangle Grid.Row="1" Grid.RowSpan="2" Grid.Column="2" VerticalAlignment="Stretch"
|
||||
@ -75,10 +79,9 @@
|
||||
|
||||
<!-- Start install button -->
|
||||
<Button Grid.Column="2" Grid.Row="3" Padding="20 10"
|
||||
IsVisible="{Binding !UpdateInfo.Show}"
|
||||
IsEnabled="{Binding AllowInstall}"
|
||||
FontSize="15" FontWeight="SemiBold"
|
||||
Classes="yellow"
|
||||
IsEnabled="{Binding AllowInstall}"
|
||||
Command="{Binding StartInstallCommand}"
|
||||
CornerRadius="15"
|
||||
>
|
||||
@ -88,18 +91,16 @@
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Update installer button -->
|
||||
<cc:UpdateButton Grid.Column="2" Grid.Row="3"
|
||||
IsVisible="{Binding UpdateInfo.Show}"
|
||||
IsEnabled="{Binding UpdateInfo.Show}"
|
||||
IsIndeterminate="{Binding UpdateInfo.CheckingForUpdates}"
|
||||
InfoText="{Binding UpdateInfo.UpdateInfoText}"
|
||||
Updating="{Binding UpdateInfo.Updating}"
|
||||
DismissCommand="{Binding DismissUpdateCommand}"
|
||||
UpdateCommand="{Binding UpdateInstallerCommand}"
|
||||
DownloadProgress="{Binding UpdateInfo.DownloadProgress}"
|
||||
UpdateAvailable="{Binding UpdateInfo.UpdateAvailable}"
|
||||
CheckingForUpdate="{Binding UpdateInfo.CheckingForUpdates}"
|
||||
/>
|
||||
<cc:UpdateInfoCard Grid.Row="1" Grid.RowSpan="5" Grid.ColumnSpan="5" Padding="10"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
InfoText="{Binding UpdateInfo.UpdateInfoText}"
|
||||
ShowUpdateCard="{Binding UpdateInfo.ShowCard}"
|
||||
NotNowCommand="{Binding DismissUpdateCommand}"
|
||||
UpdateInstallerCommand="{Binding UpdateInstallerCommand}"
|
||||
Updating="{Binding UpdateInfo.Updating}"
|
||||
DownloadProgress="{Binding UpdateInfo.DownloadProgress}"
|
||||
IndeterminateProgress="{Binding UpdateInfo.CheckingForUpdates}"
|
||||
UpdateAvailable="{Binding UpdateInfo.UpdateAvailable}"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Loading…
x
Reference in New Issue
Block a user