/// <summary> /// Encodes the invoke. /// </summary> /// <param name="method">The method.</param> /// <param name="parameter">The parameter.</param> /// <param name="encryptKey">The encrypt key.</param> /// <param name="package">The package.</param> public static void EncodeInvoke(MethodInfo method, object parameters, string encryptKey, ref NetworkInvokePackage package) { package.Context[METHOD] = serializer.Serialize<MethodInfo>(method); package.Context[METHOD_NAME] = serializer.Serialize<string>(method.Name); package.Context[METHOD_ISGENERIC] = method.IsGenericMethod; package.Context[METHOD_PARAMETERS] = SecurityUtility.DESEncrypt(serializer.Serialize<object>(parameters), encryptKey); package.Context[METHOD_INVOKEINFO] = SecurityUtility.DESEncrypt(serializer.Serialize<MethodInvokeInfo>(new MethodInvokeInfo(method)), encryptKey); }
/// <summary> /// Encodes the invoke. /// </summary> /// <param name="method">The method.</param> /// <param name="parameter">The parameter.</param> /// <param name="encryptKey">The encrypt key.</param> /// <param name="package">The package.</param> public static void EncodeInvoke(MethodInfo method, object parameters, string encryptKey, ref NetworkInvokePackage package) { package.Context[METHOD] = serializer.Serialize <MethodInfo>(method); package.Context[METHOD_NAME] = serializer.Serialize <string>(method.Name); package.Context[METHOD_ISGENERIC] = method.IsGenericMethod; package.Context[METHOD_PARAMETERS] = SecurityUtility.DESEncrypt(serializer.Serialize <object>(parameters), encryptKey); package.Context[METHOD_INVOKEINFO] = SecurityUtility.DESEncrypt(serializer.Serialize <MethodInvokeInfo>(new MethodInvokeInfo(method)), encryptKey); }
/// <summary> /// 解码远程过程调用包 /// </summary> /// <param name="package">The package.</param> /// <param name="encryptKey">The encrypt key.</param> /// <param name="invokeInfo">The invoke info.</param> public static void DecodeInvoke(NetworkInvokePackage package, string encryptKey, out MethodInvokeInfo invokeInfo, out object[] parameters) { invokeInfo = serializer.Deserialize <MethodInvokeInfo>(SecurityUtility.DESDecrypt((byte[])package.Context[METHOD_INVOKEINFO], encryptKey)); parameters = serializer.Deserialize <object[]>(SecurityUtility.DESDecrypt((byte[])package.Context[METHOD_PARAMETERS], encryptKey)); }
/// <summary> /// ����Զ�̹��̵��ð� /// </summary> /// <param name="package">The package.</param> /// <param name="encryptKey">The encrypt key.</param> /// <param name="invokeInfo">The invoke info.</param> public static void DecodeInvoke(NetworkInvokePackage package, string encryptKey, out MethodInvokeInfo invokeInfo, out object[] parameters) { invokeInfo = serializer.Deserialize<MethodInvokeInfo>(SecurityUtility.DESDecrypt((byte[])package.Context[METHOD_INVOKEINFO], encryptKey)); parameters = serializer.Deserialize<object[]>(SecurityUtility.DESDecrypt((byte[])package.Context[METHOD_PARAMETERS], encryptKey)); }