summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Controllers')
-rw-r--r--src/SMAPI.Web/Controllers/IndexController.cs4
-rw-r--r--src/SMAPI.Web/Controllers/JsonValidatorController.cs15
-rw-r--r--src/SMAPI.Web/Controllers/LogParserController.cs2
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs4
-rw-r--r--src/SMAPI.Web/Controllers/ModsController.cs2
5 files changed, 17 insertions, 10 deletions
diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs
index 5097997c..f7834b9c 100644
--- a/src/SMAPI.Web/Controllers/IndexController.cs
+++ b/src/SMAPI.Web/Controllers/IndexController.cs
@@ -1,3 +1,5 @@
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -94,7 +96,7 @@ namespace StardewModdingAPI.Web.Controllers
// strip 'noinclude' blocks from release description
if (release != null)
{
- HtmlDocument doc = new HtmlDocument();
+ HtmlDocument doc = new();
doc.LoadHtml(release.Body);
foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//*[@class='noinclude']")?.ToArray() ?? Array.Empty<HtmlNode>())
node.Remove();
diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
index e06c1236..5791d834 100644
--- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs
+++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
@@ -1,3 +1,5 @@
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -161,7 +163,7 @@ namespace StardewModdingAPI.Web.Controllers
return this.View("Index", this.GetModel(result.ID, schemaName, isEditView: true).SetContent(input, null).SetUploadError(result.UploadError));
// redirect to view
- return this.Redirect(this.Url.PlainAction("Index", "JsonValidator", new { schemaName = schemaName, id = result.ID }));
+ return this.Redirect(this.Url.PlainAction("Index", "JsonValidator", new { schemaName, id = result.ID }));
}
@@ -197,7 +199,7 @@ namespace StardewModdingAPI.Web.Controllers
return null;
// get matching file
- DirectoryInfo schemaDir = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "schemas"));
+ DirectoryInfo schemaDir = new(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "schemas"));
foreach (FileInfo file in schemaDir.EnumerateFiles("*.json"))
{
if (file.Name.Equals($"{id}.json"))
@@ -317,13 +319,10 @@ namespace StardewModdingAPI.Web.Controllers
/// <param name="key">The case-insensitive field key.</param>
private T GetExtensionField<T>(JSchema schema, string key)
{
- if (schema.ExtensionData != null)
+ foreach ((string curKey, JToken value) in schema.ExtensionData)
{
- foreach ((string curKey, JToken value) in schema.ExtensionData)
- {
- if (curKey.Equals(key, StringComparison.OrdinalIgnoreCase))
- return value.ToObject<T>();
- }
+ if (curKey.Equals(key, StringComparison.OrdinalIgnoreCase))
+ return value.ToObject<T>();
}
return default;
diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs
index db53d942..524cfbcc 100644
--- a/src/SMAPI.Web/Controllers/LogParserController.cs
+++ b/src/SMAPI.Web/Controllers/LogParserController.cs
@@ -1,3 +1,5 @@
+#nullable disable
+
using System;
using System.Linq;
using System.Text;
diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs
index dfe2504b..3dc1e366 100644
--- a/src/SMAPI.Web/Controllers/ModsApiController.cs
+++ b/src/SMAPI.Web/Controllers/ModsApiController.cs
@@ -1,3 +1,5 @@
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -135,7 +137,7 @@ namespace StardewModdingAPI.Web.Controllers
bool isSmapiBeta = apiVersion.IsPrerelease() && apiVersion.PrereleaseTag.StartsWith("beta");
// get latest versions
- ModEntryModel result = new ModEntryModel { ID = search.ID };
+ ModEntryModel result = new() { ID = search.ID };
IList<string> errors = new List<string>();
ModEntryVersionModel main = null;
ModEntryVersionModel optional = null;
diff --git a/src/SMAPI.Web/Controllers/ModsController.cs b/src/SMAPI.Web/Controllers/ModsController.cs
index c62ed605..5292e1ce 100644
--- a/src/SMAPI.Web/Controllers/ModsController.cs
+++ b/src/SMAPI.Web/Controllers/ModsController.cs
@@ -1,3 +1,5 @@
+#nullable disable
+
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc;