From a0a6e6dd81a58eb3d0ef369e6f228e232369c41d Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Wed, 10 Jul 2024 17:28:28 -0400 Subject: [PATCH] use continue instead of break debug log is now copied to install folder; copy button now copies patcher log as well --- SPTInstaller/Helpers/FileHelper.cs | 2 +- SPTInstaller/SPTInstaller.csproj | 4 ++-- SPTInstaller/ViewModels/MessageViewModel.cs | 23 ++++++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/SPTInstaller/Helpers/FileHelper.cs b/SPTInstaller/Helpers/FileHelper.cs index 4b8f331..1b81667 100644 --- a/SPTInstaller/Helpers/FileHelper.cs +++ b/SPTInstaller/Helpers/FileHelper.cs @@ -61,7 +61,7 @@ public static class FileHelper if (currentFileRelativePath.EndsWith(".bak")) { Log.Debug($"EXCLUDING BAK FILE :: {currentFileRelativePath}"); - break; + continue; } fileCopies.Add(new CopyInfo(file.FullName, file.FullName.Replace(sourceDir.FullName, targetDir.FullName))); diff --git a/SPTInstaller/SPTInstaller.csproj b/SPTInstaller/SPTInstaller.csproj index 552f7d4..f7b46e1 100644 --- a/SPTInstaller/SPTInstaller.csproj +++ b/SPTInstaller/SPTInstaller.csproj @@ -10,8 +10,8 @@ icon.ico Assets\spt_installer.ico Debug;Release;TEST - 2.88 - 2.88 + 2.89 + 2.89 SPT diff --git a/SPTInstaller/ViewModels/MessageViewModel.cs b/SPTInstaller/ViewModels/MessageViewModel.cs index 3f348a9..31db2bc 100644 --- a/SPTInstaller/ViewModels/MessageViewModel.cs +++ b/SPTInstaller/ViewModels/MessageViewModel.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System.Collections.Generic; +using System.Diagnostics; using Avalonia; using ReactiveUI; using Serilog; @@ -93,15 +94,26 @@ public class MessageViewModel : ViewModelBase } var dataObject = new DataObject(); - var logFile = await desktop.MainWindow.StorageProvider.TryGetFileFromPathAsync(data.DebugMode ? App.LogDebugPath : App.LogPath); + + var filesToCopy = new List(); + var logFile = await desktop.MainWindow.StorageProvider.TryGetFileFromPathAsync(data.DebugMode ? App.LogDebugPath : App.LogPath); + var patcherLogFile = await desktop.MainWindow.StorageProvider.TryGetFileFromPathAsync(Path.Join(data.TargetInstallPath, "patcher.log")); + if (logFile == null) { ClipCommandText = "Could not get log file :("; return; } - dataObject.Set(DataFormats.Files, new[] {logFile}); + filesToCopy.Add(logFile); + + if (patcherLogFile != null) + { + filesToCopy.Add(patcherLogFile); + } + + dataObject.Set(DataFormats.Files, filesToCopy.ToArray()); await desktop.MainWindow.Clipboard.SetDataObjectAsync(dataObject); ClipCommandText = "Copied!"; @@ -190,6 +202,11 @@ public class MessageViewModel : ViewModelBase } File.Copy(App.LogPath, Path.Join(data.TargetInstallPath, "spt-installer.log"), true); + + if (data.DebugMode) + { + File.Copy(App.LogDebugPath, Path.Join(data.TargetInstallPath, "spt-installer-debug.log"), true); + } } catch (Exception ex) {