Beispiel #1
0
 private void AddTo(string[] fields, IParable target, ParaList to)
 {
     foreach (string field in fields)
     {
         FieldPair fp = FieldPair.Parse(field)[0];
         ParaList  tp = target.GetParameters();
         if (tp.HasPara(fp.GetFrom()))
         {
             IPara para = tp.Get(fp.GetFrom());
             if (para != null)
             {
                 IPara clone = (IPara)para.Copy();
                 clone.SetName(fp.GetTo());
                 if (@override || !to.HasPara(fp.GetTo()))
                 {
                     to.AddPara(clone);
                 }
                 else
                 {
                     to.AddPara(clone);
                 }
             }
         }
     }
 }
Beispiel #2
0
        public override void DoAction(IEventArgs args)
        {
            IParable p = null;

            if (StringUtil.IsNullOrEmpty(key))
            {
                p = args.GetDefault();
            }
            else
            {
                p = args.GetUnit(key);
            }
            if (p != null && paras != null)
            {
                foreach (IPara para in paras)
                {
                    if (!p.GetParameters().HasPara(para) || @override)
                    {
                        IPara clone = (IPara)para.Copy();
                        clone.SetName(FreeUtil.ReplaceVar(clone.GetName(), args));
                        p.GetParameters().AddPara(clone);
                    }
                }
            }
        }
Beispiel #3
0
        private void SetArg(FuncArg arg, IList <ArgValue> funcArgs, IEventArgs args)
        {
            ArgValue fa = GetArgValue(arg, funcArgs, args);

            if (fa != null)
            {
                IPara para = ParaUtil.GetPara(arg.GetType());
                if (para != null)
                {
                    try
                    {
                        IPara old = new ParaExp(fa.GetValue()).GetSourcePara(args);
                        if (old != null)
                        {
                            if (old.GetValue() != null)
                            {
                                para = para.Initial("=", old.GetValue().ToString());
                            }
                            else
                            {
                                para = para.Initial("=", string.Empty);
                            }
                        }
                        else
                        {
                            para = para.Initial("=", FreeUtil.ReplaceNumber(fa.GetValue(), args));
                        }
                    }
                    catch (Exception)
                    {
                        para = para.Initial("=", FreeUtil.ReplaceNumber(fa.GetValue(), args));
                    }
                    para.SetName("arg_" + arg.GetName());
                    args.GetDefault().GetParameters().TempUse(para);
                    IPara p = (IPara)para.Borrow();
                    p.SetName(arg.GetName());
                    if (para.GetValue() != null)
                    {
                        p.SetValue("=", para);
                    }
                    args.GetDefault().GetParameters().TempUse(p);
                    FreeLog.FuncArg(p.ToString());
                }
                else
                {
                    // 非简单变量
                    ((BaseEventArgs)args).TempUse(arg.GetName(), args.GetUnit(fa.GetValue()));
                }
            }
        }