Beispiel #1
0
 private static void EncodeAndAddReturnValue(PSObject psObject, object returnValue)
 {
     if (returnValue == null)
     {
         return;
     }
     RemoteHostEncoder.EncodeAndAddAsProperty(psObject, "mr", returnValue);
 }
Beispiel #2
0
 internal static HostInfo GetHostInfo(PSObject dataAsPSObject)
 {
     if (dataAsPSObject == null)
     {
         throw PSTraceSource.NewArgumentNullException("dataAsPSObject");
     }
     return(RemoteHostEncoder.DecodeObject(GetPropertyValue <PSObject>(dataAsPSObject, "HostInfo"), typeof(HostInfo)) as HostInfo);
 }
Beispiel #3
0
        private static Exception DecodeException(PSObject psObject)
        {
            object obj = RemoteHostEncoder.DecodePropertyValue(psObject, "me", typeof(Exception));

            if (obj == null)
            {
                return((Exception)null);
            }
            return(obj is Exception ? (Exception)obj : throw RemoteHostExceptions.NewDecodingFailedException());
        }
Beispiel #4
0
 private static PSNoteProperty CreateHostInfoProperty(HostInfo hostInfo) => new PSNoteProperty("HostInfo", RemoteHostEncoder.EncodeObject((object)hostInfo));
Beispiel #5
0
 private static void EncodeAndAddException(PSObject psObject, Exception exception) => RemoteHostEncoder.EncodeAndAddAsProperty(psObject, "me", (object)exception);
Beispiel #6
0
 private static object DecodeReturnValue(PSObject psObject, Type returnType) => RemoteHostEncoder.DecodePropertyValue(psObject, "mr", returnType);
Beispiel #7
0
 private static PSNoteProperty CreateHostInfoProperty(HostInfo hostInfo)
 {
     return(new PSNoteProperty("HostInfo", RemoteHostEncoder.EncodeObject(hostInfo)));
 }
 internal static HostInfo GetHostInfo(PSObject dataAsPSObject)
 {
     using (RemotingDecoder._trace.TraceMethod())
         return(dataAsPSObject != null?RemoteHostEncoder.DecodeObject((object)RemotingDecoder.GetPropertyValue <PSObject>(dataAsPSObject, "HostInfo"), typeof(HostInfo)) as HostInfo : throw RemotingDecoder._trace.NewArgumentNullException(nameof(dataAsPSObject)));
 }