static void ResolveInvokeTarget(VarPool varManager, TypeFinder typeFinder, ProtocolInfo info, out Type type, out object targetObj, out object[] args, out Type[] argTypes, out BindingFlags bind)
        {
            type      = null;
            targetObj = null;
            bind      = new BindingFlags();

            if (info.VarAddress == null)
            {
                type = typeFinder.GetType(info.TypeFullName);
                if (type == null)
                {
                    throw new InformationException(string.Format(CultureInfo.CurrentCulture, ResourcesLocal.Instance.UnknownTypeInfoFormat, info.TypeFullName));
                }
                bind.IsStatic = true;
            }
            else
            {
                VarAndType varAndType = varManager.GetVarAndType(info.VarAddress);
                targetObj = varAndType.Core;
                if (targetObj == null)
                {
                    throw new InformationException(ResourcesLocal.Instance.NullObjectOperation);
                }
                type = varAndType.Type;
            }
            ResolveArgs(varManager, info.Arguments, out args, out argTypes);
        }
 static ReturnInfo GetValue(VarPool varManager, ProtocolInfo info)
 {
     if (info.Arguments.Length != 0)
     {
         throw new InternalException();
     }
     return(new ReturnInfo(varManager.GetVarAndType(info.VarAddress).Core));
 }
        static ReturnInfo GetElements(VarPool varManager, ProtocolInfo info)
        {
            object obj = varManager.GetVarAndType(info.VarAddress).Core;

            IEnumerable enumerable = obj as IEnumerable;

            if (enumerable == null)
            {
                throw new InformationException(ResourcesLocal.Instance.HasNotEnumerable);
            }

            List <VarAddress> list = new List <VarAddress>();

            foreach (object element in enumerable)
            {
                list.Add(varManager.Add(element));
            }
            return(new ReturnInfo(list.ToArray()));
        }
        internal static void ResolveArgs(VarPool varManager, object[] argsInfo, out object[] args, out Type[] argTypes)
        {
            args     = new object[argsInfo.Length];
            argTypes = new Type[argsInfo.Length];
            for (int i = 0; i < argsInfo.Length; i++)
            {
                VarAddress handle = argsInfo[i] as VarAddress;

                if (handle == null)
                {
                    args[i] = argsInfo[i];
                    if (args[i] != null)
                    {
                        argTypes[i] = args[i].GetType();
                    }
                }
                else
                {
                    VarAndType varAndType = varManager.GetVarAndType(handle);
                    args[i]     = varAndType.Core;
                    argTypes[i] = varAndType.Type;
                }
            }
        }