CSLE.CLS_Content.GetQuiet C# (CSharp) Метод

GetQuiet() публичный Метод

public GetQuiet ( string name ) : Value
name string
Результат Value
        public Value GetQuiet(string name)
        {
            if (name == "this")
            {
                Value v = new Value();
                v.type = CallType;
                v.value = CallThis;
                return v;
            }

            Value retV = null;
            bool bFind = values.TryGetValue(name, out retV);
            if (bFind)//优先上下文变量
                return retV;

            if (CallType != null)
            {
                SType.Member retM = null;
                bFind = CallType.members.TryGetValue(name, out retM);
                if (bFind)
                {
                    if (retM.bStatic)
                    {
                        return CallType.staticMemberInstance[name];
                    }
                    else
                    {
                        return CallThis.member[name];
                    }
                }
                if (CallType.functions.ContainsKey(name))
                {
                    Value v = new Value();
                    //如果直接得到代理实例,
                    DeleFunction dele = new DeleFunction(CallType,this.CallThis,name);


                    //DeleScript dele =new DeleScript();
                    //dele.function = name;
                    //dele.calltype = CallType;
                    //dele.callthis = CallThis;
                    v.value = dele;
                    v.type = typeof(DeleFunction);
                    return v;

                }
            }
            return null;
        }
        public Stack<List<string>> tvalues = new Stack<List<string>>();

Usage Example

        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            List <CLS_Content.Value> list = new List <CLS_Content.Value>();

            foreach (ICLS_Expression p in listParam)
            {
                if (p != null)
                {
                    list.Add(p.ComputeValue(content));
                }
            }
            CLS_Content.Value v = null;

            if (content.CallType != null && content.CallType.functions.ContainsKey(funcname))
            {
                if (content.CallType.functions[funcname].bStatic)
                {
                    v = content.CallType.StaticCall(content, funcname, list);
                }
                else
                {
                    v = content.CallType.MemberCall(content, content.CallThis, funcname, list);
                }
            }


            else
            {
                v = content.GetQuiet(funcname);
                if (v != null && v.value is Delegate)
                {
                    //if(v.value is Delegate)
                    {
                        Delegate d = v.value as Delegate;
                        v = new CLS_Content.Value();
                        object[] obja = new object[list.Count];
                        for (int i = 0; i < list.Count; i++)
                        {
                            obja[i] = list[i].value;
                        }
                        v.value = d.DynamicInvoke(obja);
                        if (v.value == null)
                        {
                            v.type = null;
                        }
                        else
                        {
                            v.type = v.value.GetType();
                        }
                    }
                    //else
                    //{
                    //    throw new Exception(funcname + "不是函数");
                    //}
                }
                else
                {
                    v = content.environment.GetFunction(funcname).Call(content, list);
                }
            }
            //操作变量之
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
            return(v);
        }
All Usage Examples Of CSLE.CLS_Content::GetQuiet