From a9d7195f1e631a88386cf58dd1e33e36cba28a69 Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Thu, 9 Mar 2017 14:43:03 +0000 Subject: [PATCH] make script runner less drunk --- ShiftOS.Server/Core.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs index 4ec421d..a602240 100644 --- a/ShiftOS.Server/Core.cs +++ b/ShiftOS.Server/Core.cs @@ -96,10 +96,11 @@ namespace ShiftOS.Server { Name = "run", GUID = "Server", - Contents = $@"{{ - script:""{File.ReadAllText($"scripts/{user}/{script}.lua").Replace("\"", "\\\"")}"", - args:""{sArgs}"" - }}" + Contents = JsonConvert.SerializeObject(new + { + script = File.ReadAllText($"scripts/{user}/{script}.lua"), + args = sArgs + }) })); } else @@ -115,7 +116,7 @@ namespace ShiftOS.Server { Name = "Error", GUID = "Server", - Contents = JsonConvert.SerializeObject(new MudException("Command parse error")) + Contents = JsonConvert.SerializeObject(new MudException(" Script not found or script error detected.")) })); } catch @@ -182,8 +183,8 @@ namespace ShiftOS.Server GUID = "server", Contents = JsonConvert.SerializeObject(saveFile) })); + return; } - return; } } foreach (var sve in Directory.GetFiles("saves")) @@ -199,8 +200,8 @@ namespace ShiftOS.Server GUID = "server", Contents = JsonConvert.SerializeObject(saveFile) })); + return; } - return; } }