Exemplo n.º 1
0
        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()));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
        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()));
        }