private CreateMessage ( string name, ulong requestId, Newtonsoft.Json.Linq.JArray json, byte blob = null ) : Message | ||
name | string | |
requestId | ulong | |
json | Newtonsoft.Json.Linq.JArray | |
blob | byte | |
Результат | Message |
public EvaluationRequest(RHost host, string expression, REvaluationKind kind, out JArray message) { Expression = expression; Kind = kind; var nameBuilder = new StringBuilder("="); if (kind.HasFlag(REvaluationKind.Reentrant)) { nameBuilder.Append('@'); } if (kind.HasFlag(REvaluationKind.Cancelable)) { nameBuilder.Append('/'); } if (kind.HasFlag(REvaluationKind.BaseEnv)) { nameBuilder.Append('B'); } if (kind.HasFlag(REvaluationKind.EmptyEnv)) { nameBuilder.Append('E'); } if (kind.HasFlag(REvaluationKind.NoResult)) { nameBuilder.Append('0'); } MessageName = nameBuilder.ToString(); expression = expression.Replace("\r\n", "\n"); message = host.CreateMessage(out Id, MessageName, expression); }
public static async Task <GetBlobRequest> SendAsync(RHost host, ulong blobId, CancellationToken cancellationToken) { var message = host.CreateMessage("?GetBlob", ulong.MaxValue, new JArray { blobId }); var request = new GetBlobRequest(host, message, cancellationToken); await host.SendAsync(message, cancellationToken); return(request); }
public static async Task <EvaluationRequest> SendAsync(RHost host, string expression, REvaluationKind kind, CancellationToken cancellationToken) { var nameBuilder = new StringBuilder("?="); if (kind.HasFlag(REvaluationKind.Reentrant)) { nameBuilder.Append('@'); } if (kind.HasFlag(REvaluationKind.Cancelable)) { nameBuilder.Append('/'); } if (kind.HasFlag(REvaluationKind.BaseEnv)) { nameBuilder.Append('B'); } if (kind.HasFlag(REvaluationKind.EmptyEnv)) { nameBuilder.Append('E'); } if (kind.HasFlag(REvaluationKind.NoResult)) { nameBuilder.Append('0'); } if (kind.HasFlag(REvaluationKind.RawResult)) { nameBuilder.Append('r'); } string messageName = nameBuilder.ToString(); expression = expression.Replace("\r\n", "\n"); var message = host.CreateMessage(messageName, ulong.MaxValue, new JArray { expression }); var request = new EvaluationRequest(host, message, kind, cancellationToken); await host.SendAsync(message, cancellationToken); return(request); }