コード例 #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
ファイル: RemoteHost.cs プロジェクト: jsdiggs13/PowerShell
        /// <summary>
        /// New remote host call failed exception.
        /// </summary>
        internal static Exception NewRemoteHostCallFailedException(RemoteHostMethodId methodId)
        {
            RemoteHostMethodInfo methodInfo = RemoteHostMethodInfo.LookUp(methodId);
            string resourceString           = PSRemotingErrorInvariants.FormatResourceString(
                RemotingErrorIdStrings.RemoteHostCallFailed, methodInfo.Name);

            return(new PSRemotingDataStructureException(resourceString));
        }
コード例 #3
0
ファイル: RemoteHost.cs プロジェクト: jsdiggs13/PowerShell
 /// <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);
 }
コード例 #4
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)));
        }
コード例 #5
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));
        }
コード例 #6
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));
        }
コード例 #7
0
ファイル: RemoteHost.cs プロジェクト: jsdiggs13/PowerShell
        /// <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));
        }
コード例 #8
0
ファイル: RemoteHost.cs プロジェクト: jsdiggs13/PowerShell
        /// <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));
        }
コード例 #9
0
        internal static Exception NewRemoteHostCallFailedException(RemoteHostMethodId methodId)
        {
            RemoteHostMethodInfo info = RemoteHostMethodInfo.LookUp(methodId);

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