From 3e226a6a9e2902e91f5b23c82e76b2615836d05a Mon Sep 17 00:00:00 2001 From: Jonathan McCaffrey Date: Mon, 11 Apr 2022 18:03:16 -0400 Subject: [PATCH] Warning cleanup --- .../Parts/EntityClickViewComponent.razor | 2 +- IGP/Pages/ChangeLogPage.razor | 6 +---- Model/Entity/EntityModel.cs | 27 ++++++++++--------- Services/Development/NoteService.cs | 6 ++--- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor b/IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor index 5752899..d49386a 100644 --- a/IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor +++ b/IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor @@ -50,7 +50,7 @@ var faction = FilterService.GetFactionType(); var immortal = FilterService.GetImmortalType(); - var foundEntity = EntityModel.GetFrom(hotkey, hotkeyGroup, isHoldSpace, faction, immortal); + var foundEntity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); if (foundEntity != null) { diff --git a/IGP/Pages/ChangeLogPage.razor b/IGP/Pages/ChangeLogPage.razor index f1fa089..906618e 100644 --- a/IGP/Pages/ChangeLogPage.razor +++ b/IGP/Pages/ChangeLogPage.razor @@ -131,11 +131,7 @@ else protected override async Task OnInitializedAsync() { -#if NO_SQL - GitService.Load(); -#else - GitService.Load(Database); -#endif + await GitService.Load(); } } \ No newline at end of file diff --git a/Model/Entity/EntityModel.cs b/Model/Entity/EntityModel.cs index 72dcf05..ea31179 100644 --- a/Model/Entity/EntityModel.cs +++ b/Model/Entity/EntityModel.cs @@ -1,4 +1,5 @@ #nullable enable +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -19,7 +20,7 @@ public class EntityModel private static List _entityModelsOnlyHotkey = null!; - private static Dictionary> _entityModelsByHotkey= null!; + private static Dictionary>? _entityModelsByHotkey= null!; public EntityModel(string data, string entity, bool isSpeculative = false) @@ -150,9 +151,9 @@ public class EntityModel select replace).ToList().Count == 0) select entity; - if (foundList != null && !foundList.Any()) return null; + if (!foundList.Any()) return null; - var found = foundList.First(); + var found = (foundList ?? Array.Empty()).First(); return found; } @@ -160,37 +161,37 @@ public class EntityModel public EntityInfoModel Info() { - return (EntityInfoModel)EntityParts.Find(x => x.GetType() == typeof(EntityInfoModel)); + return ((EntityInfoModel)EntityParts.Find(x => x.GetType() == typeof(EntityInfoModel))!)!; } public EntitySupplyModel Supply() { - return (EntitySupplyModel)EntityParts.Find(x => x.GetType() == typeof(EntitySupplyModel)); + return ((EntitySupplyModel)EntityParts.Find(x => x.GetType() == typeof(EntitySupplyModel))!)!; } public EntityTierModel Tier() { - return (EntityTierModel)EntityParts.Find(x => x.GetType() == typeof(EntityTierModel)); + return ((EntityTierModel)EntityParts.Find(x => x.GetType() == typeof(EntityTierModel))!)!; } public EntityProductionModel Production() { - return (EntityProductionModel)EntityParts.Find(x => x.GetType() == typeof(EntityProductionModel)); + return ((EntityProductionModel)EntityParts.Find(x => x.GetType() == typeof(EntityProductionModel))!)!; } public EntityMovementModel Movement() { - return (EntityMovementModel)EntityParts.Find(x => x.GetType() == typeof(EntityMovementModel)); + return ((EntityMovementModel)EntityParts.Find(x => x.GetType() == typeof(EntityMovementModel))!)!; } public EntityVitalityModel Vitality() { - return (EntityVitalityModel)EntityParts.Find(x => x.GetType() == typeof(EntityVitalityModel)); + return ((EntityVitalityModel)EntityParts.Find(x => x.GetType() == typeof(EntityVitalityModel))!)!; } @@ -217,25 +218,25 @@ public class EntityModel public EntityVanguardAddedModel VanguardAdded() { - return (EntityVanguardAddedModel)EntityParts.Find(x => x.GetType() == typeof(EntityVanguardAddedModel)); + return ((EntityVanguardAddedModel)EntityParts.Find(x => x.GetType() == typeof(EntityVanguardAddedModel))!)!; } public EntityHotkeyModel Hotkey() { - return (EntityHotkeyModel)EntityParts.Find(x => x.GetType() == typeof(EntityHotkeyModel)); + return ((EntityHotkeyModel)EntityParts.Find(x => x.GetType() == typeof(EntityHotkeyModel))!); } public EntityFactionModel Faction() { - return (EntityFactionModel)EntityParts.Find(x => x.GetType() == typeof(EntityFactionModel)); + return ((EntityFactionModel)EntityParts.Find(x => x.GetType() == typeof(EntityFactionModel))!); } public EntityHarvestModel Harvest() { - return (EntityHarvestModel)EntityParts.Find(x => x.GetType() == typeof(EntityHarvestModel)); + return ((EntityHarvestModel)EntityParts.Find(x => x.GetType() == typeof(EntityHarvestModel))!); } diff --git a/Services/Development/NoteService.cs b/Services/Development/NoteService.cs index 380b24e..6b2aa7c 100644 --- a/Services/Development/NoteService.cs +++ b/Services/Development/NoteService.cs @@ -27,9 +27,9 @@ public class NoteService : INoteService { } public List NoteContentModels { get; set; } = default!; - public List NoteConnectionModels { get; set; } - public List NoteSectionModels { get; set; } - + public List NoteConnectionModels { get; set; } = null!; + public List NoteSectionModels { get; set; } = null!; + public List NoteContentModelsByPageOrder { get; set; } = new();