public object?DeserializeResponse(byte[] payload) { var message = CompatibilityTools.DeserializeValue(_method.ResponseMarshaller, payload); return(message ! .GetType() .InstanceProperty(nameof(Message <int> .Value1)) .GetValue(message)); }
public UnixGameRunner(CompatibilityTools compatibility, DalamudLauncher dalamudLauncher, bool dalamudOk, DalamudLoadMethod?loadMethod, DirectoryInfo dotnetRuntime, Storage storage) { this.compatibility = compatibility; this.dalamudLauncher = dalamudLauncher; this.dalamudOk = dalamudOk; this.loadMethod = loadMethod ?? DalamudLoadMethod.DllInject; this.dotnetRuntime = dotnetRuntime; this.storage = storage; }
/// <exclude /> public static async Task WriteServerStreamingResult <THeader, TResult>( IAsyncEnumerable <TResult> result, Marshaller <THeader> headerMarshaller, THeader header, IServerStreamWriter <Message <TResult> > stream, ServerCallContext context) { await context.WriteResponseHeadersAsync(CompatibilityTools.SerializeMethodOutputHeader(headerMarshaller, header)).ConfigureAwait(false); await WriteServerStreamingResult(result, stream, context).ConfigureAwait(false); }
internal static async Task WaitForServerStreamExceptionAsync <THeader, TResult>( IAsyncStreamReader <Message <TResult> > responseStream, Metadata?responseHeaders, Marshaller <THeader> marshaller, CancellationToken token) { // here should throw the RpcException from server-side // see ExceptionHandlingTestBase ThrowApplicationExceptionServerStreamingHeader and ThrowApplicationExceptionDuplexStreamingHeader await responseStream.MoveNext(token).ConfigureAwait(false); // this line should not be reached // if the case, check for the headers content CompatibilityTools.DeserializeMethodOutputHeader(marshaller, responseHeaders); throw new InvalidOperationException("The server streaming ResponseHeadersAsync did not provide any headers, headers are available only after the streaming."); }
/// <exclude /> public static T GetMethodInputHeader <T>(Marshaller <T> marshaller, ServerCallContext context) { return(CompatibilityTools.DeserializeMethodInputHeader(marshaller, context.RequestHeaders)); }
public byte[] SerializeRequest(object?[] values) { var message = Activator.CreateInstance(typeof(TRequest), values) !; return(CompatibilityTools.SerializeValue(_method.RequestMarshaller, (TRequest)message)); }
public static T DeserializeMethodInput <T>(IMarshallerFactory marshallerFactory, Metadata?requestHeaders) { var message = CompatibilityTools.DeserializeMethodInputHeader(marshallerFactory.CreateMarshaller <Message <T> >(), requestHeaders); return(message.Value1); }
public static Metadata SerializeMethodInput <T1, T2>(IMarshallerFactory marshallerFactory, T1 value1, T2 value2) { return(CompatibilityTools.SerializeMethodInputHeader(marshallerFactory.CreateMarshaller <Message <T1, T2> >(), new Message <T1, T2>(value1, value2))); }
/// <exclude /> public CallOptionsBuilder WithMethodInputHeader <T>(Marshaller <T> marshaller, T value) { var metadata = CompatibilityTools.SerializeMethodInputHeader(marshaller, value); return(WithCallOptions(new CallOptions(metadata))); }
public UnixDalamudRunner(CompatibilityTools compatibility, DirectoryInfo dotnetRuntime) { this.compatibility = compatibility; this.dotnetRuntime = dotnetRuntime; }