Skip to content

Commit

Permalink
Uncommited changes I found on disk
Browse files Browse the repository at this point in the history
  • Loading branch information
ProphetLamb committed Oct 6, 2021
1 parent fdafdd6 commit 98969ed
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 45 deletions.
1 change: 0 additions & 1 deletion CrossoutLogViewer.Common/ArrayUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ public static int IndexOf<T>(this T[] array, T element) where T : IEquatable<T>
}
return -1;
}

}
}
18 changes: 13 additions & 5 deletions CrossoutLogViewer.Database/Connection/PatchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace CrossoutLogView.Database.Connection
{
public static class PatchHelper
{
public static async IAsyncEnumerable<string> 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)
Expand Down
2 changes: 1 addition & 1 deletion CrossoutLogViewer.GUI/CollectedStatisticsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
75 changes: 37 additions & 38 deletions CrossoutLogViewer.GUI/Controls/PartyControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,49 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Style="{DynamicResource BorderStyle.Highlight}"
Background="{DynamicResource MahApps.Brushes.Gray.SemiTransparent}"
BorderThickness="0"
Background="{DynamicResource MahApps.Brushes.Control.Background}"
HorizontalAlignment="Left"
Margin="4,4,4,8">
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
<StackPanel DataContext="{Binding .}"
Orientation="Vertical"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<StackPanel Orientation="Horizontal"
Margin="0,4,0,4">
<local:UserOverview DataContext="{Binding .}"
DamageGroupVisibility="Collapsed"
StatDisplayVisibility="Collapsed" />
<Button Content="{Binding Source={StaticResource res}, Path=.[Party_OpenGames]}"
Style="{DynamicResource Button.Outline}"
Click="Button_PartyGames_Click"
VerticalAlignment="Center"
Margin="8,0,0,0" />
<Button Content="{Binding Source={StaticResource res}, Path=.[Games_OpenUsers]}"
Style="{DynamicResource Button.Outline}"
Click="Button_PartyUsers_Click"
VerticalAlignment="Center"
Margin="4,0,0,0" />
</StackPanel>
<Expander Header="{Binding Path=., Converter={StaticResource PartyUsersConverter}}"
Controls:HeaderedControlHelper.HeaderFontSize="14"
IsExpanded="{Binding UsersExpanded, Mode=TwoWay}"
Background="{DynamicResource MahApps.Brushes.ThemeBackground}">
<StackPanel Orientation="Vertical">
<local:UserOverview DataContext="{Binding ElementName=UserDateGrid, Path=SelectedItem}"
GameStatGroupVisibility="Collapsed"
Margin="0,0,0,4" />
<local:UserDataGrid x:Name="UserDateGrid"
ItemsSource="{Binding Users}"
SelectedIndex="0"
SelectedItem="{Binding SelectedUser, Mode=TwoWay}"
PreviewMouseWheel="UserDateGrid_PreviewMouseWheel"
OpenViewModel="UserDateGrid_OpenViewModel" />
<StackPanel DataContext="{Binding .}"
Orientation="Vertical"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<StackPanel Orientation="Horizontal"
Margin="0,4,0,4">
<local:UserOverview DataContext="{Binding .}"
DamageGroupVisibility="Collapsed"
StatDisplayVisibility="Collapsed" />
<Button Content="{Binding Source={StaticResource res}, Path=.[Party_OpenGames]}"
Style="{DynamicResource Button.Outline}"
Click="Button_PartyGames_Click"
VerticalAlignment="Center"
Margin="8,0,0,0" />
<Button Content="{Binding Source={StaticResource res}, Path=.[Games_OpenUsers]}"
Style="{DynamicResource Button.Outline}"
Click="Button_PartyUsers_Click"
VerticalAlignment="Center"
Margin="4,0,0,0" />
</StackPanel>
</Expander>
</StackPanel>
<Expander Header="{Binding Path=., Converter={StaticResource PartyUsersConverter}}"
Controls:HeaderedControlHelper.HeaderFontSize="14"
IsExpanded="{Binding UsersExpanded, Mode=TwoWay}"
Background="{DynamicResource MahApps.Brushes.ThemeBackground}">
<StackPanel Orientation="Vertical">
<local:UserOverview DataContext="{Binding ElementName=UserDateGrid, Path=SelectedItem}"
GameStatGroupVisibility="Collapsed"
Margin="0,0,0,4" />
<local:UserDataGrid x:Name="UserDateGrid"
ItemsSource="{Binding Users}"
SelectedIndex="0"
SelectedItem="{Binding SelectedUser, Mode=TwoWay}"
PreviewMouseWheel="UserDateGrid_PreviewMouseWheel"
OpenViewModel="UserDateGrid_OpenViewModel" />
</StackPanel>
</Expander>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
Expand Down
2 changes: 2 additions & 0 deletions CrossoutLogViewer.GUI/Controls/PartyControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ private void Party_PropertyChanged(object sender, PropertyChangedEventArgs e)
}
else if (e.PropertyName == nameof(PartyGamesModel.UsersExpanded) && partyGames.UsersExpanded == true)
{
if (Parties is null)
return;
// Collapse all expanders except the one that opened
foreach (var party in Parties.Where(x => !Object.ReferenceEquals(partyGames, x)))
{
Expand Down

0 comments on commit 98969ed

Please sign in to comment.