Пример #1
0
        //[model("")]
        //[info("")]
        //public static readonly string SomeFiloler = "Filler";

        public override void Process(opis message)
        {
            if (modelSpec.isHere(Fill_itemsArray))
            {
                message.CopyArr(o[context.items]);
            }

            if (modelSpec.isHere(Fill_ContextsArray))
            {
                message.CopyArr(o[context.subcon]);
            }
        }
Пример #2
0
        public override void Process(opis message)
        {
            opis ms = modelSpec.Duplicate();

            instanse.ExecActionModelsList(ms);
            opis rez = new opis();

            if (ms.isHere(VerControlAlgorithm))
            {
                opis r = VerControlCompare(ms[first].Duplicate(), ms[second].Duplicate());
                message.CopyArr(new opis());
                message.AddArr(r);
                return;
            }

            var sec = ms[second].Duplicate();

            ms[first].Difference(sec, true, false,
                                 ms.isHere(deep_is_prior),
                                 ms.isHere(range_body),

                                 ms.isHere(koef) ? ms[koef].intVal : 1,
                                 ms.isHere(koef_mult) ? ms[koef_mult].intVal : 1
                                 );


            var fir = ms[first].Duplicate();

            ms[second].Difference(fir, true, false,
                                  ms.isHere(deep_is_prior),
                                  ms.isHere(range_body),

                                  ms.isHere(koef) ? ms[koef].intVal : 1,
                                  ms.isHere(koef_mult) ? ms[koef_mult].intVal : 1
                                  );



            message.CopyArr(new opis());

            message["sec"] = sec;
            message["fir"] = fir;

            message["compare_b"].PartitionKind         = "different body";
            message["compare_not_f"].PartitionKind     = "node not found";
            message["compare_listCou"].PartitionKind   = "different listCou";
            message["compare_b+listCou"].PartitionKind = "different body different listCou";
        }
Пример #3
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);

            int siz = spec[chunck_size].intVal;

            opis srs = spec[source];
            opis rez = new opis(srs.listCou / siz);

            int idx = 0;

            while (idx < (srs.listCou - siz + 1))
            {
                var itm = new opis(siz)
                {
                    PartitionName = "itm"
                };
                rez.AddArr(itm);
                for (int i = 0; i < siz; i++)
                {
                    itm[i.ToString()] = srs[idx];
                    idx++;
                }
            }


            message.body = "";
            message.CopyArr(rez);
        }
Пример #4
0
        opis dir(FtpClient client, string path, bool rec = true)
        {
            opis rez = new opis();

            foreach (FtpListItem item in client.GetListing(path))
            {
                opis itm = new opis();

                itm.PartitionName = item.Name;
                var dd = client.GetModifiedTime(item.FullName);
                //  itm.body = dd.ToString();

                if (item.Type == FtpFileSystemObjectType.File)
                {
                    itm.PartitionKind = "file";

                    itm["date"].body       = dd.Date.ToString("dd/MM/yyyy");
                    itm["date_ticks"].body = dd.Date.Ticks.ToString();
                    itm["size"].body       = client.GetFileSize(item.FullName).ToString();
                }

                if (rec && item.Type == FtpFileSystemObjectType.Directory)
                {
                    itm.CopyArr(dir(client, item.FullName));
                }

                // calculate a hash for the file on the server side (default algorithm)
                //FtpHash hash = client.GetHash(item.FullName);

                rez.AddArr(itm);
            }

            return(rez);
        }
Пример #5
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);
            instanse.ExecActionModelsList(spec[arguments]);

            if (spec.isHere(source))
            {
                eng = new Jint.Engine().Execute(spec.V(source));
            }
            ;

            if (eng != null && spec.isHere(function))
            {
                var pr = new object[spec[arguments].listCou];

                //  spec[arguments].ListValues().ToArray();

                try
                {
                    var res = eng.Invoke(spec.V(function), spec[arguments].ListValues().ToArray());

                    message.body = res.ToString();
                }
                catch (Exception e)
                {
                    message.body = e.Message;
                }
            }

            message.CopyArr(new opis());
        }
Пример #6
0
        public override void Process(opis message)
        {
            opis ms     = SpecLocalRunAll();
            var  rez    = new opis();
            int  rezcou = 0;

            var txt = ms.V(text);
            var ptn = ms[patterns].ListValues();;

            foreach (var p in ptn)
            {
                if (string.IsNullOrEmpty(p))
                {
                    continue;
                }
                Regex           regex   = new Regex(p.Replace("_", " "));
                MatchCollection matches = regex.Matches(txt);
                if (matches.Count > 0)
                {
                    foreach (Match match in matches)
                    {
                        rezcou++;
                        rez.Vset(rezcou.ToString(), match.Value);
                        txt = txt.Replace(match.Value, "");
                    }
                }
            }

            message.body = txt;
            message.CopyArr(rez);
        }
Пример #7
0
 public void GetLogForThisins()
 {
     logopis = new opis(name);
     thisins["Models_log"].AddArr(logopis);
     logopis.CopyArr(modelSpec);
     logopis.body = modelSpec.V("_path_");
 }
        public override void Process(opis message)
        {
            var Root = new opis();

            BuildLevel(o, Root);
            message.CopyArr(Root);
        }
Пример #9
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);

            string csource = spec.V(source);


            var arr = string.IsNullOrEmpty(spec.V(separator)) ? csource.Split() : csource.Split(spec.V(separator)[0]);

            if (spec.isHere(array_source))
            {
                var srs = spec[array_source];
                arr = new string[srs.listCou];
                for (int i = 0; i < srs.listCou; i++)
                {
                    arr[i] = srs[i].body;
                }
            }

            opis word_arr = new opis(arr.Length + 1);

            bool nonempt = spec.isHere(non_empty_only, false);

            for (int i = 0; i < arr.Length; i++)
            {
                if (!nonempt || (nonempt && !string.IsNullOrEmpty(arr[i].Trim())))
                {
                    word_arr.Vset(i.ToString(), arr[i].Trim());
                }
            }

            var rez = "";

            string join_sep = spec[glue_with].isInitlze ? spec.V(glue_with).Replace('_', ' ') : " ";

            if (spec.isHere(last_N))
            {
                int n = 0;
                int.TryParse(spec.V(last_N), out n);
                rez = String.Join(join_sep, arr.Skip(arr.Length > n ? arr.Length - n : 0).ToList());
            }

            if (spec.isHere(first_N))
            {
                int n = 0;
                int.TryParse(spec.V(first_N), out n);
                rez = String.Join(join_sep, arr.Take(arr.Length < n ? arr.Length  : n).ToList());
            }



            message.body          = rez.Trim();
            message.PartitionKind = "";
            message.CopyArr(word_arr);
        }
Пример #10
0
        public override void Process(opis message)
        {
            if (message.PartitionKind == name)
            {
                message.PartitionKind += "_done";
            }

            if (message.listCou > 0 && message.getPartitionIdx(Wrap) == -1)
            {
                string name = message[0].PartitionName;
                opis   tmp  = SharedContextRoles.GetRole(name, sharedVal);

                message.body = tmp.body;
                message.CopyArr(tmp);

                if (modelSpec.getPartitionIdx(Wrap) != -1)
                {
                    message.Wrap(tmp);
                }
                else
                {
                    message.body = tmp.body;
                    message.CopyArr(tmp);
                }
            }
            else
            {
                string name = message.body;
                if (!string.IsNullOrEmpty(name))
                {
                    opis tmp = SharedContextRoles.GetRole(name, sharedVal);

                    if (modelSpec.getPartitionIdx(Wrap) != -1)
                    {
                        message.Wrap(tmp);
                    }
                    else
                    {
                        message.body = tmp.body;
                        message.CopyArr(tmp);
                    }
                }
            }
        }
Пример #11
0
        public override void Process(opis message)
        {
            opis ms = SpecLocalRunAll();

            var srs = ms[source];

            message.CopyArr(new opis());

            if (ms.isHere(car, false))
            {
                message.Wrap(srs.listCou > 0 ? srs[0] : new opis());
            }

            if (ms.isHere(cdr, false))
            {
                message.CopyArr(srs);
                message.RemoveArrElem(0);
            }
        }
Пример #12
0
        public override void Process(opis message)
        {
            opis ms = modelSpec.Duplicate();

            instanse.ExecActionModelsList(ms);
            opis rez = new opis();

            bool retdata        = ms.isHere(returnItemsNotBranches);
            bool exactOnly      = ms.isHere(exact_structure);
            bool onlyItemsLevel = ms.isHere(only_top_level, false);

            ms[source].FindByTemplateValue(ms[template], rez, exactOnly, retdata, true, false, !onlyItemsLevel);

            message.CopyArr(rez, true);
            if (!ms.isHere(all) && rez.listCou > 0)
            {
                message.CopyArr(rez[0], true);
                message.body = rez[0].body;
            }
        }
Пример #13
0
        public override void Process(opis message)
        {
            if (modelSpec.isHere(get_all, false) && global_log.log != null)
            {
                message.CopyArr(global_log.log);
            }

            if (modelSpec.isHere(clear_all, false))
            {
                global_log.ClearAll();
            }
        }
Пример #14
0
        public override void Process(opis message)
        {
            opis ms = SpecLocalRunAll();

            var fs = new fuzzinesSettings(ms[fuzz]);

            message.PartitionKind = "";
            message.CopyArr(Search(ms[options].ListPartitions().Select(x => new TermMatch()
            {
                term = x
            }).ToList(),
                                   fs, ms.V(word)));
        }
Пример #15
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);


            var dayz = Dates.DaysInPeriod(Dates.FromStringTicks(spec.V(start)), Dates.FromStringTicks(spec.V(fin)));

            if (Dates.FromStringTicks(spec.V(start)) > Dates.FromStringTicks(spec.V(fin)))
            {
                dayz.Clear();
            }

            var firstW = Dates.FromStringTicks(spec.V(dateForFirstWeek));

            var h = spec[hour].intVal;
            var m = spec[minute].intVal;

            var format = spec[dateFormat].body;

            opis rez = new opis();

            foreach (var date in dayz)
            {
                var  d       = date.AddHours(h).AddMinutes(m);
                opis dayInfo = new opis();
                dayInfo.PartitionName = "d";
                dayInfo.Vset("DayOfYear", d.DayOfYear.ToString());
                dayInfo.Vset("Year", d.Year.ToString());
                dayInfo.Vset("Month", d.Month.ToString());
                dayInfo.Vset("Day", d.Day.ToString());
                dayInfo.Vset("DayOfWeek", ((int)d.DayOfWeek).ToString());
                dayInfo.Vset("Ticks", d.Ticks.ToString());
                dayInfo.Vset("Formatted", d.ToString(format));

                int wnum             = (Dates.WeekNumSince(firstW, d) + 1);
                int week_odd_even    = Dates.WeekForDate(firstW, 1, d);
                int quattro_odd_even = 0;
                dayInfo.Vset("week_num", wnum.ToString());
                dayInfo.Vset("week_1_2", week_odd_even.ToString());

                quattro_odd_even = (wnum + 3) % 4;
                dayInfo.Vset("week_1_2_3_4", quattro_odd_even.ToString());


                rez.AddArr(dayInfo);
            }

            message.CopyArr(rez);
        }
Пример #16
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);

            if (spec.isHere(InnerHtmlLengthLimit))
            {
                int.TryParse(spec.V(InnerHtmlLengthLimit), out maxHtmlShow);
            }

            if (spec.isHere(ignore_names_attr))
            {
                namesAtrIgnore = new List <string>();
                for (int i = 0; i < spec[ignore_names_attr].listCou; i++)
                {
                    namesAtrIgnore.Add(spec[ignore_names_attr][i].PartitionName);
                }
            }

            var htmltext = spec.V(HtmlText);

            if (spec.isHere(fix_html))
            {
                fixes = spec[fix_html];
                return;
            }

            if (fixes != null)
            {
                for (int i = 0; i < fixes.listCou; i++)
                {
                    htmltext = htmltext.Replace(fixes[i]["bad"].body, fixes[i]["good"].body);
                }
            }


            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(htmltext);

            var rez = new opis();

            var docRoot = rez["DocumentNode"];

            Trace(doc.DocumentNode, docRoot);

            message.CopyArr(docRoot);
        }
Пример #17
0
        public override void Process(opis message)
        {
            opis source = o;

            if (modelSpec[sdc_Role].isInitlze)
            {
                source = SharedContextRoles.GetRole(modelSpec[sdc_Role].body, sharedVal);
            }
            if (source != null)
            {
                opis t = contex.GetHierarchyStub(source);
                message.body = t.body;
                message.CopyArr(t);
            }
        }
Пример #18
0
        public static void DecompressOpis(opis t)
        {
            opis parsed = new opis();

            try
            {
                parsed.load(Compress.DeComprez(t.body));
            }
            catch (IndexOutOfRangeException e)
            {
                parsed.body = Compress.DeComprez(t.body);
            }

            t.CopyArr(parsed);
            t.body = parsed.body;
        }
Пример #19
0
        public override void Process(opis message)
        {
            opis data = new opis();

            if (!string.IsNullOrEmpty(rawData))
            {
                if (rawData.Trim().StartsWith("{"))
                {
                    data.load(rawData);
                }
                else
                {
                    data.load(Compress.DeComprez(rawData));
                }
            }

            message.CopyArr(data);
        }
Пример #20
0
        //[info("")]
        //[model("")]
        //public static readonly string Connection = "Connection";

        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);

            if (spec.isHere(Connection) && !string.IsNullOrWhiteSpace(spec.V(Connection)))
            {
                curr_conn = spec.V(Connection);
            }


            opis trtrt = ConnectAndQuery(curr_conn, spec.V(Query_text), spec.isHere(Capasity) && spec[Capasity].isInitlze ? spec[Capasity].intVal : 10000);


            message.body = "";
            message.CopyArr(trtrt);
            //message.AddArr(trtrt);
        }
Пример #21
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);


            var p = spec.V(pname);

            if (spec.isHere(val))
            {
                Set(p, spec[val]);
            }
            else
            {
                message.PartitionKind = "";
                message.CopyArr(storage[p]);
                message.body = storage[p].body;
            }
        }
Пример #22
0
        public override void Process(opis message)
        {
            if (message.PartitionKind == name)
            {
                message.PartitionKind += "_done";
            }

            string nm = message.body;

            int  idx = sharedVal.getPartitionIdx(nm);
            opis tmp = idx != -1 ? sharedVal[idx].W() : new opis();// SharedContextRoles.GetRole(nm, sharedVal);

            if (modelSpec.getPartitionIdx("W") != -1)
            {
                message.Wrap(tmp);
            }
            else
            {
                message.body = tmp.body;
                message.CopyArr(tmp);
            }
        }
Пример #23
0
        public override void Process(opis message)
        {
            opis args = modelSpec[word].Duplicate();

            instanse.ExecActionModel(args, args);

            //logopis.WrapByName(args, "word");

            if (args.isInitlze)
            {
                if (modelSpec[Create_instance].isInitlze)
                {
                    instanse.CreateInstance(args.body);
                }


                opis t = instanse.GetWordForm(args.body).Duplicate();

                SharedContextRoles.SetRole(t, modelSpec.isHere(role) ? modelSpec[role].body : "NotionWord", sharedVal);
                message.body = t.body;
                message.CopyArr(t);
            }
        }
Пример #24
0
        public override void Process(opis message)
        {
            opis trtrt = new opis();

            try
            {
                if (modelSpec.isHere(opis_json))
                {
                    trtrt.load(message.body);
                }
                else
                {
                    trtrt.JsonParce(message.body);
                }
            }
            catch (Exception e)
            {
                trtrt["error parce"].body = e.Message;
            }

            message.body = "";
            if (modelSpec.isHere(opis_json))
            {
                message.body = trtrt.body;
            }

            if (modelSpec.isHere(decode_names))
            {
                trtrt.RunRecursively(x => x.PartitionName = TemplatesMan.UTF8BigEndian_to_Kirill(x.PartitionName));
            }



            message.CopyArr(new opis());
            message.AddArr(trtrt);
        }
Пример #25
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);

            var srs = spec[source];

            if (spec.isHere(sort_source))
            {
                srs = message;
            }

            int sortt = (spec.isHere(sort_type)) ? spec[sort_type].intVal : 1;

            if (!string.IsNullOrEmpty(spec.V(order)))
            {
                var pnm = spec.V(order_by_partition);
                if (pnm.Length > 0)
                {
                    srs.SortArrayBy_pname_body(pnm, sortt, spec.V(order) != "desc");
                }
                else if (sortt == 3 || sortt == 4)
                {
                    srs.SortArrayBy_items_body(sortt, spec.V(order) != "desc");
                }
                else
                {
                    srs.SortThisArrayBy_items_pname(sortt, spec.V(order) != "desc");
                }
            }

            if (spec.isHere(sort_source))
            {
                return;
            }

            // ========================
            //   document composing

            var rez = "";
            var pn  = spec[part_names];

            for (int i = 0; i < srs.listCou; i++)
            {
                var line = "";
                if (pn.listCou > 0)
                {
                    for (int k = 0; k < pn.listCou; k++)
                    {
                        line += srs[i][pn[k].PartitionName].body + "\t";
                    }
                }
                else
                {
                    line += srs[i].PartitionName + "\t " + srs[i].body;
                }

                rez += line + " \n";
            }


            message.body          = rez;
            message.PartitionKind = "";
            message.CopyArr(new opis());
        }
Пример #26
0
        public override void Process(opis message)
        {
            opis spec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(spec);

            if (spec.isHere(source))
            {
                csource = spec.V(source);
            }

            if (spec.isHere(pos))
            {
                cpos = spec[pos].intVal;
            }

            bool startCloser_to_end  = spec.isHere(start_closer_to_end);
            bool endingCloser_to_end = spec.isHere(fin_closer_to_end);

            string st = string.IsNullOrEmpty(spec.V(start)) ? spec.V(alt_start) : spec.V(start);

            var rez = GetEnclosed("###" + csource + "###", st, spec.V(fin), ref cpos, startCloser_to_end, endingCloser_to_end);

            var enclfound = spec.V(fin);

            if (string.IsNullOrEmpty(rez) && spec.isHere(alt_fin))
            {
                rez       = GetEnclosed("###" + csource + "###", st, spec.V(alt_fin), ref cpos, startCloser_to_end, endingCloser_to_end);
                enclfound = spec.V(alt_fin);
            }

            if (string.IsNullOrEmpty(rez) && spec.isHere(alt_fin2))
            {
                rez       = GetEnclosed("###" + csource + "###", st, spec.V(alt_fin2), ref cpos, startCloser_to_end, endingCloser_to_end);
                enclfound = spec.V(alt_fin2);
            }

            if (!string.IsNullOrWhiteSpace(rez))
            {
                if (spec.isHere(fin_as_separator))
                {
                    cpos -= enclfound.Length;
                }

                if (spec.isHere(add_closures))
                {
                    switch (spec.V(add_closures))
                    {
                    case "sf":
                        rez = st + rez + enclfound;
                        break;

                    case "s":
                        rez = st + rez;
                        break;

                    case "f":
                        rez = rez + enclfound;
                        break;
                    }
                }

                if (spec.isHere(if_not_empty))
                {
                    var par = new opis()
                    {
                        body = rez, PartitionName = "rez"
                    };
                    instanse.ExecActionResponceModelsList(spec[if_not_empty], par);
                }
            }


            message.body          = rez.Trim();
            message.PartitionKind = "";
            message.CopyArr(new opis());
        }
Пример #27
0
        public override void Process(opis message)
        {
            opis rl = modelSpec[ReplaceList].Duplicate();

            instanse.ExecActionModel(rl, rl);
            //string data = message.body;

            opis dd = modelSpec[String_templ].Duplicate();

            instanse.ExecActionModel(dd, dd);
            string data = dd.body;

            opis t = modelSpec[values_container].Duplicate();

            instanse.ExecActionModel(t, t);

            //logopis.AddArr(t);

            if (modelSpec.isHere(use_container_names))
            {
                for (int i = 0; i < t.listCou; i++)
                {
                    string torepl      = "#" + t[i].PartitionName.Trim() + "#";
                    string replacement = t[i].body;

                    replacement = replacement.Trim(new char[] { '"' });

                    if (modelSpec.isHere(percent_symbol_encode))
                    {
                        replacement = replacement.Replace("%", "%25");
                    }

                    if (!modelSpec.isHere(no_slash_conversion))
                    {
                        replacement = replacement.Replace("/", "%2F").Replace(" ", "+");
                    }

                    if (modelSpec.isHere(params_full_url_encoding))
                    {
                        replacement = TemplatesMan.UrlEncodeFull(replacement);
                    }
                    else
                    if (modelSpec.isHere(aspnet_form_encoding))
                    {
                        replacement = TemplatesMan.AspnetUrlEncodeFull(replacement);
                    }

                    if (modelSpec.isHere(params_UTF_to_UTF25pref_encoding))
                    {
                        replacement = TemplatesMan.UTF_to_UTF25pref(replacement);
                    }


                    if (!modelSpec.isHere(no_encoding_conversion))
                    {
                        data = data.Replace(torepl, TemplatesMan.Kirill_to_UTF(replacement));
                    }
                    else
                    {
                        data = data.Replace(torepl, replacement);
                    }
                }
            }
            else
            {
                for (int i = 0; i < rl.listCou; i++)
                {
                    string replacement = t.V(string.IsNullOrEmpty(rl[i].body) ? rl[i].PartitionName.Trim(new char[] { '#' }) : rl[i].body);
                    replacement = replacement.Trim(new char[] { '"' });

                    if (!modelSpec.isHere(no_slash_conversion))
                    {
                        replacement = replacement.Replace("/", "%2F").Replace(" ", "+");
                    }

                    if (modelSpec.isHere(params_full_url_encoding))
                    {
                        replacement = TemplatesMan.UrlEncodeFull(replacement);
                    }

                    if (modelSpec.isHere(params_UTF_to_UTF25pref_encoding))
                    {
                        replacement = TemplatesMan.UTF_to_UTF25pref(replacement);
                    }

                    if (!modelSpec.isHere(no_encoding_conversion))
                    {
                        data = data.Replace(rl[i].PartitionName, TemplatesMan.Kirill_to_UTF(replacement));
                    }
                    else
                    {
                        data = data.Replace(rl[i].PartitionName, replacement);
                    }
                }
            }


            message.body          = data;
            message.PartitionKind = "";
            message.CopyArr(new opis());
        }
Пример #28
0
        public override void Process(opis message)
        {
            opis mspec = modelSpec.Duplicate();

            instanse.ExecActionModelsList(mspec);

            DateTime r = new DateTime();

            if (mspec.isHere(override_actual_date, false))
            {
                if (mspec[override_actual_date].isInitlze)
                {
                    overrideActual = Dates.FromStringTicks(mspec.V(override_actual_date));
                }
                else
                {
                    overrideActual = new DateTime(2);
                }
            }

            if (mspec.isHere(from_ticks, false) && mspec[from_ticks].isInitlze)
            {
                r = Dates.FromStringTicks(mspec.V(from_ticks));
                if (mspec.isHere(hour) || mspec.isHere(day))
                {
                    TimeSpan sp = new TimeSpan(mspec[day].intVal, mspec[hour].intVal, mspec[minute].intVal, 0);
                    r = r.Add(sp);
                }
            }

            if (mspec.isHere(from_unix, false) && mspec[from_unix].isInitlze)
            {
                r = Dates.FromEpochTime(mspec.V(from_unix));
                if (mspec.isHere(hour) || mspec.isHere(day))
                {
                    TimeSpan sp = new TimeSpan(mspec[day].intVal, mspec[hour].intVal, mspec[minute].intVal, 0);
                    r = r.Add(sp);
                }
            }

            if (mspec.isHere(return_actual_date, false))
            {
                r = DateTime.Now;

                if (overrideActual.Year > 2000)
                {
                    r = overrideActual;
                }

                if (mspec.isHere(hour) || mspec.isHere(day))
                {
                    TimeSpan sp = new TimeSpan(mspec[day].intVal, mspec[hour].intVal, mspec[minute].intVal, 0);
                    r = r.Add(sp);
                }
            }

            if (mspec.isHere(return_system_date, false))
            {
                r = DateTime.Now;

                if (mspec.isHere(hour) || mspec.isHere(day))
                {
                    TimeSpan sp = new TimeSpan(mspec[day].intVal, mspec[hour].intVal, mspec[minute].intVal, 0);
                    r = r.Add(sp);
                }
            }

            if (mspec.isHere(month, false))
            {
                try
                {
                    var yr = !string.IsNullOrEmpty(mspec.V(year)) ? mspec[year].intVal : DateTime.Now.Year;
                    yr = yr < 100 ? 2000 + yr : yr;
                    r  = new DateTime(yr, mspec[month].intVal, mspec[day].intVal, mspec[hour].intVal, mspec[minute].intVal, 0);
                }
                catch
                {
                }
            }

            if (mspec.isHere(set_curr, false))
            {
                curr = r;
            }


            if (mspec.isHere(Get_next_Week_monday, false))
            {
                r = Dates.MondayForDate(Dates.MondayForDate(curr).AddDays((mspec[Get_next_Week_monday].intVal > 0 ||
                                                                           mspec[Get_next_Week_monday].PartitionKind != "spec_tag")
                                                                         ? mspec[Get_next_Week_monday].intVal : 7));
                if (mspec.isHere(hour))
                {
                    TimeSpan sp = new TimeSpan(mspec[hour].intVal, mspec[minute].intVal, 0);
                    r = r.Add(sp);
                }
            }

            if (mspec.isHere(Get_This_Week_Sunday, false))
            {
                r = Dates.SundayForDate(curr);
            }


            message.body = mspec.OptionActive(format, false) ? r.ToString(mspec.V(format)) : r.Ticks.ToString();


            if (mspec.isHere(epoch_value, false))
            {
                message.body = Dates.EpochTime(r).ToString();
            }
            else if (mspec.isHere(week_num, false))
            {
                message.body = new GregorianCalendar(GregorianCalendarTypes.Localized).GetWeekOfYear(r, CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday).ToString();
            }

            message.CopyArr(new opis());
        }
Пример #29
0
        public void buildCool(opis template, opis partition)
        {
            for (int i = 0; i < template.listCou; i++)
            {
                opis tt   = template[i];
                opis srch = new opis();

                srch.body          = getChemaVal(tt.body, "?", "");
                srch.PartitionName = getChemaVal(tt.PartitionName, "?", "");
                srch.PartitionKind = getChemaVal(tt.PartitionKind, "?", "");

                opis found = new opis();

                partition.FindTreePartitions(srch, "", found, false);

                if (found.listCou > 0)
                {
                    opis fop = found[0][0];

                    // = operate duplicated object
                    if (tt.PartitionName.Contains("="))
                    {
                        fop = fop.Duplicate();
                    }

                    // ^ operate unwrapped object
                    if (tt.PartitionName.Contains("^"))
                    {
                        fop = fop.W();
                    }

                    // * fill array
                    if (tt.PartitionName.Contains("*"))
                    {
                        string apn = getChemaVal(tt.PartitionName, "*", srch.PartitionName);
                        opis   itm = new opis();
                        itm.PartitionName = apn;
                        itm.CopyArr(fop);
                        roleObject.AddArr(itm);
                    }

                    // @ wrap partition
                    if (tt.PartitionName.Contains("@"))
                    {
                        string apn = getChemaVal(tt.PartitionName, "@", srch.PartitionName);
                        opis   itm = new opis();
                        itm.PartitionName = apn;
                        itm.Wrap(fop);
                        roleObject.AddArr(itm);
                    }

                    // # put as is
                    if (tt.PartitionName.Contains("#"))
                    {
                        roleObject.AddArr(fop);
                    }

                    // $ put body value as (usable in body )
                    if (tt.body.Contains("$"))
                    {
                        string apn = getChemaVal(tt.body, "$", srch.PartitionName);
                        opis   itm = new opis();
                        itm.PartitionName = apn;
                        itm.body          = fop.body;
                        roleObject.AddArr(itm);
                    }

                    //recurce
                    if (tt.listCou > 0)
                    {
                        buildCool(tt, fop);
                    }
                }
            }
        }
Пример #30
0
        public override void Process(opis message)
        {
            opis data      = new opis();
            opis curr_data = data;

            data.PartitionName = "root";

            opis treeStruct = new opis();

            treeStruct["data"].Wrap(curr_data);

            opis curr_value = new opis();

            opis ex = modelSpec.Duplicate();

            instanse.ExecActionModelsList(ex);
            modelSpec = ex;

            string filename = modelSpec.V(file).Replace("<%backslash%>", @"\");

            string[] proc = DataFileUtils.LoadLines(filename);

            string format = "my";

            if (modelSpec[format_type].listCou > 0)
            {
                format = modelSpec[format_type][0].PartitionName;
            }

            if (format != "my")
            {
                opis paramToParser = new opis("stringArray", (object)proc);

                instanse.ExecActionResponceModelsList(modelSpec[format_type], paramToParser);

                data = paramToParser["data"];
            }

            #region  tree structure from 1c (MY format)

            if (format == "my")
            {
                foreach (string s in proc)
                {
                    string ds = s.Trim();
                    if (string.IsNullOrEmpty(ds))
                    {
                        continue;
                    }

                    if (ds == "{" || ds == "}")
                    {
                        if (ds == "{")
                        {
                            opis treeStructProc = new opis();
                            treeStructProc["higher"] = treeStruct;
                            curr_data = curr_value;
                            treeStructProc["data"].Wrap(curr_data);
                            treeStruct = treeStructProc;
                        }

                        if (ds == "}")
                        {
                            treeStruct = treeStruct["higher"];
                            //if (!treeStruct.isInitlze)
                            //    logopis.Vset(curr_data.PartitionName, "err: parent object not found");

                            curr_data = treeStruct["data"].W();
                        }
                    }
                    else
                    {
                        //opis treeStructProc = new opis();
                        //treeStructProc["higher"] = treeStruct;

                        opis vvv = new opis();
                        curr_data[ds] = vvv;
                        curr_value    = vvv;

                        //treeStructProc["data"].Wrap(curr_data);
                        //treeStruct = treeStructProc;
                    }
                }
            }

            #endregion

            SharedContextRoles.SetRole(data, modelSpec.isHere(role) ? modelSpec[role].body : "Data_loaded", sharedVal);

            if (modelSpec.isHere(FillMessage))
            {
                message.CopyArr(data);
            }
        }