2
0

TrangaSettings nullable library and notificationManagers will initialize a new Hashset

This commit is contained in:
glax 2023-06-15 18:50:50 +02:00
parent 84842aed3c
commit c6c8f5cdf6

View File

@ -16,15 +16,15 @@ public class TrangaSettings
public HashSet<LibraryManager> libraryManagers { get; } public HashSet<LibraryManager> libraryManagers { get; }
public HashSet<NotificationManager> notificationManagers { get; } public HashSet<NotificationManager> notificationManagers { get; }
public TrangaSettings(string downloadLocation, string workingDirectory, HashSet<LibraryManager> libraryManagers, public TrangaSettings(string downloadLocation, string workingDirectory, HashSet<LibraryManager>? libraryManagers,
HashSet<NotificationManager> notificationManagers) HashSet<NotificationManager>? notificationManagers)
{ {
if (downloadLocation.Length < 1 || workingDirectory.Length < 1) if (downloadLocation.Length < 1 || workingDirectory.Length < 1)
throw new ArgumentException("Download-location and working-directory paths can not be empty!"); throw new ArgumentException("Download-location and working-directory paths can not be empty!");
this.workingDirectory = workingDirectory; this.workingDirectory = workingDirectory;
this.downloadLocation = downloadLocation; this.downloadLocation = downloadLocation;
this.libraryManagers = libraryManagers; this.libraryManagers = libraryManagers??new();
this.notificationManagers = notificationManagers; this.notificationManagers = notificationManagers??new();
} }
public static TrangaSettings LoadSettings(string importFilePath, Logger? logger) public static TrangaSettings LoadSettings(string importFilePath, Logger? logger)