Random cleanup.

This commit is contained in:
Ottermandias 2022-05-11 12:57:31 +02:00
parent 08b7f184e6
commit ba0ef577c5
3 changed files with 7 additions and 10 deletions

View file

@ -24,7 +24,7 @@ public partial class ModCollection
public ModCollection Default { get; private set; } = Empty; public ModCollection Default { get; private set; } = Empty;
// A single collection that can not be deleted as a fallback for the current collection. // A single collection that can not be deleted as a fallback for the current collection.
public ModCollection DefaultName { get; private set; } = Empty; private ModCollection DefaultName { get; set; } = Empty;
// The list of character collections. // The list of character collections.
private readonly Dictionary< string, ModCollection > _characters = new(); private readonly Dictionary< string, ModCollection > _characters = new();
@ -36,11 +36,8 @@ public partial class ModCollection
public ModCollection Character( string name ) public ModCollection Character( string name )
=> _characters.TryGetValue( name, out var c ) ? c : Default; => _characters.TryGetValue( name, out var c ) ? c : Default;
public bool HasCharacterCollections
=> _characters.Count > 0;
// Set a active collection, can be used to set Default, Current or Character collections. // Set a active collection, can be used to set Default, Current or Character collections.
public void SetCollection( int newIdx, Type type, string? characterName = null ) private void SetCollection( int newIdx, Type type, string? characterName = null )
{ {
var oldCollectionIdx = type switch var oldCollectionIdx = type switch
{ {
@ -120,7 +117,7 @@ public partial class ModCollection
// Load default, current and character collections from config. // Load default, current and character collections from config.
// Then create caches. If a collection does not exist anymore, reset it to an appropriate default. // Then create caches. If a collection does not exist anymore, reset it to an appropriate default.
public void LoadCollections() private void LoadCollections()
{ {
var configChanged = !ReadActiveCollections( out var jObject ); var configChanged = !ReadActiveCollections( out var jObject );

View file

@ -97,7 +97,7 @@ public partial class ModCollection
// Since inheritances depend on other collections existing, // Since inheritances depend on other collections existing,
// we return them as a list to be applied after reading all collections. // we return them as a list to be applied after reading all collections.
public static ModCollection? LoadFromFile( FileInfo file, out IReadOnlyList< string > inheritance ) private static ModCollection? LoadFromFile( FileInfo file, out IReadOnlyList< string > inheritance )
{ {
inheritance = Array.Empty< string >(); inheritance = Array.Empty< string >();
if( !file.Exists ) if( !file.Exists )