public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { await Task.FromCanceled(cancellationToken); } }
public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { await Task.FromCanceled(cancellationToken); } const string messageTypeFieldName = "message"; const string exTypeFieldName = "exType"; const string structApplicationExceptionName = "TApplicationException"; var struc = new TStruct(structApplicationExceptionName); var field = new TField(); await oprot.WriteStructBeginAsync(struc, cancellationToken); if (!string.IsNullOrEmpty(Message)) { field.Name = messageTypeFieldName; field.Type = TType.String; field.ID = MessageTypeFieldId; await oprot.WriteFieldBeginAsync(field, cancellationToken); await oprot.WriteStringAsync(Message, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } field.Name = exTypeFieldName; field.Type = TType.I32; field.ID = ExTypeFieldId; await oprot.WriteFieldBeginAsync(field, cancellationToken); await oprot.WriteI32Async((int) Type, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); }
public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) { await WriteJsonObjectStartAsync(cancellationToken); }
/// <summary> /// Write a struct begin. This doesn't actually put anything on the wire. We /// use it as an opportunity to put special placeholder markers on the field /// stack so we can get the field id deltas correct. /// </summary> public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { await Task.FromCanceled(cancellationToken); } _lastField.Push(_lastFieldId); _lastFieldId = 0; }
public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) { await _wrappedProtocol.WriteStructBeginAsync(struc, cancellationToken); }