diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-27 09:47:31 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-27 09:47:31 -0400 |
commit | 3e5c109df1f90904c2dcb177e35b35f003e90fd9 (patch) | |
tree | 7c06948b4dd20bacda354e67b81070804eb65ac1 /src/SMAPI.Web/Controllers/LogParserController.cs | |
parent | cf3728562771b20b66c3f9307a72ae3b19b10bdf (diff) | |
download | SMAPI-3e5c109df1f90904c2dcb177e35b35f003e90fd9.tar.gz SMAPI-3e5c109df1f90904c2dcb177e35b35f003e90fd9.tar.bz2 SMAPI-3e5c109df1f90904c2dcb177e35b35f003e90fd9.zip |
add log parser option to view raw log
Diffstat (limited to 'src/SMAPI.Web/Controllers/LogParserController.cs')
-rw-r--r-- | src/SMAPI.Web/Controllers/LogParserController.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs index 2bff1392..354bdb06 100644 --- a/src/SMAPI.Web/Controllers/LogParserController.cs +++ b/src/SMAPI.Web/Controllers/LogParserController.cs @@ -52,21 +52,22 @@ namespace StardewModdingAPI.Web.Controllers ***/ /// <summary>Render the log parser UI.</summary> /// <param name="id">The paste ID.</param> + /// <param name="raw">Whether to display the raw unparsed log.</param> [HttpGet] [Route("log")] [Route("log/{id}")] - public async Task<ViewResult> Index(string id = null) + public async Task<ViewResult> Index(string id = null, bool raw = false) { // fresh page if (string.IsNullOrWhiteSpace(id)) - return this.View("Index", new LogParserModel(this.Config.LogParserUrl, id, null)); + return this.View("Index", new LogParserModel(this.Config.LogParserUrl, id)); // log page PasteInfo paste = await this.GetAsync(id); ParsedLog log = paste.Success ? new LogParser().Parse(paste.Content) : new ParsedLog { IsValid = false, Error = "Pastebin error: " + paste.Error }; - return this.View("Index", new LogParserModel(this.Config.LogParserUrl, id, log)); + return this.View("Index", new LogParserModel(this.Config.LogParserUrl, id, log, raw)); } /*** @@ -80,7 +81,7 @@ namespace StardewModdingAPI.Web.Controllers // get raw log text string input = this.Request.Form["input"].FirstOrDefault(); if (string.IsNullOrWhiteSpace(input)) - return this.View("Index", new LogParserModel(this.Config.LogParserUrl, null, null) { UploadError = "The log file seems to be empty." }); + return this.View("Index", new LogParserModel(this.Config.LogParserUrl, null) { UploadError = "The log file seems to be empty." }); // upload log input = this.CompressString(input); @@ -88,7 +89,7 @@ namespace StardewModdingAPI.Web.Controllers // handle errors if (!result.Success) - return this.View("Index", new LogParserModel(this.Config.LogParserUrl, result.ID, null) { UploadError = $"Pastebin error: {result.Error ?? "unknown error"}" }); + return this.View("Index", new LogParserModel(this.Config.LogParserUrl, result.ID) { UploadError = $"Pastebin error: {result.Error ?? "unknown error"}" }); // redirect to view UriBuilder uri = new UriBuilder(new Uri(this.Config.LogParserUrl)); |