From 762bd11cdf023e5340197b1a1438b5212f360a7d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 19 Feb 2017 13:47:51 -0500 Subject: Kill experience shifter. Now all we need is a Lua->SFT compiler (not that hard) and then we can generate 0:/system/kernel.sft and have whatever's in there run at startup. --- ShiftOS_TheReturn/Scripting.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 7215fbf..eca94fc 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -43,6 +43,24 @@ namespace ShiftOS.Engine.Scripting public dynamic Lua = new DynamicLua.DynamicLua(); public bool Running = true; + public static void RunSft(string sft) + { + if (Utils.FileExists(sft)) + { + try + { + string b64 = Utils.ReadAllText(sft); + byte[] bytes = Convert.FromBase64String(b64); + string lua = Encoding.UTF8.GetString(bytes); + new LuaInterpreter().Execute(lua); + } + catch + { + Infobox.Show("Invalid binary.", "This file is not a valid ShiftOS binary executable."); + } + } + } + public LuaInterpreter() { Lua(@"function totable(clrlist) -- cgit v1.2.3