Skip to content

Commit

Permalink
feeder: fixed 'is new' indicator for non-table files when a simulator…
Browse files Browse the repository at this point in the history
… filter is specified
  • Loading branch information
stojy committed Aug 21, 2023
1 parent 25f696e commit 7310ade
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ClrVpin/Feeder/FeederResults.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
materialDesign:HintAssist.Hint="Application"
Style="{StaticResource ComboBoxStyle}"
Width="90" Margin="10,0,0,0"
ToolTip="Filter the tables based on the emulator application. Ignored for unmatched tables.">
ToolTip="Filter the tables based on the simulator application. Ignored for unmatched tables.">
<b:Interaction.Triggers>
<controls:RoutedEventTrigger RoutedEvent="ComboBox.SelectionChanged">
<b:InvokeCommandAction Command="{Binding ApplicationFormatChangedCommand}" />
Expand Down
7 changes: 5 additions & 2 deletions ClrVpin/Feeder/FeederResultsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ private void UpdateOnlineGameFileDetails()
{
var (fileCollectionType, fileCollection) = kv;
var fileCollectionTypeEnum = OnlineFileType.GetEnum(fileCollectionType);
fileCollection.ForEach(file =>
{
// flag file - if the update time range is satisfied
Expand Down Expand Up @@ -402,8 +404,9 @@ private void UpdateOnlineGameFileDetails()
if (file.IsNew && file is ImageFile { IsFullDmd: true } && !Settings.SelectedMiscFeatureOptions.Contains(MiscFeatureOptionEnum.FullDmd))
file.IsNew = false;
// - emulator application, aka file format, e.g. VPX, FP, etc
if (file.IsNew && Settings.SelectedApplicationFormatFilter != null && (file as TableFile)?.TableFormat != Settings.SelectedApplicationFormatFilter)
// - simulator application, aka file format, e.g. VPX, FP, etc
if (file.IsNew && Settings.SelectedApplicationFormatFilter != null && fileCollectionTypeEnum == OnlineFileTypeEnum.Tables &&
(file as TableFile)?.TableFormat != Settings.SelectedApplicationFormatFilter)
file.IsNew = false;
// flag each url within the file - required to allow for simpler view binding
Expand Down
18 changes: 18 additions & 0 deletions ClrVpin/Models/Feeder/OnlineFileType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Utils.Extensions;

namespace ClrVpin.Models.Feeder;

public static class OnlineFileType
{
public static OnlineFileTypeEnum GetEnum(string onlineFileType)
{
_onlineFileTypeDictionary ??= Enum.GetValues<OnlineFileTypeEnum>().ToDictionary(value => value.GetDescription(), value => value);

return _onlineFileTypeDictionary[onlineFileType];
}

private static Dictionary<string, OnlineFileTypeEnum> _onlineFileTypeDictionary;
}

0 comments on commit 7310ade

Please sign in to comment.