diff --git a/.idea/.idea.SPTInstaller/.idea/avalonia.xml b/.idea/.idea.SPTInstaller/.idea/avalonia.xml
index 613e7e9..9e7777d 100644
--- a/.idea/.idea.SPTInstaller/.idea/avalonia.xml
+++ b/.idea/.idea.SPTInstaller/.idea/avalonia.xml
@@ -4,10 +4,12 @@
diff --git a/SPTInstaller/App.axaml b/SPTInstaller/App.axaml
index 84fd4c0..1f4245f 100644
--- a/SPTInstaller/App.axaml
+++ b/SPTInstaller/App.axaml
@@ -40,5 +40,9 @@
/>
+
diff --git a/SPTInstaller/App.axaml.cs b/SPTInstaller/App.axaml.cs
index cd3978a..a43aaa9 100644
--- a/SPTInstaller/App.axaml.cs
+++ b/SPTInstaller/App.axaml.cs
@@ -12,17 +12,16 @@ namespace SPTInstaller;
public partial class App : Application
{
+ private readonly string _logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log");
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
-
- var logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log");
-
+
Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Debug()
+ .MinimumLevel.Information()
.WriteTo
- .File(path: logPath,
- restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug,
+ .File(path: _logPath,
+ restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information,
rollingInterval: RollingInterval.Day)
.CreateLogger();
@@ -37,15 +36,25 @@ public partial class App : Application
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
- if (desktop.Args != null && desktop.Args.Any(x => x.ToLower() == "debug"))
+ var debug = desktop.Args != null && desktop.Args.Any(x => x.ToLower() == "debug");
+ if (debug)
{
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo
+ .File(path: _logPath,
+ restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug,
+ rollingInterval: RollingInterval.Day)
+ .CreateLogger();
+
System.Diagnostics.Trace.Listeners.Add(new SerilogTraceListener.SerilogTraceListener());
+
Log.Debug("TraceListener is registered");
}
desktop.MainWindow = new MainWindow
{
- DataContext = new MainWindowViewModel(),
+ DataContext = new MainWindowViewModel(debug),
};
}
diff --git a/SPTInstaller/Assets/Styles.axaml b/SPTInstaller/Assets/Styles.axaml
index b22a99f..35af7af 100644
--- a/SPTInstaller/Assets/Styles.axaml
+++ b/SPTInstaller/Assets/Styles.axaml
@@ -1,11 +1,14 @@
-
+
@@ -248,4 +251,21 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SPTInstaller/Helpers/FileHelper.cs b/SPTInstaller/Helpers/FileHelper.cs
index 13896a0..48399f9 100644
--- a/SPTInstaller/Helpers/FileHelper.cs
+++ b/SPTInstaller/Helpers/FileHelper.cs
@@ -24,6 +24,7 @@ public static class FileHelper
if (currentDirRelativePath.StartsWith(exclusion) || currentDirRelativePath == exclusion)
{
exclude = true;
+ Log.Debug($"EXCLUSION FOUND :: DIR\nExclusion: '{exclusion}'\nPath: '{currentDirRelativePath}'");
break;
}
}
@@ -62,6 +63,7 @@ public static class FileHelper
if (currentFileRelativePath.StartsWith(exclusion) || currentFileRelativePath == exclusion)
{
exclude = true;
+ Log.Debug($"EXCLUSION FOUND :: FILE\nExclusion: '{exclusion}'\nPath: '{currentFileRelativePath}'");
break;
}
}
@@ -69,7 +71,12 @@ public static class FileHelper
if (exclude)
continue;
- File.Copy(file.FullName, file.FullName.Replace(sourceDir.FullName, targetDir.FullName), true);
+
+ var targetFile = file.FullName.Replace(sourceDir.FullName, targetDir.FullName);
+
+ Log.Debug($"COPY\nSourceDir: '{sourceDir.FullName}'\nTargetDir: '{targetDir.FullName}'\nNewPath: '{targetFile}'");
+
+ File.Copy(file.FullName, targetFile, true);
processedFiles++;
}
diff --git a/SPTInstaller/SPTInstaller.csproj b/SPTInstaller/SPTInstaller.csproj
index 685cca1..f1ea53e 100644
--- a/SPTInstaller/SPTInstaller.csproj
+++ b/SPTInstaller/SPTInstaller.csproj
@@ -9,8 +9,8 @@
icon.ico
Assets\icon.ico
Debug;Release;TEST
- 2.29
- 2.29
+ 2.30
+ 2.30
SPT-AKI
diff --git a/SPTInstaller/ViewModels/DetailedPreChecksViewModel.cs b/SPTInstaller/ViewModels/DetailedPreChecksViewModel.cs
index 83c5618..dcd20d2 100644
--- a/SPTInstaller/ViewModels/DetailedPreChecksViewModel.cs
+++ b/SPTInstaller/ViewModels/DetailedPreChecksViewModel.cs
@@ -3,7 +3,7 @@
namespace SPTInstaller.ViewModels;
public class DetailedPreChecksViewModel : PreChecksViewModel
{
- public DetailedPreChecksViewModel(IScreen host) : base(host)
+ public DetailedPreChecksViewModel(IScreen host, bool debugging) : base(host, debugging)
{
}
}
diff --git a/SPTInstaller/ViewModels/MainWindowViewModel.cs b/SPTInstaller/ViewModels/MainWindowViewModel.cs
index 6d767d0..338834e 100644
--- a/SPTInstaller/ViewModels/MainWindowViewModel.cs
+++ b/SPTInstaller/ViewModels/MainWindowViewModel.cs
@@ -19,11 +19,11 @@ public class MainWindowViewModel : ReactiveObject, IActivatableViewModel, IScree
set => this.RaiseAndSetIfChanged(ref _title, value);
}
- public MainWindowViewModel()
+ public MainWindowViewModel(bool debugging)
{
Configuration.Default.BasePath = "https://dev.sp-tarkov.com/api/v1";
- Title = $"SPT Installer {"v" + Assembly.GetExecutingAssembly().GetName()?.Version?.ToString() ?? "--unknown version--"}";
+ Title = $"{(debugging ? "-debug-" : "")} SPT Installer {"v" + Assembly.GetExecutingAssembly().GetName()?.Version?.ToString() ?? "--unknown version--"}";
Log.Information($"========= {Title} Started =========");
Log.Information(Environment.OSVersion.VersionString);
@@ -32,7 +32,7 @@ public class MainWindowViewModel : ReactiveObject, IActivatableViewModel, IScree
Log.Information("System Language: {iso} - {name}", uiCulture.TwoLetterISOLanguageName, uiCulture.DisplayName);
- Router.Navigate.Execute(new PreChecksViewModel(this));
+ Router.Navigate.Execute(new PreChecksViewModel(this, debugging));
}
public void CloseCommand()
diff --git a/SPTInstaller/ViewModels/PreChecksViewModel.cs b/SPTInstaller/ViewModels/PreChecksViewModel.cs
index d87575f..e651b58 100644
--- a/SPTInstaller/ViewModels/PreChecksViewModel.cs
+++ b/SPTInstaller/ViewModels/PreChecksViewModel.cs
@@ -1,8 +1,8 @@
using System.Collections.ObjectModel;
+using System.Diagnostics;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Input;
-using Avalonia.Controls;
using Avalonia.Threading;
using DialogHostAvalonia;
using Gitea.Api;
@@ -26,9 +26,19 @@ public class PreChecksViewModel : ViewModelBase
public ICommand UpdateInstallerCommand { get; set; }
public ICommand DismissUpdateCommand { get; set; }
+
+ public ICommand LaunchWithDebug { get; set; }
public InstallerUpdateInfo UpdateInfo { get; set; } = new();
+ private bool _debugging;
+
+ public bool Debugging
+ {
+ get => _debugging;
+ set => this.RaiseAndSetIfChanged(ref _debugging, value);
+ }
+
private string _installPath;
public string InstallPath
{
@@ -91,8 +101,9 @@ public class PreChecksViewModel : ViewModelBase
});
}
- public PreChecksViewModel(IScreen host) : base(host)
+ public PreChecksViewModel(IScreen host, bool debugging) : base(host)
{
+ Debugging = debugging;
var data = ServiceHelper.Get();
var installer = ServiceHelper.Get();
@@ -162,6 +173,25 @@ public class PreChecksViewModel : ViewModelBase
}
});
+ LaunchWithDebug = ReactiveCommand.Create(async () =>
+ {
+ try
+ {
+ var installerPath = Path.Join(_installPath, "SPTInstaller.exe");
+ Process.Start(new ProcessStartInfo()
+ {
+ FileName = installerPath,
+ Arguments = "debug"
+ });
+
+ Environment.Exit(0);
+ }
+ catch (Exception ex)
+ {
+ Log.Error(ex, "Failed to enter debug mode");
+ }
+ });
+
StartInstallCommand = ReactiveCommand.Create(async () =>
{
UpdateInfo.ShowCard = false;
@@ -173,7 +203,7 @@ public class PreChecksViewModel : ViewModelBase
UpdateInfo.ShowCard = false;
Log.Logger.Information("Opening Detailed PreCheck View");
installer.RecheckRequested -= ReCheckRequested;
- NavigateTo(new DetailedPreChecksViewModel(HostScreen));
+ NavigateTo(new DetailedPreChecksViewModel(HostScreen, Debugging));
});
UpdateInstallerCommand = ReactiveCommand.Create(async () =>
diff --git a/SPTInstaller/Views/PreChecksView.axaml b/SPTInstaller/Views/PreChecksView.axaml
index b527cc1..24a688c 100644
--- a/SPTInstaller/Views/PreChecksView.axaml
+++ b/SPTInstaller/Views/PreChecksView.axaml
@@ -70,5 +70,15 @@
VerticalAlignment="Bottom" HorizontalAlignment="Left"
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}"
/>
+
+