/* * @description: Runs load_xls.py and returns the result of the python program when received a HttpPost request * @param: Argv input takes in a Argv object recording the file path to the excel file and selected sheet in the excel file * @return: a Response object that shows if the python program is completed successfully and the message from python */ public Response Post([FromBody] Argv input) { string argument = input.fullPath + " " + '"' + input.currSheet + '"'; Response responseMsg = Run_Cmd("../../PythonScript/load_xls.py", argument); return(responseMsg); }
internal static void Init() { /*ConsoleWindow = new Window(); * ConsoleWindow.ResizableHorizontal = false; * ConsoleWindow.Movable = false; * ConsoleWindow.Color = new Color(255, 255, 255, 200); * ConsoleWindow.MinimumSize = new Vector2(0, 100); * * Input = ConsoleWindow.AddChild(new InputBox(DefaultFonts.ConsoleFont)); * Input.OnTextEntered += (In, Txt) => { * In.String = ""; * SendInput(Txt); * }; * * Output = ConsoleWindow.AddChild(new Label(DefaultFonts.ConsoleFont)); * Output.Multiline = true; * ConsoleWindow.OnResize += (Wnd, Sz) => { * float SpacingOffset = 1.5f; * Output.Position = new Vector2(0, DefaultFonts.ConsoleFont.LineSpacing * SpacingOffset); * Output.DrawRegion = new AABB(new Vector2(Sz.X, Sz.Y - DefaultFonts.ConsoleFont.LineSpacing * SpacingOffset)); * * Input.DrawRegion = new AABB(new Vector2(Sz.X, DefaultFonts.ConsoleFont.LineSpacing)); * }; * * if (TempBuffer.Length > 0) { * Output.AppendString(TempBuffer.ToString()); * TempBuffer.Clear(); * }//*/ ConVar <float> ConHeight = ConVar.Register("con_height", 0.4f, ConVarType.Archive); //const float Padding = 10; //ConsoleWindow.Position = new Vector2(Padding, (int)(Engine.WindowHeight * ConHeight) + Padding); //ConsoleWindow.Size = new Vector2(Engine.WindowWidth - Padding * 2, (int)(Engine.WindowHeight * (1.0f - ConHeight)) - Padding * 2); ConCmd.Register("clear", (Argv) => { Clear(); }); ConCmd.Register("rainbow", (Argv) => { string Rnd = Utils.RandomString(40, 60); Color Clr = Color; foreach (var Char in Rnd) { Color = Utils.RandomColor(); Write(Char.ToString()); } Write("\n"); Color = Clr; }); ConCmd.Register("echo", (Argv) => { for (int i = 1; i < Argv.Length; i++) { string Arg = Argv[i]; /*if (Arg.StartsWith("$")) { * if (ConVar.TryFind(Arg.Substring(1), out ConVar Var)) * Write(Var.ObjectValue); * else * Write("null"); * } else*/ Write(Arg); } Write("\n"); }); ConCmd.Register("alias", (Argv) => { if (Argv.Length == 1) { foreach (var Alias in GetAliases()) { WriteLine("{0} -> {1}", Alias.Item1, Alias.Item2); } } else if (Argv.Length == 2) { foreach (var Alias in GetAliases()) { if (Alias.Item1.StartsWith(Argv[1])) { WriteLine("{0} -> {1}", Alias.Item1, Alias.Item2); } } } else if (Argv.Length == 3) { WriteLine("{0} -> {1}", Argv[1], Argv[2]); RegisterAlias(Argv[1], Argv[2]); } else { Error("alias\nalias <command_alias>\nalias <command_alias> <command>"); } }); ConCmd.Register("var", (Argv) => { if (Argv.Length != 2) { Error("var <variable_name>"); return; } ConVar.Register(Argv[1], 0); }); ConCmd.Register("inc", (Argv) => { if (Argv.Length != 2) { Error("inc <variable_name>"); return; } if (ConVar.TryFind(Argv[1], out ConVar Var)) { ((ConVar <int>)Var).Value++; } }); ConCmd.Register("dec", (Argv) => { if (Argv.Length != 2) { Error("dec <variable_name>"); return; } if (ConVar.TryFind(Argv[1], out ConVar Var)) { ((ConVar <int>)Var).Value--; } }); ConCmd.Register("toggle", (Argv) => { if (Argv.Length != 2) { Error("toggle <variable_name>"); return; } if (ConVar.TryFind(Argv[1], out ConVar Var)) { ConVar <int> IntVar = (ConVar <int>)Var; if (IntVar.Value == 0) { IntVar.Value = 1; } else { IntVar.Value = 0; } } }); ConCmd.Register("cvarlist", (Argv) => { foreach (var CVar in ConVar.GetAll()) { WriteLine(CVar); } }); ConCmd.Register("cmdlist", (Argv) => { foreach (var Cmd in ConCmd.GetAll()) { WriteLine(Cmd); } }); ConCmd.Register("eval", (Argv) => { SendInputQuiet(string.Join("", Argv.Skip(1))); }); ConCmd.Register("mousepos", (Argv) => { GConsole.WriteLine((Engine.Window.WindowSize.GetHeight() - Engine.Window.MousePos).Abs()); }); ConCmd.Register("crash", (Argv) => { throw new InvalidOperationException("Crashing the program!"); }); }