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) 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. // Read file, but convert old format to new (with Name field) as necessary.
if (!File.Exists(QuickFilters.JsonFile)) if (!File.Exists(QuickFilters.JsonFile))
{ {
@ -448,7 +444,7 @@ namespace AppScaffolding
} }
Debug.Assert(false, "Should not get here, QuickFilters.json deserialization issue"); Debug.Assert(false, "Should not get here, QuickFilters.json deserialization issue");
} }
catch (Exception ex) catch
{ {
// Eat // Eat
} }

View File

@ -29,8 +29,8 @@ namespace LibationFileManager
public static string JsonFile => Path.Combine(Configuration.Instance.LibationFiles, "QuickFilters.json"); public static string JsonFile => Path.Combine(Configuration.Instance.LibationFiles, "QuickFilters.json");
// load json into memory. if file doesn't exist, nothing to do. save() will create if needed // 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 public static bool UseDefault
{ {
@ -55,16 +55,19 @@ namespace LibationFileManager
public record NamedFilter(string Filter, string Name) public record NamedFilter(string Filter, string Name)
{ {
public string Filter { get; set; } = Filter; 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 IEnumerable<NamedFilter> Filters => InMemoryState.Filters.AsReadOnly();
public static void Add(NamedFilter namedFilter) public static void Add(NamedFilter namedFilter)
{ {
if (namedFilter == null)
throw new ArgumentNullException(nameof(namedFilter));
if (string.IsNullOrWhiteSpace(namedFilter.Filter)) if (string.IsNullOrWhiteSpace(namedFilter.Filter))
return; return;
namedFilter.Filter = namedFilter.Filter?.Trim() ?? null; namedFilter.Filter = namedFilter.Filter?.Trim() ?? string.Empty;
namedFilter.Name = namedFilter.Name?.Trim() ?? null; namedFilter.Name = namedFilter.Name?.Trim() ?? null;
lock (locker) lock (locker)