public static void Run(string name, string code, Action <object> Return, params Arg[] args) { string ScriptName = name; bool issuccess = Worker.CreateScript(ScriptName, code, args); try { if (issuccess) { var p = Process.Start(AppDomain.CurrentDomain.BaseDirectory + "Scripts\\" + ScriptName + ".exe"); new Task(() => { while (!p.HasExited) { ; } Return(File.Exists("Scripts/" + ScriptName) ? Rc.LoadFromXML <object>("Scripts/" + ScriptName) : null); p.Dispose(); }).Start(); } } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error: " + e.Message); } }
public static Column[] Load(Main main) { int load = 0; var l = new List <Column>(); while (File.Exists(Application.StartupPath + "/Settings/Columns_" + load + ".dat")) { var data = (ColumnData)Rc.LoadFromXML <ColumnData>(Application.StartupPath + "/Settings/Columns_" + load + ".dat"); var add = data.ToColumn(main); if (add != null) { l.Add(add); } load++; } while (File.Exists(Application.StartupPath + "/Settings/" + load + ".bmp")) { File.Delete(Application.StartupPath + "/Settings/" + load + ".bmp"); load++; } return(l.ToArray()); }