Пример #1
0
 internal RemoteHostCall(long callId, RemoteHostMethodId methodId, object[] parameters)
 {
     this._callId = callId;
     this._methodId = methodId;
     this._parameters = parameters;
     this._methodInfo = RemoteHostMethodInfo.LookUp(methodId);
 }
Пример #2
0
 /// <summary>
 /// Constructor for RemoteHostCall.
 /// </summary>
 internal RemoteHostCall(long callId, RemoteHostMethodId methodId, object[] parameters)
 {
     Dbg.Assert(parameters != null, "Expected parameters != null");
     _callId     = callId;
     MethodId    = methodId;
     Parameters  = parameters;
     _methodInfo = RemoteHostMethodInfo.LookUp(methodId);
 }
Пример #3
0
        /// <summary>
        /// New not implemented exception.
        /// </summary>
        internal static Exception NewNotImplementedException(RemoteHostMethodId methodId)
        {
            RemoteHostMethodInfo methodInfo = RemoteHostMethodInfo.LookUp(methodId);
            string resourceString           = PSRemotingErrorInvariants.FormatResourceString(
                RemotingErrorIdStrings.RemoteHostMethodNotImplemented, methodInfo.Name);

            return(new PSRemotingDataStructureException(resourceString, new PSNotImplementedException()));
        }
Пример #4
0
 /// <summary>
 /// Constructor for RemoteHostCall.
 /// </summary>
 internal RemoteHostCall(long callId, RemoteHostMethodId methodId, object[] parameters)
 {
     Dbg.Assert(parameters != null, "Expected parameters != null");
     _callId = callId;
     MethodId = methodId;
     Parameters = parameters;
     _methodInfo = RemoteHostMethodInfo.LookUp(methodId);
 }
Пример #5
0
        internal static RemoteHostResponse Decode(PSObject data)
        {
            long propertyValue            = RemotingDecoder.GetPropertyValue <long>(data, "ci");
            RemoteHostMethodId   methodId = RemotingDecoder.GetPropertyValue <RemoteHostMethodId>(data, "mi");
            RemoteHostMethodInfo info     = RemoteHostMethodInfo.LookUp(methodId);
            object returnValue            = DecodeReturnValue(data, info.ReturnType);

            return(new RemoteHostResponse(propertyValue, methodId, returnValue, DecodeException(data)));
        }
Пример #6
0
        internal static RemoteHostCall Decode(PSObject data)
        {
            long                 propertyValue1       = RemotingDecoder.GetPropertyValue <long>(data, "ci");
            PSObject             propertyValue2       = RemotingDecoder.GetPropertyValue <PSObject>(data, "mp");
            RemoteHostMethodId   propertyValue3       = RemotingDecoder.GetPropertyValue <RemoteHostMethodId>(data, "mi");
            RemoteHostMethodInfo remoteHostMethodInfo = RemoteHostMethodInfo.LookUp(propertyValue3);

            object[] parameters = RemoteHostCall.DecodeParameters(propertyValue2, remoteHostMethodInfo.ParameterTypes);
            return(new RemoteHostCall(propertyValue1, propertyValue3, parameters));
        }
Пример #7
0
        internal static RemoteHostCall Decode(PSObject data)
        {
            long                 propertyValue      = RemotingDecoder.GetPropertyValue <long>(data, "ci");
            PSObject             parametersPSObject = RemotingDecoder.GetPropertyValue <PSObject>(data, "mp");
            RemoteHostMethodId   methodId           = RemotingDecoder.GetPropertyValue <RemoteHostMethodId>(data, "mi");
            RemoteHostMethodInfo info = RemoteHostMethodInfo.LookUp(methodId);

            object[] objects = DecodeParameters(parametersPSObject, info.ParameterTypes);
            return(new RemoteHostCall(propertyValue, methodId, objects));
        }
Пример #8
0
        /// <summary>
        /// Decode.
        /// </summary>
        internal static RemoteHostResponse Decode(PSObject data)
        {
            Dbg.Assert(data != null, "Expected data != null");

            // Extract all the fields from data.
            long callId = RemotingDecoder.GetPropertyValue <long>(data, RemoteDataNameStrings.CallId);
            RemoteHostMethodId methodId = RemotingDecoder.GetPropertyValue <RemoteHostMethodId>(data, RemoteDataNameStrings.MethodId);

            // Decode the return value and the exception.
            RemoteHostMethodInfo methodInfo = RemoteHostMethodInfo.LookUp(methodId);
            object    returnValue           = DecodeReturnValue(data, methodInfo.ReturnType);
            Exception exception             = DecodeException(data);

            // Use these values to create a RemoteHostResponse and return it.
            return(new RemoteHostResponse(callId, methodId, returnValue, exception));
        }
Пример #9
0
        /// <summary>
        /// Decode.
        /// </summary>
        internal static RemoteHostCall Decode(PSObject data)
        {
            Dbg.Assert(data != null, "Expected data != null");

            // Extract all the fields from data.
            long               callId             = RemotingDecoder.GetPropertyValue <long>(data, RemoteDataNameStrings.CallId);
            PSObject           parametersPSObject = RemotingDecoder.GetPropertyValue <PSObject>(data, RemoteDataNameStrings.MethodParameters);
            RemoteHostMethodId methodId           = RemotingDecoder.GetPropertyValue <RemoteHostMethodId>(data, RemoteDataNameStrings.MethodId);

            // Look up all the info related to the method.
            RemoteHostMethodInfo methodInfo = RemoteHostMethodInfo.LookUp(methodId);

            // Decode the parameters.
            object[] parameters = DecodeParameters(parametersPSObject, methodInfo.ParameterTypes);

            // Create and return the RemoteHostCall.
            return(new RemoteHostCall(callId, methodId, parameters));
        }
Пример #10
0
        internal static Exception NewRemoteHostCallFailedException(RemoteHostMethodId methodId)
        {
            RemoteHostMethodInfo info = RemoteHostMethodInfo.LookUp(methodId);

            return(new PSRemotingDataStructureException(PSRemotingErrorInvariants.FormatResourceString(RemotingErrorIdStrings.RemoteHostCallFailed, new object[] { info.Name })));
        }