public override object EXECUTE(params object[] po) { string cmd = po[0].ToString().Trim(); cmd = MCLTools.ParenthesisPU.Parse(cmd); string definition = MiMFa_StringService.GetFirstWordBetween(cmd, "(", ")", false); if (definition != null) { cmd = MiMFa_StringService.FirstFindAndReplace(cmd, "(" + definition + ")", ""); } else { definition = ""; } if (string.IsNullOrEmpty(definition.Trim())) { throw new System.Exception("Not found any definitions"); } string[] elements = definition.Split(','); elements = MiMFa_CollectionService.ExecuteInAllItems(elements, (s) => s.Trim()); if (elements.Length < 2) { throw new System.Exception("Definition is not right"); } string def = elements[0]; object eno = MCL.Execute(elements[1]); return(Normalization(each(def, eno, cmd).ToArray())); }
public virtual List <string> all(params object[] po) { List <string> ls = MiMFa_Path.GetAllFiles(MCL.Address.BaseDirectory, true); if (!_address) { ls = MiMFa_CollectionService.ExecuteInAllItems(ls, (s) => System.IO.Path.GetFileNameWithoutExtension(s)); } return(ls); }
public static MiMFa_KeyWords <int, string> GetKeywords(string text) { MiMFa_KeyWords <int, string> kws = new MiMFa_KeyWords <int, string>(); List <string> ls = MiMFa_CollectionService.Distinct( MiMFa_CollectionService.ExecuteInAllItems( MiMFa_CollectionService.Concat( GetKeywordFromStruct(text), GetKeywordFromAnd(text), GetKeywordFromComma(text), GetKeywordFromNumber(text), GetKeywordFromEqual(text), GetKeywordFromParenthesis(text), GetKeywordFromBrackets(text), GetKeywordFromBraces(text), GetKeywordFromQuotation(text), GetKeywordFromDoubleQuotation(text) ), (t) => t .Replace(".", " ") .Replace(",", " ") .Replace("،", " ") .Replace("؛", " ") .Replace(";", " ") .Replace("?", " ") .Replace("؟", " ") .Replace("!", " ") .Replace("'", " ") .Replace("`", " ") .Replace("\"", " ") .Replace("(", " ") .Replace(")", " ") .Replace("[", " ") .Replace("]", " ") .Replace("{", " ") .Replace("}", " ") .Replace("&", " ") .Trim())); foreach (var item in ls) { kws.Add(MiMFa_StringService.NumberOfWordsInText(text, item), item); } return(kws); }
public override object EXECUTE(params object[] po) { if (po != null && po.Length > 0) { string name = po[0].ToString(); name = MCLTools.ParenthesisPU.Parse(name); string[] stra = MiMFa_StringService.FirstFindAndSplit(name, MCLTools.StartSignParenthesis); Function fu = new Function(); fu.Name = stra[0]; fu.Access = MCL.EnvironmentAccess; stra = MiMFa_StringService.FirstFindAndSplit(stra[1], MCLTools.EndSignParenthesis); fu.Inputs = MiMFa_CollectionService.ExecuteInAllItems(stra[0].Split(MCLTools.SplitSign), (os) => MCL.CrudeText(os).Trim()); if (fu.Inputs.Length == 1 && string.IsNullOrEmpty(fu.Inputs[0])) { fu.Inputs = new string[] { } } ; fu.Commands = MCL.CrudeText(stra[1]).Trim(); MiMFa_CommandLanguage.FunctionsList.Add(fu); return(fu); } return(Null); }
public override object EXECUTE(params object[] po) { string cmd = po[0].ToString().Trim(); cmd = MCLTools.ParenthesisPU.Parse(cmd); string definition = MiMFa_StringService.GetFirstWordBetween(cmd, "(", ")", false); if (definition != null) { cmd = MiMFa_StringService.FirstFindAndReplace(cmd, "(" + definition + ")", ""); } else { definition = ""; } if (string.IsNullOrEmpty(definition.Trim())) { definition = ""; } string[] elements = definition.Split(','); elements = MiMFa_CollectionService.ExecuteInAllItems(elements, (s) => s.Trim()); string def = (elements.Length == 3) ? elements[0] : ""; string condition = (elements.Length == 3 && !string.IsNullOrEmpty(elements[1])) ? elements[1] : "true"; string after = (elements.Length == 3) ? elements[2] : ""; MCL.PushAccess(); MCL.Parse(def); MiMFa_List <object> result = new MiMFa_List <object>(); for (; breakrun-- == 0 && Convert.ToBoolean(MCL.Parser(condition)); MCL.Parse(after)) { result.Add(echo(cmd)); } MCL.PopRemoveAccess(); return(Normalization(result.ToArray())); }