Merge pull request 'Refactoring, namespace-imports and small improvements' (#18) from Schrader/SPT-AKI-Installer:refactoring/namespace-imports into master
Reviewed-on: CWX/SPT-AKI-Installer#18
This commit is contained in:
commit
886770253a
57
.editorconfig
Normal file
57
.editorconfig
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
[*]
|
||||
charset = utf-8-bom
|
||||
end_of_line = crlf
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Microsoft .NET properties
|
||||
csharp_style_namespace_declarations=file_scoped:error
|
||||
csharp_new_line_before_members_in_object_initializers = false
|
||||
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:warning
|
||||
csharp_style_prefer_utf8_string_literals = true:suggestion
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
csharp_style_var_for_built_in_types = true:warning
|
||||
csharp_style_var_when_type_is_apparent = true:warning
|
||||
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
|
||||
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
dotnet_style_qualification_for_event = false:suggestion
|
||||
dotnet_style_qualification_for_field = false:suggestion
|
||||
dotnet_style_qualification_for_method = false:suggestion
|
||||
dotnet_style_qualification_for_property = false:suggestion
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
|
||||
|
||||
# ReSharper properties
|
||||
resharper_autodetect_indent_settings = true
|
||||
resharper_enforce_line_ending_style = true
|
||||
resharper_formatter_off_tag = @formatter:off
|
||||
resharper_formatter_on_tag = @formatter:on
|
||||
resharper_formatter_tags_enabled = true
|
||||
resharper_use_indent_from_vs = false
|
||||
resharper_wrap_lines = true
|
||||
|
||||
# ReSharper inspection severities
|
||||
resharper_arrange_redundant_parentheses_highlighting = hint
|
||||
resharper_arrange_this_qualifier_highlighting = hint
|
||||
resharper_arrange_type_member_modifiers_highlighting = hint
|
||||
resharper_arrange_type_modifiers_highlighting = hint
|
||||
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
|
||||
resharper_built_in_type_reference_style_highlighting = hint
|
||||
resharper_redundant_base_qualifier_highlighting = warning
|
||||
resharper_suggest_var_or_type_built_in_types_highlighting = hint
|
||||
resharper_suggest_var_or_type_elsewhere_highlighting = hint
|
||||
resharper_suggest_var_or_type_simple_types_highlighting = hint
|
||||
resharper_web_config_module_not_resolved_highlighting = warning
|
||||
resharper_web_config_type_not_resolved_highlighting = warning
|
||||
resharper_web_config_wrong_module_highlighting = warning
|
||||
|
||||
[*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,cc,cginc,compute,cp,cpp,cppm,cs,cshtml,cu,cuh,cxx,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,nuspec,paml,razor,resw,resx,shader,skin,tpp,usf,ush,vb,xaml,xamlx,xoml,xsd}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 4
|
@ -4,8 +4,8 @@ using Avalonia.Markup.Xaml;
|
||||
using SPTInstaller.ViewModels;
|
||||
using SPTInstaller.Views;
|
||||
|
||||
namespace SPTInstaller
|
||||
{
|
||||
namespace SPTInstaller;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
@ -26,4 +26,3 @@ namespace SPTInstaller
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SPTInstaller.Behaviors
|
||||
{
|
||||
namespace SPTInstaller.Behaviors;
|
||||
|
||||
public class SpanBehavior : AvaloniaObject
|
||||
{
|
||||
public static readonly AttachedProperty<bool> SpanProperty = AvaloniaProperty.RegisterAttached<SpanBehavior, Interactive, bool>("Span");
|
||||
@ -17,4 +17,3 @@ namespace SPTInstaller.Behaviors
|
||||
return element.GetValue(SpanProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
using SharpCompress;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Controllers
|
||||
{
|
||||
namespace SPTInstaller.Controllers;
|
||||
|
||||
public class InstallController
|
||||
{
|
||||
public event EventHandler<IProgressableTask> TaskChanged = delegate { };
|
||||
@ -40,9 +40,8 @@ namespace SPTInstaller.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var result in requiredResults)
|
||||
if (requiredResults.Any(result => !result.Succeeded))
|
||||
{
|
||||
if (!result.Succeeded)
|
||||
return Result.FromError("Some required checks have failed");
|
||||
}
|
||||
|
||||
@ -65,4 +64,3 @@ namespace SPTInstaller.Controllers
|
||||
return Result.FromSuccess("Install Complete. Happy Playing!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
using Avalonia.Data.Converters;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace SPTInstaller.Converters;
|
||||
|
||||
namespace SPTInstaller.Converters
|
||||
{
|
||||
public class InvertedProgressConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
@ -26,4 +25,3 @@ namespace SPTInstaller.Converters
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using SPTInstaller.Behaviors;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace SPTInstaller.CustomControls
|
||||
{
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public class DistributedSpacePanel : Panel
|
||||
{
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
@ -74,4 +73,3 @@ namespace SPTInstaller.CustomControls
|
||||
return finalSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,8 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SPTInstaller.CustomControls
|
||||
{
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public partial class PreCheckItem : UserControl
|
||||
{
|
||||
public PreCheckItem()
|
||||
@ -59,4 +55,3 @@ namespace SPTInstaller.CustomControls
|
||||
public static readonly StyledProperty<bool> IsRequiredProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, bool>(nameof(IsRequired));
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace SPTInstaller.CustomControls
|
||||
{
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public partial class ProgressableTaskItem : UserControl
|
||||
{
|
||||
public ProgressableTaskItem()
|
||||
@ -74,4 +74,3 @@ namespace SPTInstaller.CustomControls
|
||||
public static readonly StyledProperty<IBrush> CompletedColorProperty =
|
||||
AvaloniaProperty.Register<ProgressableTaskItem, IBrush>(nameof(PendingColor));
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,14 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.CustomControls
|
||||
{
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public partial class ProgressableTaskList : UserControl
|
||||
{
|
||||
public ProgressableTaskList()
|
||||
@ -94,4 +92,3 @@ namespace SPTInstaller.CustomControls
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace SPTInstaller.CustomControls
|
||||
{
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public partial class TaskDetails : UserControl
|
||||
{
|
||||
public TaskDetails()
|
||||
@ -55,4 +55,3 @@ namespace SPTInstaller.CustomControls
|
||||
public static readonly StyledProperty<bool> IndeterminateProgressProperty =
|
||||
AvaloniaProperty.Register<TaskDetails, bool>(nameof(IndeterminateProgress));
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SPTInstaller.CustomControls
|
||||
{
|
||||
namespace SPTInstaller.CustomControls;
|
||||
|
||||
public partial class TitleBar : UserControl
|
||||
{
|
||||
public TitleBar()
|
||||
@ -74,4 +74,3 @@ namespace SPTInstaller.CustomControls
|
||||
set => SetValue(MinButtonCommandProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
using HttpClientProgress;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
public static class DownloadCacheHelper
|
||||
{
|
||||
private static HttpClient _httpClient = new HttpClient() { Timeout = TimeSpan.FromHours(1) };
|
||||
private static HttpClient _httpClient = new() { Timeout = TimeSpan.FromHours(1) };
|
||||
|
||||
private static string _cachePath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "spt-installer/cache");
|
||||
|
||||
@ -111,7 +108,7 @@ namespace SPTInstaller.Aki.Helper
|
||||
|
||||
public static async Task<FileInfo?> GetOrDownloadFileAsync(string fileName, string targetLink, IProgress<double> progress, string expectedHash = null)
|
||||
{
|
||||
FileInfo cacheFile = new FileInfo(Path.Join(_cachePath, fileName));
|
||||
var cacheFile = new FileInfo(Path.Join(_cachePath, fileName));
|
||||
|
||||
try
|
||||
{
|
||||
@ -128,7 +125,7 @@ namespace SPTInstaller.Aki.Helper
|
||||
|
||||
public static async Task<FileInfo?> GetOrDownloadFileAsync(string fileName, Stream fileDownloadStream, string expectedHash = null)
|
||||
{
|
||||
FileInfo cacheFile = new FileInfo(Path.Join(_cachePath, fileName));
|
||||
var cacheFile = new FileInfo(Path.Join(_cachePath, fileName));
|
||||
|
||||
try
|
||||
{
|
||||
@ -143,4 +140,3 @@ namespace SPTInstaller.Aki.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,13 @@
|
||||
using Gitea.Model;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using Gitea.Model;
|
||||
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
public static class FileHashHelper
|
||||
{
|
||||
public static string GetGiteaReleaseHash(Release release)
|
||||
public static string? GetGiteaReleaseHash(Release release)
|
||||
{
|
||||
var regex = Regex.Match(release.Body, @"Release Hash: (?<hash>\S+)");
|
||||
|
||||
@ -23,16 +21,14 @@ namespace SPTInstaller.Aki.Helper
|
||||
|
||||
public static bool CheckHash(FileInfo file, string expectedHash)
|
||||
{
|
||||
using (MD5 md5Service = MD5.Create())
|
||||
using (var sourceStream = file.OpenRead())
|
||||
{
|
||||
byte[] sourceHash = md5Service.ComputeHash(sourceStream);
|
||||
byte[] expectedHashBytes = Convert.FromBase64String(expectedHash);
|
||||
using var md5Service = MD5.Create();
|
||||
using var sourceStream = file.OpenRead();
|
||||
|
||||
bool matched = Enumerable.SequenceEqual(sourceHash, expectedHashBytes);
|
||||
var sourceHash = md5Service.ComputeHash(sourceStream);
|
||||
var expectedHashBytes = Convert.FromBase64String(expectedHash);
|
||||
|
||||
var matched = Enumerable.SequenceEqual(sourceHash, expectedHashBytes);
|
||||
|
||||
return matched;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
using ReactiveUI;
|
||||
using System.Text.RegularExpressions;
|
||||
using Serilog;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
public static class FileHelper
|
||||
{
|
||||
private static Result IterateDirectories(DirectoryInfo sourceDir, DirectoryInfo targetDir)
|
||||
@ -87,4 +84,3 @@ namespace SPTInstaller.Aki.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HttpClientProgress
|
||||
{
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
public static class HttpClientProgressExtensions
|
||||
{
|
||||
public static async Task DownloadDataAsync(this HttpClient client, string requestUrl, Stream destination, IProgress<double> progress = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
@ -54,4 +52,3 @@ namespace HttpClientProgress
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
using Microsoft.Win32;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32;
|
||||
using SPTInstaller.Models;
|
||||
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
public static class PreCheckHelper
|
||||
{
|
||||
private const string registryInstall = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
|
||||
@ -37,4 +35,3 @@ namespace SPTInstaller.Aki.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
using SPTInstaller.Models;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using SPTInstaller.Models;
|
||||
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
public enum PatcherExitCode
|
||||
{
|
||||
ProgramClosed = 0,
|
||||
@ -21,7 +20,8 @@ namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
if (!executable.Exists || !workingDir.Exists)
|
||||
{
|
||||
return Result.FromError($"Could not find executable ({executable.Name}) or working directory ({workingDir.Name})");
|
||||
return Result.FromError(
|
||||
$"Could not find executable ({executable.Name}) or working directory ({workingDir.Name})");
|
||||
}
|
||||
|
||||
var process = new Process();
|
||||
@ -58,4 +58,3 @@ namespace SPTInstaller.Aki.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
using Serilog;
|
||||
using Splat;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace SPTInstaller.Helpers
|
||||
{
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// A helper class to handle simple service registration to Splat with constructor parameter injection
|
||||
/// </summary>
|
||||
@ -126,4 +125,3 @@ namespace SPTInstaller.Helpers
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
using SharpCompress.Archives;
|
||||
using System.Linq;
|
||||
using SharpCompress.Archives;
|
||||
using SharpCompress.Archives.Zip;
|
||||
using SharpCompress.Common;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace SPTInstaller.Aki.Helper
|
||||
{
|
||||
namespace SPTInstaller.Helpers;
|
||||
|
||||
public static class ZipHelper
|
||||
{
|
||||
public static Result Decompress(FileInfo ArchivePath, DirectoryInfo OutputFolderPath, IProgress<double> progress = null)
|
||||
@ -20,7 +18,7 @@ namespace SPTInstaller.Aki.Helper
|
||||
|
||||
using var archive = ZipArchive.Open(ArchivePath);
|
||||
var totalEntries = archive.Entries.Where(entry => !entry.IsDirectory);
|
||||
int processedEntries = 0;
|
||||
var processedEntries = 0;
|
||||
|
||||
foreach (var entry in totalEntries)
|
||||
{
|
||||
@ -53,4 +51,3 @@ namespace SPTInstaller.Aki.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
using Serilog;
|
||||
using SPTInstaller.Aki.Helper;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks
|
||||
{
|
||||
public class CopyClientTask : InstallerTaskBase
|
||||
{
|
||||
private InternalData _data;
|
||||
@ -27,4 +24,3 @@ namespace SPTInstaller.Installer_Tasks
|
||||
return FileHelper.CopyDirectoryWithProgress(originalGameDirInfo, targetInstallDirInfo, (message, progress) => { SetStatus(null, message, progress, null, true); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,13 @@
|
||||
using CG.Web.MegaApiClient;
|
||||
using Newtonsoft.Json;
|
||||
using SPTInstaller.Aki.Helper;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks
|
||||
{
|
||||
public class DownloadTask : InstallerTaskBase
|
||||
{
|
||||
private InternalData _data;
|
||||
@ -123,4 +121,3 @@ namespace SPTInstaller.Installer_Tasks
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
using SPTInstaller.Aki.Helper;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System.Threading.Tasks;
|
||||
using SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks
|
||||
{
|
||||
public class InitializationTask : InstallerTaskBase
|
||||
{
|
||||
private InternalData _data;
|
||||
@ -56,4 +56,3 @@ namespace SPTInstaller.Installer_Tasks
|
||||
return Result.FromSuccess($"Current Game Version: {_data.OriginalGameVersion}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks.PreChecks
|
||||
{
|
||||
namespace SPTInstaller.Installer_Tasks.PreChecks;
|
||||
|
||||
public class NetCore6PreCheck : PreCheckBase
|
||||
{
|
||||
public NetCore6PreCheck() : base(".Net Core 6 Desktop Runtime", false)
|
||||
@ -55,4 +54,3 @@ namespace SPTInstaller.Installer_Tasks.PreChecks
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
using Microsoft.Win32;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks.PreChecks
|
||||
{
|
||||
namespace SPTInstaller.Installer_Tasks.PreChecks;
|
||||
|
||||
public class NetFramework472PreCheck : PreCheckBase
|
||||
{
|
||||
public NetFramework472PreCheck() : base(".Net Framework 4.7.2", false)
|
||||
@ -43,4 +42,3 @@ namespace SPTInstaller.Installer_Tasks.PreChecks
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
using Gitea.Api;
|
||||
using Gitea.Client;
|
||||
using SPTInstaller.Aki.Helper;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks
|
||||
{
|
||||
public class ReleaseCheckTask : InstallerTaskBase
|
||||
{
|
||||
private InternalData _data;
|
||||
@ -86,4 +85,3 @@ namespace SPTInstaller.Installer_Tasks
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
using SPTInstaller.Aki.Helper;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using SPTInstaller.Helpers;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks
|
||||
{
|
||||
public class SetupClientTask : InstallerTaskBase
|
||||
{
|
||||
private InternalData _data;
|
||||
@ -85,4 +83,3 @@ namespace SPTInstaller.Installer_Tasks
|
||||
return Result.FromSuccess("SPT is Setup. Happy Playing!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks
|
||||
{
|
||||
namespace SPTInstaller.Installer_Tasks;
|
||||
|
||||
internal class TestTask : InstallerTaskBase
|
||||
{
|
||||
public static TestTask FromRandomName() => new TestTask($"Test Task #{new Random().Next(0, 9999)}");
|
||||
@ -15,14 +14,14 @@ namespace SPTInstaller.Installer_Tasks
|
||||
|
||||
public async override Task<IResult> TaskOperation()
|
||||
{
|
||||
int total = 4;
|
||||
TimeSpan interval = TimeSpan.FromSeconds(1);
|
||||
var total = 4;
|
||||
var interval = TimeSpan.FromSeconds(1);
|
||||
|
||||
for(int i = 0; i < total; i++)
|
||||
for(var i = 0; i < total; i++)
|
||||
{
|
||||
var count = i + 1;
|
||||
string progressMessage = $"Running Task: {Name}";
|
||||
int progress = (int)Math.Floor((double)count / total * 100);
|
||||
var progressMessage = $"Running Task: {Name}";
|
||||
var progress = (int)Math.Floor((double)count / total * 100);
|
||||
|
||||
SetStatus(progressMessage, $"Details: ({count}/{total})", progress);
|
||||
|
||||
@ -32,4 +31,3 @@ namespace SPTInstaller.Installer_Tasks
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Interfaces
|
||||
{
|
||||
namespace SPTInstaller.Interfaces;
|
||||
|
||||
public interface IPreCheck
|
||||
{
|
||||
public string Id { get; }
|
||||
@ -14,4 +14,3 @@ namespace SPTInstaller.Interfaces
|
||||
|
||||
public Task<IResult> RunCheck();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Interfaces
|
||||
{
|
||||
namespace SPTInstaller.Interfaces;
|
||||
|
||||
public interface IProgressableTask
|
||||
{
|
||||
public string Id { get; }
|
||||
@ -21,4 +21,3 @@ namespace SPTInstaller.Interfaces
|
||||
|
||||
public Task<IResult> RunAsync();
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace SPTInstaller.Interfaces;
|
||||
|
||||
namespace SPTInstaller.Interfaces
|
||||
{
|
||||
public interface IResult
|
||||
{
|
||||
public bool Succeeded { get; }
|
||||
public string Message { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
namespace SPTInstaller.Models
|
||||
{
|
||||
namespace SPTInstaller.Models;
|
||||
|
||||
public class DownloadMirror
|
||||
{
|
||||
public string Link { get; set; }
|
||||
public string Hash { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,10 @@
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using Serilog;
|
||||
using Splat;
|
||||
using SPTInstaller.Interfaces;
|
||||
using System;
|
||||
using System.Security;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Models
|
||||
{
|
||||
namespace SPTInstaller.Models;
|
||||
|
||||
public abstract class InstallerTaskBase : ReactiveObject, IProgressableTask
|
||||
{
|
||||
private string _id;
|
||||
@ -180,4 +176,3 @@ namespace SPTInstaller.Models
|
||||
/// <returns></returns>
|
||||
public abstract Task<IResult> TaskOperation();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace SPTInstaller.Models
|
||||
{
|
||||
namespace SPTInstaller.Models;
|
||||
|
||||
public class InternalData
|
||||
{
|
||||
/// <summary>
|
||||
@ -55,4 +54,3 @@ namespace SPTInstaller.Models
|
||||
/// </summary>
|
||||
public bool PatchNeeded { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
using ReactiveUI;
|
||||
using SPTInstaller.Interfaces;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Models
|
||||
{
|
||||
namespace SPTInstaller.Models;
|
||||
|
||||
public abstract class PreCheckBase : ReactiveObject, IPreCheck
|
||||
{
|
||||
private string _id;
|
||||
@ -73,4 +72,3 @@ namespace SPTInstaller.Models
|
||||
|
||||
public abstract Task<bool> CheckOperation();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using SPTInstaller.Interfaces;
|
||||
|
||||
namespace SPTInstaller.Models
|
||||
{
|
||||
namespace SPTInstaller.Models;
|
||||
|
||||
public class Result : IResult
|
||||
{
|
||||
public bool Succeeded { get; private set; }
|
||||
@ -14,7 +14,6 @@ namespace SPTInstaller.Models
|
||||
Succeeded = succeeded;
|
||||
}
|
||||
|
||||
public static Result FromSuccess(string message = "") => new Result(message, true);
|
||||
public static Result FromError(string message) => new Result(message, false);
|
||||
}
|
||||
public static Result FromSuccess(string message = "") => new(message, true);
|
||||
public static Result FromError(string message) => new(message, false);
|
||||
}
|
@ -12,8 +12,8 @@ using SPTInstaller.Models;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SPTInstaller
|
||||
{
|
||||
namespace SPTInstaller;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
@ -72,4 +72,3 @@ namespace SPTInstaller
|
||||
.UseReactiveUI();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using SPTInstaller.ViewModels;
|
||||
using System;
|
||||
|
||||
namespace SPTInstaller
|
||||
{
|
||||
namespace SPTInstaller;
|
||||
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
public IControl Build(object data)
|
||||
@ -25,4 +24,3 @@ namespace SPTInstaller
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,11 +4,10 @@ using SPTInstaller.Helpers;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.ViewModels
|
||||
{
|
||||
namespace SPTInstaller.ViewModels;
|
||||
|
||||
public class InstallViewModel : ViewModelBase
|
||||
{
|
||||
private IProgressableTask _currentTask;
|
||||
@ -18,8 +17,7 @@ namespace SPTInstaller.ViewModels
|
||||
set => this.RaiseAndSetIfChanged(ref _currentTask, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<InstallerTaskBase> MyTasks { get; set; }
|
||||
= new ObservableCollection<InstallerTaskBase>(ServiceHelper.GetAll<InstallerTaskBase>());
|
||||
public ObservableCollection<InstallerTaskBase> MyTasks { get; set; } = new(ServiceHelper.GetAll<InstallerTaskBase>());
|
||||
|
||||
public InstallViewModel(IScreen host) : base(host)
|
||||
{
|
||||
@ -35,4 +33,3 @@ namespace SPTInstaller.ViewModels
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,14 @@
|
||||
using Avalonia;
|
||||
using ReactiveUI;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SPTInstaller.ViewModels
|
||||
{
|
||||
namespace SPTInstaller.ViewModels;
|
||||
|
||||
public class MainWindowViewModel : ReactiveObject, IActivatableViewModel, IScreen
|
||||
{
|
||||
public RoutingState Router { get; } = new RoutingState();
|
||||
public ViewModelActivator Activator { get; } = new ViewModelActivator();
|
||||
public RoutingState Router { get; } = new();
|
||||
public ViewModelActivator Activator { get; } = new();
|
||||
|
||||
private string _title;
|
||||
public string Title
|
||||
@ -47,4 +46,3 @@ namespace SPTInstaller.ViewModels
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -4,8 +4,8 @@ using Serilog;
|
||||
using SPTInstaller.Interfaces;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SPTInstaller.ViewModels
|
||||
{
|
||||
namespace SPTInstaller.ViewModels;
|
||||
|
||||
public class MessageViewModel : ViewModelBase
|
||||
{
|
||||
private bool _HasErrors;
|
||||
@ -44,4 +44,3 @@ namespace SPTInstaller.ViewModels
|
||||
Log.Error(Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
using SPTInstaller.Aki.Helper;
|
||||
using SPTInstaller.Controllers;
|
||||
using SPTInstaller.Helpers;
|
||||
using SPTInstaller.Models;
|
||||
|
@ -1,13 +1,12 @@
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
namespace SPTInstaller.ViewModels
|
||||
{
|
||||
namespace SPTInstaller.ViewModels;
|
||||
|
||||
public class ViewModelBase : ReactiveObject, IActivatableViewModel, IRoutableViewModel
|
||||
{
|
||||
public ViewModelActivator Activator { get; } = new ViewModelActivator();
|
||||
public ViewModelActivator Activator { get; } = new();
|
||||
|
||||
public string? UrlPathSegment => Guid.NewGuid().ToString().Substring(0, 7);
|
||||
|
||||
@ -57,5 +56,3 @@ namespace SPTInstaller.ViewModels
|
||||
HostScreen = Host;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.ReactiveUI;
|
||||
using SPTInstaller.ViewModels;
|
||||
|
||||
namespace SPTInstaller.Views
|
||||
{
|
||||
namespace SPTInstaller.Views;
|
||||
|
||||
public partial class InstallView : ReactiveUserControl<InstallViewModel>
|
||||
{
|
||||
public InstallView()
|
||||
@ -11,4 +10,3 @@ namespace SPTInstaller.Views
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace SPTInstaller.Views
|
||||
{
|
||||
namespace SPTInstaller.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
@ -9,4 +9,3 @@ namespace SPTInstaller.Views
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.ReactiveUI;
|
||||
using SPTInstaller.ViewModels;
|
||||
|
||||
namespace SPTInstaller.Views
|
||||
{
|
||||
namespace SPTInstaller.Views;
|
||||
|
||||
public partial class MessageView : ReactiveUserControl<MessageViewModel>
|
||||
{
|
||||
public MessageView()
|
||||
@ -11,4 +10,3 @@ namespace SPTInstaller.Views
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Avalonia.ReactiveUI;
|
||||
using SPTInstaller.ViewModels;
|
||||
|
||||
namespace SPTInstaller.Views
|
||||
{
|
||||
namespace SPTInstaller.Views;
|
||||
|
||||
public partial class PreChecksView : ReactiveUserControl<PreChecksViewModel>
|
||||
{
|
||||
public PreChecksView()
|
||||
@ -10,4 +10,3 @@ namespace SPTInstaller.Views
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user