private static void EncodeAndAddReturnValue(PSObject psObject, object returnValue) { if (returnValue == null) { return; } RemoteHostEncoder.EncodeAndAddAsProperty(psObject, "mr", returnValue); }
internal static HostInfo GetHostInfo(PSObject dataAsPSObject) { if (dataAsPSObject == null) { throw PSTraceSource.NewArgumentNullException("dataAsPSObject"); } return(RemoteHostEncoder.DecodeObject(GetPropertyValue <PSObject>(dataAsPSObject, "HostInfo"), typeof(HostInfo)) as HostInfo); }
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()); }
private static PSNoteProperty CreateHostInfoProperty(HostInfo hostInfo) => new PSNoteProperty("HostInfo", RemoteHostEncoder.EncodeObject((object)hostInfo));
private static void EncodeAndAddException(PSObject psObject, Exception exception) => RemoteHostEncoder.EncodeAndAddAsProperty(psObject, "me", (object)exception);
private static object DecodeReturnValue(PSObject psObject, Type returnType) => RemoteHostEncoder.DecodePropertyValue(psObject, "mr", returnType);
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))); }