/// <summary> /// 引数の解決。 /// </summary> /// <param name="varManager">変数管理。</param> /// <param name="argsInfo">引数情報。</param> /// <param name="args">引数。</param> /// <param name="argTypes">引数の型。</param> 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; } } }
/// <summary> /// 呼び出し対象の解決。 /// </summary> /// <param name="varManager">変数管理。</param> /// <param name="typeFinder">タイプ検索。</param> /// <param name="info">呼び出し情報。</param> /// <param name="type">タイプ。</param> /// <param name="targetObj">オブジェクト。</param> /// <param name="args">引数。</param> /// <param name="argTypes">引数タイプ。</param> /// <param name="bind">バインディング。</param> 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 = BindingFlags.Public | BindingFlags.NonPublic; //static呼び出し時 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 |= BindingFlags.Static; } //オブジェクトに対する呼び出し else { VarAndType varAndType = varManager.GetVarAndType(info.VarAddress); targetObj = varAndType.Core; if (targetObj == null) { throw new InformationException(ResourcesLocal.Instance.NullObjectOperation); } type = varAndType.Type; bind |= BindingFlags.Instance; } //引数の解決 ResolveArgs(varManager, info.Arguments, out args, out argTypes); }