From 30dbf1ecb94ecbc84cb71eba9936ee050d040b64 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 18 Feb 2017 11:19:54 -0500 Subject: Fix bug with client-side for update_your_cp --- ShiftOS_TheReturn/Scripting.cs | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index c934fc6..9feb203 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -250,6 +250,83 @@ end"); } } } + + [Exposed("infobox")] + public class InfoboxFunctions + { + public void show(string title, string message) + { + Infobox.Show(title, message); + } + + public void question(string title, string message, Action callback) + { + Infobox.PromptYesNo(title, message, callback); + } + + public void input(string title, string message, Action callback) + { + Infobox.PromptText(title, message, callback); + } + } + + [Exposed("fileskimmer")] + public class FileSkimmerFunctions + { + public void openFile(string extensions, Action callback) + { + FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Open, callback); + } + + public void saveFile(string extensions, Action callback) + { + FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Save, callback); + } + } + + [Exposed("fs")] + public class ShiftFSFunctions + { + public string readAllText(string path) + { + return Utils.ReadAllText(path); + } + + public byte[] readAllBytes(string path) + { + return Utils.ReadAllBytes(path); + } + + public void writeAllText(string path, string contents) + { + Utils.WriteAllText(path, contents); + } + + public void writeAllBytes(string path, byte[] contents) + { + Utils.WriteAllBytes(path, contents); + } + + public bool fileExists(string path) + { + return Utils.FileExists(path); + } + + public bool directoryExists(string path) + { + return Utils.DirectoryExists(path); + } + + public void delete(string path) + { + Utils.Delete(path); + } + + public void createDirectory(string path) + { + Utils.CreateDirectory(path); + } + } public class ExposedAttribute : Attribute -- cgit v1.2.3