From 98969ed9783c96b10cf83ca10dbabe55c21dedb0 Mon Sep 17 00:00:00 2001 From: ProphetLamb Date: Wed, 6 Oct 2021 22:24:31 +0200 Subject: [PATCH] Uncommited changes I found on disk --- CrossoutLogViewer.Common/ArrayUtility.cs | 1 - .../Connection/PatchHelper.cs | 18 +++-- .../CollectedStatisticsWindow.xaml.cs | 2 +- .../Controls/PartyControl.xaml | 75 +++++++++---------- .../Controls/PartyControl.xaml.cs | 2 + 5 files changed, 53 insertions(+), 45 deletions(-) diff --git a/CrossoutLogViewer.Common/ArrayUtility.cs b/CrossoutLogViewer.Common/ArrayUtility.cs index 9735294..4ef0fc8 100644 --- a/CrossoutLogViewer.Common/ArrayUtility.cs +++ b/CrossoutLogViewer.Common/ArrayUtility.cs @@ -50,6 +50,5 @@ public static int IndexOf(this T[] array, T element) where T : IEquatable } return -1; } - } } diff --git a/CrossoutLogViewer.Database/Connection/PatchHelper.cs b/CrossoutLogViewer.Database/Connection/PatchHelper.cs index d78d54a..cdc4443 100644 --- a/CrossoutLogViewer.Database/Connection/PatchHelper.cs +++ b/CrossoutLogViewer.Database/Connection/PatchHelper.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; namespace CrossoutLogView.Database.Connection { @@ -10,15 +11,22 @@ public static class PatchHelper { public static async IAsyncEnumerable EnumeratePatches(string database, Version minVersion) { - foreach (var file in Directory.EnumerateFiles(Strings.PatchPath)) + if (File.Exists(Strings.PatchPath)) { - if (VerifyPatch(file, database, minVersion)) + foreach (var file in Directory.EnumerateFiles(Strings.PatchPath).Where(path => !path.Contains(Strings.MetadataFile, StringComparison.InvariantCultureIgnoreCase))) { - using var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - using var sr = new StreamReader(fs); - yield return await sr.ReadToEndAsync(); + if (VerifyPatch(file, database, minVersion)) + { + using var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using var sr = new StreamReader(fs); + yield return await sr.ReadToEndAsync(); + } } } + else + { + await System.Threading.Tasks.Task.Run(() => Directory.CreateDirectory(Strings.PatchPath)); + } } public static bool VerifyPatch(string filePath, string database, Version minVersion) diff --git a/CrossoutLogViewer.GUI/CollectedStatisticsWindow.xaml.cs b/CrossoutLogViewer.GUI/CollectedStatisticsWindow.xaml.cs index b005757..7ad337c 100644 --- a/CrossoutLogViewer.GUI/CollectedStatisticsWindow.xaml.cs +++ b/CrossoutLogViewer.GUI/CollectedStatisticsWindow.xaml.cs @@ -79,7 +79,7 @@ private void ApplyViewModel(object sender, EventArgs e) CollectedStatisticsWindowViewModel.InvalidatedCachedData += OnInvalidateCachedData; - Title = String.Concat(App.GetWindowResource("Stat_Title"), " (", viewModel.MeUser.User.Name, ")"); + Title = String.Concat(App.GetWindowResource("Stat_Title"), " (", viewModel.MeUser?.User?.Name ?? "", ")"); HamburgerMenuControl.Focus(); IsEnabled = true; diff --git a/CrossoutLogViewer.GUI/Controls/PartyControl.xaml b/CrossoutLogViewer.GUI/Controls/PartyControl.xaml index c933457..7d7db52 100644 --- a/CrossoutLogViewer.GUI/Controls/PartyControl.xaml +++ b/CrossoutLogViewer.GUI/Controls/PartyControl.xaml @@ -26,50 +26,49 @@ - - - -