Skip to content

Commit

Permalink
LibraryExporter : added CompletionStatus column export (#417)
Browse files Browse the repository at this point in the history
* LibraryExporter : added CompletionStatus column export

* LibraryExporter : localization and checks for completion status export

---------

Co-authored-by: ykalapm <yvan.kalafatov@passman.fr>
Co-authored-by: Lusky <lusky@home>
  • Loading branch information
3 people authored Sep 3, 2023
1 parent ff52545 commit e4622e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions source/Generic/LibraryExporter/LibraryExporterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public class ExportSettings : ObservableObject
// Roms
private bool roms = false;
public bool Roms { get => roms; set => SetValue(ref roms, value); }
// CompletionStatus
private bool completionStatus = false;
public bool CompletionStatus { get => completionStatus; set => SetValue(ref completionStatus, value); }
// Regions
private bool regions = false;
public bool Regions { get => regions; set => SetValue(ref regions, value); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void ExportGamesToCsv(IEnumerable<Game> games)
logger.Error(e, $"Failed to export library to {selectedPath}");
playniteApi.Dialogs.ShowErrorMessage(ResourceProvider.GetString("LibraryExporterAdvanced_ExportFailedMessage").Format(selectedPath) + "\n\n" + e.Message);
}

}

private List<string> GetColumnsList()
Expand Down Expand Up @@ -99,6 +99,7 @@ private List<string> GetColumnsList()
if (Settings.Settings.ExportSettings.Modified) { columnNames.Add(GetLocalizationString("LOCDateModifiedLabel")); }
if (Settings.Settings.ExportSettings.RecentActivity) { columnNames.Add(GetLocalizationString("LOCRecentActivityLabel")); }
if (Settings.Settings.ExportSettings.Roms) { columnNames.Add("Roms"); }
if (Settings.Settings.ExportSettings.CompletionStatus) { columnNames.Add(GetLocalizationString("LOCCompletionStatus")); }
if (Settings.Settings.ExportSettings.Links) { columnNames.Add(GetLocalizationString("LOCLinksLabel")); }
if (Settings.Settings.ExportSettings.Manual) { columnNames.Add(GetLocalizationString("LOCGameManualTitle")); }
if (Settings.Settings.ExportSettings.Notes) { columnNames.Add(GetLocalizationString("LOCNotesLabel")); }
Expand Down Expand Up @@ -244,6 +245,12 @@ private string[] GenerateGameColumns(int columnCount, Game game)
currentInsertColumn++;
}

if (Settings.Settings.ExportSettings.CompletionStatus)
{
properties[currentInsertColumn] = (game.CompletionStatus != null && !game.CompletionStatus.Name.IsNullOrEmpty() ? game.CompletionStatus.Name : string.Empty);
currentInsertColumn++;
}

if (Settings.Settings.ExportSettings.Links)
{
properties[currentInsertColumn] = game.Links?.HasItems() == true ? string.Join(Settings.Settings.ListsSeparator, game.Links.Select(x => $"{x.Name}:{x.Url}")) : string.Empty;
Expand Down Expand Up @@ -339,7 +346,7 @@ private string[] GenerateGameColumns(int columnCount, Game game)
properties[currentInsertColumn] = game.Id.ToString();
currentInsertColumn++;
}

return properties;
}

Expand Down
2 changes: 2 additions & 0 deletions source/Generic/LibraryExporter/Views/LibraryExporterView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
Content="{DynamicResource LOCRecentActivityLabel}" Margin="0,0,0,5" />
<CheckBox IsChecked="{Binding Settings.Settings.ExportSettings.Roms}"
Content="Roms" Margin="0,0,0,5" />
<CheckBox IsChecked="{Binding Settings.Settings.ExportSettings.CompletionStatus}"
Content="{DynamicResource LOCCompletionStatus}" Margin="0,0,0,5" />
<CheckBox IsChecked="{Binding Settings.Settings.ExportSettings.Links}"
Content="{DynamicResource LOCLinksLabel}" Margin="0,0,0,5" />
<CheckBox IsChecked="{Binding Settings.Settings.ExportSettings.Manual}"
Expand Down

0 comments on commit e4622e2

Please sign in to comment.