public static Hashtable Setvariablesname(string xcname, ArrayList newvariables, string poslib) { var hashtable = GetOwnVariables(poslib); if (xcname.Replace(" ", "") == "") { return(hashtable); } else if (xcname == "params") { var variables = new Glist(); foreach (Variable v in newvariables) { variables.Add(v); } hashtable.Add("params", new Variable(variables)); return(hashtable); } string[] xc_names = xcname.Split(','); if (xc_names.Length != newvariables.Count) { throw new Exceptions.RunException(Exceptions.EXID.参数错误, "参数传递错误"); } for (int i = 0; i < xc_names.Length; i++) { hashtable.Add(xc_names[i], new Variable(((Variable)newvariables[i]).value) { isconst = ((Variable)newvariables[i]).isconst }); } return(hashtable); }
public static Hashtable SetvariablesnameByRef(string xcname, ArrayList tempvariables, string poslib) { var hashtable = GetOwnVariables(poslib); if (string.IsNullOrEmpty(xcname)) { return(hashtable); } else if (xcname == "params") { var variables = new Glist(); foreach (Variable v in tempvariables) { variables.Add(v); } hashtable.Add("params", new Variable(variables)); return(hashtable); } string[] xc_names = xcname.Split(','); for (int i = 0; i < xc_names.Length; i++) { hashtable.Add(xc_names[i], tempvariables[i]); } return(hashtable); }
public static async Task StartMain() { //4拉起Main IFunction mainfunc = null; foreach (var lib in libs) { foreach (var libmems in lib.Value.myThing) { if (libmems.Key == "Main") { var res = libmems.Value.value.IGetCSValue(); mainfunc = libmems.Value.value.IGetCSValue() as IFunction; } } } if (mainfunc != null) { //string str_name = ((sarray_Sys_Variables["Main"] as Variable).value as IFunction).Istr_xcname; string[] vs = Environment.GetCommandLineArgs(); var arrayList = new Glist(); foreach (string vv in vs) { arrayList.Add(new Variable(vv)); } await Function.NewAsyncFuncStarter(mainfunc, new Variable(arrayList)); } }
public override object Run(Hashtable xc) { string s1 = Variable.GetTrueVariable <object>(xc, "this").ToString(); string s2 = Variable.GetTrueVariable <object>(xc, "s2").ToString(); ArrayList array = new ArrayList(s1.Split(new string[] { s2 }, StringSplitOptions.RemoveEmptyEntries)); var list = new Glist(); foreach (object o in array) { list.Add(new Variable(o)); } return(new Variable(list)); }
public List_Lib() { myThing.Add("List", new Variable(new ListClassTemplate())); myThing.Add("Range", new Variable(new DFunction { str_xcname = "s,e", IInformation = @"[s(number)]:the start number of the list [e(number)]:the end number of the list (not contain). 'e' should bigger than 's' [return(list)]:list creat a new list contains numbers(sure it can contains more than number)", dRun = (xc) => { Glist variables = new Glist(); int s = Convert.ToInt32(xc.GetCSVariable <object>("s")), e = Convert.ToInt32(xc.GetCSVariable <object>("e")); for (int i = s; i < e; i++) { variables.Add(new Variable(i)); } return(new Variable(variables)); } })); }