Remove some warnings.

This commit is contained in:
Chris Bordeman 2024-10-15 00:07:57 -04:00
parent 4801f37e7c
commit 7af8d8aa70
2 changed files with 8 additions and 9 deletions

View File

@ -408,10 +408,6 @@ namespace AppScaffolding
public static void migrate_to_v11_5_0(Configuration config)
{
var writeToPath = "Serilog.WriteTo";
//QuickFilters.FilterState? inMemoryState;
// Read file, but convert old format to new (with Name field) as necessary.
if (!File.Exists(QuickFilters.JsonFile))
{
@ -448,7 +444,7 @@ namespace AppScaffolding
}
Debug.Assert(false, "Should not get here, QuickFilters.json deserialization issue");
}
catch (Exception ex)
catch
{
// Eat
}

View File

@ -30,7 +30,7 @@ namespace LibationFileManager
// load json into memory. if file doesn't exist, nothing to do. save() will create if needed
public static FilterState InMemoryState { get; set; }
public static FilterState InMemoryState { get; set; } = null!;
public static bool UseDefault
{
@ -55,16 +55,19 @@ namespace LibationFileManager
public record NamedFilter(string Filter, string Name)
{
public string Filter { get; set; } = Filter;
public string Name { get; set; } = Name;
public string? Name { get; set; } = Name;
}
public static IEnumerable<NamedFilter> Filters => InMemoryState.Filters.AsReadOnly();
public static void Add(NamedFilter namedFilter)
{
if (namedFilter == null)
throw new ArgumentNullException(nameof(namedFilter));
if (string.IsNullOrWhiteSpace(namedFilter.Filter))
return;
namedFilter.Filter = namedFilter.Filter?.Trim() ?? null;
namedFilter.Filter = namedFilter.Filter?.Trim() ?? string.Empty;
namedFilter.Name = namedFilter.Name?.Trim() ?? null;
lock (locker)