From 43f11cfe51fdbb6c8fdee657ddf82d740ff6d738 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 23 Nov 2018 17:33:30 -0500 Subject: strip newlines in manifest display fields --- .../Framework/ModScanning/ModScanner.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs') diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs index 106c294f..61d0d6f2 100644 --- a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs +++ b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs @@ -90,6 +90,14 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning } } + // normalise display fields + if (manifest != null) + { + manifest.Name = this.StripNewlines(manifest.Name); + manifest.Description = this.StripNewlines(manifest.Description); + manifest.Author = this.StripNewlines(manifest.Author); + } + return new ModFolder(root, manifestFile.Directory, manifest, manifestError); } @@ -164,5 +172,12 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning { return !this.IgnoreFilesystemEntries.Contains(entry.Name); } + + /// Strip newlines from a string. + /// The input to strip. + private string StripNewlines(string input) + { + return input?.Replace("\r", "").Replace("\n", ""); + } } } -- cgit