public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return await Task.FromCanceled<bool>(cancellationToken); } try { var message = await iprot.ReadMessageBeginAsync(cancellationToken); if ((message.Type != TMessageType.Call) && (message.Type != TMessageType.Oneway)) { await FailAsync(oprot, message, TApplicationException.ExceptionType.InvalidMessageType, "Message exType CALL or ONEWAY expected", cancellationToken); return false; } // Extract the service name var index = message.Name.IndexOf(TMultiplexedProtocol.Separator, StringComparison.Ordinal); if (index < 0) { await FailAsync(oprot, message, TApplicationException.ExceptionType.InvalidProtocol, $"Service name not found in message name: {message.Name}. Did you forget to use a TMultiplexProtocol in your client?", cancellationToken); return false; } // Create a new TMessage, something that can be consumed by any TProtocol var serviceName = message.Name.Substring(0, index); ITAsyncProcessor actualProcessor; if (!_serviceProcessorMap.TryGetValue(serviceName, out actualProcessor)) { await FailAsync(oprot, message, TApplicationException.ExceptionType.InternalError, $"Service name not found: {serviceName}. Did you forget to call RegisterProcessor()?", cancellationToken); return false; } // Create a new TMessage, removing the service name var newMessage = new TMessage( message.Name.Substring(serviceName.Length + TMultiplexedProtocol.Separator.Length), message.Type, message.SeqID); // Dispatch processing to the stored processor return await actualProcessor.ProcessAsync(new StoredMessageProtocol(iprot, newMessage), oprot, cancellationToken); } catch (IOException) { return false; // similar to all other processors } }
protected TProtocolDecorator(TProtocol protocol) : base(protocol.Transport) { if (protocol == null) { throw new ArgumentNullException(nameof(protocol)); } _wrappedProtocol = protocol; }
protected TBaseClient(TProtocol inputProtocol, TProtocol outputProtocol) { if (inputProtocol == null) { throw new ArgumentNullException(nameof(inputProtocol)); } if (outputProtocol == null) { throw new ArgumentNullException(nameof(outputProtocol)); } _inputProtocol = inputProtocol; _outputProtocol = outputProtocol; }
public static async Task<TApplicationException> ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { string message = null; var type = ExceptionType.Unknown; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { var field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case MessageTypeFieldId: if (field.Type == TType.String) { message = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case ExTypeFieldId: if (field.Type == TType.I32) { type = (ExceptionType) await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); return new TApplicationException(type, message); }
public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot) { return await ProcessAsync(iprot, oprot, CancellationToken.None); }
private async Task FailAsync(TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype, string etxt, CancellationToken cancellationToken) { var appex = new TApplicationException(extype, etxt); var newMessage = new TMessage(message.Name, TMessageType.Exception, message.SeqID); await oprot.WriteMessageBeginAsync(newMessage, cancellationToken); await appex.WriteAsync(oprot, cancellationToken); await oprot.WriteMessageEndAsync(cancellationToken); await oprot.Transport.FlushAsync(cancellationToken); }
public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { bool isset_version = false; bool isset_schema = false; bool isset_num_rows = false; bool isset_row_groups = false; TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { Version = await iprot.ReadI32Async(cancellationToken); isset_version = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.List) { { Schema = new List <SchemaElement>(); TList _list44 = await iprot.ReadListBeginAsync(cancellationToken); for (int _i45 = 0; _i45 < _list44.Count; ++_i45) { SchemaElement _elem46; _elem46 = new SchemaElement(); await _elem46.ReadAsync(iprot, cancellationToken); Schema.Add(_elem46); } await iprot.ReadListEndAsync(cancellationToken); } isset_schema = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.I64) { Num_rows = await iprot.ReadI64Async(cancellationToken); isset_num_rows = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.List) { { Row_groups = new List <RowGroup>(); TList _list47 = await iprot.ReadListBeginAsync(cancellationToken); for (int _i48 = 0; _i48 < _list47.Count; ++_i48) { RowGroup _elem49; _elem49 = new RowGroup(); await _elem49.ReadAsync(iprot, cancellationToken); Row_groups.Add(_elem49); } await iprot.ReadListEndAsync(cancellationToken); } isset_row_groups = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.List) { { Key_value_metadata = new List <KeyValue>(); TList _list50 = await iprot.ReadListBeginAsync(cancellationToken); for (int _i51 = 0; _i51 < _list50.Count; ++_i51) { KeyValue _elem52; _elem52 = new KeyValue(); await _elem52.ReadAsync(iprot, cancellationToken); Key_value_metadata.Add(_elem52); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 6: if (field.Type == TType.String) { Created_by = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 7: if (field.Type == TType.List) { { Column_orders = new List <ColumnOrder>(); TList _list53 = await iprot.ReadListBeginAsync(cancellationToken); for (int _i54 = 0; _i54 < _list53.Count; ++_i54) { ColumnOrder _elem55; _elem55 = new ColumnOrder(); await _elem55.ReadAsync(iprot, cancellationToken); Column_orders.Add(_elem55); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); if (!isset_version) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_schema) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_num_rows) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_row_groups) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { Subscription = new SubscriptionState(); Subscription.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { Events = new List <SquareEvent>(); TList _list345 = iprot.ReadListBegin(); for (int _i346 = 0; _i346 < _list345.Count; ++_i346) { SquareEvent _elem347; _elem347 = new SquareEvent(); _elem347.Read(iprot); Events.Add(_elem347); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { SyncToken = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { ContinuationToken = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { CategoryItem = new CategoryItem(); CategoryItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { SpotItem = new SpotItem(); SpotItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Struct) { ProductItem = new ProductSearchSummary(); ProductItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Struct) { ServiceItem = new ServiceItem(); ServiceItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Struct) { YellowpageItem = new YellowpageItem(); YellowpageItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Struct) { OaItem = new BuddySearchResult(); OaItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { GeoAddressItem = new GeoAddressItem(); GeoAddressItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Struct) { ShortcutItem = new ShortcutItem(); ShortcutItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.Struct) { SquareItem = new SquareInfo(); SquareItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Struct) { SquareCategoryItem = new SQCat(); SquareCategoryItem.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Write(TProtocol oprot, uint value) { oprot.WriteI32((int)value); }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("CompactContact"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Mid != null && __isset.mid) { field.Name = "mid"; field.Type = TType.String; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteString(Mid); oprot.WriteFieldEnd(); } if (__isset.createdTime) { field.Name = "createdTime"; field.Type = TType.I64; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteI64(CreatedTime); oprot.WriteFieldEnd(); } if (__isset.modifiedTime) { field.Name = "modifiedTime"; field.Type = TType.I64; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteI64(ModifiedTime); oprot.WriteFieldEnd(); } if (__isset.status) { field.Name = "status"; field.Type = TType.I32; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI32((int)Status); oprot.WriteFieldEnd(); } if (__isset.settings) { field.Name = "settings"; field.Type = TType.I64; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteI64(Settings); oprot.WriteFieldEnd(); } if (DisplayNameOverridden != null && __isset.displayNameOverridden) { field.Name = "displayNameOverridden"; field.Type = TType.String; field.ID = 6; oprot.WriteFieldBegin(field); oprot.WriteString(DisplayNameOverridden); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Mid = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I64) { CreatedTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I64) { ModifiedTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { Status = (ContactStatus)iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I64) { Settings = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.String) { DisplayNameOverridden = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { bool isset_acked = false; bool isset_failed = false; bool isset_complete_ms_avg = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Map) { { Acked = new Dictionary <string, Dictionary <string, long> >(); TMap _map95 = iprot.ReadMapBegin(); for (int _i96 = 0; _i96 < _map95.Count; ++_i96) { string _key97; Dictionary <string, long> _val98; _key97 = iprot.ReadString(); { _val98 = new Dictionary <string, long>(); TMap _map99 = iprot.ReadMapBegin(); for (int _i100 = 0; _i100 < _map99.Count; ++_i100) { string _key101; long _val102; _key101 = iprot.ReadString(); _val102 = iprot.ReadI64(); _val98[_key101] = _val102; } iprot.ReadMapEnd(); } Acked[_key97] = _val98; } iprot.ReadMapEnd(); } isset_acked = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Map) { { Failed = new Dictionary <string, Dictionary <string, long> >(); TMap _map103 = iprot.ReadMapBegin(); for (int _i104 = 0; _i104 < _map103.Count; ++_i104) { string _key105; Dictionary <string, long> _val106; _key105 = iprot.ReadString(); { _val106 = new Dictionary <string, long>(); TMap _map107 = iprot.ReadMapBegin(); for (int _i108 = 0; _i108 < _map107.Count; ++_i108) { string _key109; long _val110; _key109 = iprot.ReadString(); _val110 = iprot.ReadI64(); _val106[_key109] = _val110; } iprot.ReadMapEnd(); } Failed[_key105] = _val106; } iprot.ReadMapEnd(); } isset_failed = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Complete_ms_avg = new Dictionary <string, Dictionary <string, double> >(); TMap _map111 = iprot.ReadMapBegin(); for (int _i112 = 0; _i112 < _map111.Count; ++_i112) { string _key113; Dictionary <string, double> _val114; _key113 = iprot.ReadString(); { _val114 = new Dictionary <string, double>(); TMap _map115 = iprot.ReadMapBegin(); for (int _i116 = 0; _i116 < _map115.Count; ++_i116) { string _key117; double _val118; _key117 = iprot.ReadString(); _val118 = iprot.ReadDouble(); _val114[_key117] = _val118; } iprot.ReadMapEnd(); } Complete_ms_avg[_key113] = _val114; } iprot.ReadMapEnd(); } isset_complete_ms_avg = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_acked) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_failed) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_complete_ms_avg) { throw new TProtocolException(TProtocolException.INVALID_DATA); } }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("SpoutStats"); oprot.WriteStructBegin(struc); TField field = new TField(); field.Name = "acked"; field.Type = TType.Map; field.ID = 1; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.Map, Acked.Count)); foreach (string _iter119 in Acked.Keys) { oprot.WriteString(_iter119); { oprot.WriteMapBegin(new TMap(TType.String, TType.I64, Acked[_iter119].Count)); foreach (string _iter120 in Acked[_iter119].Keys) { oprot.WriteString(_iter120); oprot.WriteI64(Acked[_iter119][_iter120]); } oprot.WriteMapEnd(); } } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); field.Name = "failed"; field.Type = TType.Map; field.ID = 2; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.Map, Failed.Count)); foreach (string _iter121 in Failed.Keys) { oprot.WriteString(_iter121); { oprot.WriteMapBegin(new TMap(TType.String, TType.I64, Failed[_iter121].Count)); foreach (string _iter122 in Failed[_iter121].Keys) { oprot.WriteString(_iter122); oprot.WriteI64(Failed[_iter121][_iter122]); } oprot.WriteMapEnd(); } } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); field.Name = "complete_ms_avg"; field.Type = TType.Map; field.ID = 3; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.Map, Complete_ms_avg.Count)); foreach (string _iter123 in Complete_ms_avg.Keys) { oprot.WriteString(_iter123); { oprot.WriteMapBegin(new TMap(TType.String, TType.Double, Complete_ms_avg[_iter123].Count)); foreach (string _iter124 in Complete_ms_avg[_iter123].Keys) { oprot.WriteString(_iter124); oprot.WriteDouble(Complete_ms_avg[_iter123][_iter124]); } oprot.WriteMapEnd(); } } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
public void Read(TProtocol iprot) { bool isset_uuidFicha = false; bool isset_headerTransport = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { UuidFicha = iprot.ReadString(); isset_uuidFicha = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { TpCdsOrigem = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Struct) { HeaderTransport = new br.gov.saude.esus.cds.transport.generated.thrift.common.UnicaLotacaoHeaderThrift(); HeaderTransport.Read(iprot); isset_headerTransport = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.List) { { AtendimentosDomiciliares = new List <FichaAtendimentoDomiciliarChildThrift>(); TList _list12 = iprot.ReadListBegin(); for (int _i13 = 0; _i13 < _list12.Count; ++_i13) { FichaAtendimentoDomiciliarChildThrift _elem14; _elem14 = new FichaAtendimentoDomiciliarChildThrift(); _elem14.Read(iprot); AtendimentosDomiciliares.Add(_elem14); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_uuidFicha) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_headerTransport) { throw new TProtocolException(TProtocolException.INVALID_DATA); } }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("ProductList"); oprot.WriteStructBegin(struc); TField field = new TField(); if (__isset.hasNext) { field.Name = "hasNext"; field.Type = TType.Bool; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteBool(HasNext); oprot.WriteFieldEnd(); } if (__isset.bannerSequence) { field.Name = "bannerSequence"; field.Type = TType.I64; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI64(BannerSequence); oprot.WriteFieldEnd(); } if (__isset.bannerTargetType) { field.Name = "bannerTargetType"; field.Type = TType.I32; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteI32((int)BannerTargetType); oprot.WriteFieldEnd(); } if (BannerTargetPath != null && __isset.bannerTargetPath) { field.Name = "bannerTargetPath"; field.Type = TType.String; field.ID = 6; oprot.WriteFieldBegin(field); oprot.WriteString(BannerTargetPath); oprot.WriteFieldEnd(); } if (ProductList_ != null && __isset.productList_) { field.Name = "productList_"; field.Type = TType.List; field.ID = 7; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.Struct, ProductList_.Count)); foreach (Product _iter37 in ProductList_) { _iter37.Write(oprot); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } if (BannerLang != null && __isset.bannerLang) { field.Name = "bannerLang"; field.Type = TType.String; field.ID = 8; oprot.WriteFieldBegin(field); oprot.WriteString(BannerLang); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Bool) { HasNext = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I64) { BannerSequence = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I32) { BannerTargetType = (ProductBannerLinkType)iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.String) { BannerTargetPath = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.List) { { ProductList_ = new List <Product>(); TList _list34 = iprot.ReadListBegin(); for (int _i35 = 0; _i35 < _list34.Count; ++_i35) { Product _elem36 = new Product(); _elem36 = new Product(); _elem36.Read(iprot); ProductList_.Add(_elem36); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.String) { BannerLang = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
protected override void AssignAccess(TProtocol protocol) { this.Access = new MMIServiceBase.Client(protocol); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Key = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { Targets = new List <NotificationTarget>(); TList _list217 = iprot.ReadListBegin(); for (int _i218 = 0; _i218 < _list217.Count; ++_i218) { NotificationTarget _elem219; _elem219 = new NotificationTarget(); _elem219.Read(iprot); Targets.Add(_elem219); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I64) { CreatedTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I64) { Data = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I32) { MaxDelay = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("GlobalEvent"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Key != null && __isset.key) { field.Name = "key"; field.Type = TType.String; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteString(Key); oprot.WriteFieldEnd(); } if (Targets != null && __isset.targets) { field.Name = "targets"; field.Type = TType.List; field.ID = 2; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.Struct, Targets.Count)); foreach (NotificationTarget _iter220 in Targets) { _iter220.Write(oprot); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } if (__isset.createdTime) { field.Name = "createdTime"; field.Type = TType.I64; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteI64(CreatedTime); oprot.WriteFieldEnd(); } if (__isset.data) { field.Name = "data"; field.Type = TType.I64; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI64(Data); oprot.WriteFieldEnd(); } if (__isset.maxDelay) { field.Name = "maxDelay"; field.Type = TType.I32; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteI32(MaxDelay); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public Task<object> CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken) { callCount++; return Task.FromResult<object>(null); }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("Price"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Id != null) { field.Name = "id"; field.Type = TType.I32; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteI32(Id.Value); oprot.WriteFieldEnd(); } if (Description != null) { field.Name = "description"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteString(Description); oprot.WriteFieldEnd(); } if (PricePerUnit != null) { field.Name = "pricePerUnit"; field.Type = TType.Struct; field.ID = 3; oprot.WriteFieldBegin(field); PricePerUnit.Write(oprot); oprot.WriteFieldEnd(); } if (UnitId != null) { field.Name = "unitId"; field.Type = TType.I32; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI32(UnitId.Value); oprot.WriteFieldEnd(); } if (UnitDescription != null) { field.Name = "unitDescription"; field.Type = TType.String; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteString(UnitDescription); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("Partition"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Values != null && __isset.values) { field.Name = "values"; field.Type = TType.List; field.ID = 1; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.String, Values.Count)); foreach (string _iter82 in Values) { oprot.WriteString(_iter82); oprot.WriteListEnd(); } } oprot.WriteFieldEnd(); } if (DbName != null && __isset.dbName) { field.Name = "dbName"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteString(DbName); oprot.WriteFieldEnd(); } if (TableName != null && __isset.tableName) { field.Name = "tableName"; field.Type = TType.String; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteString(TableName); oprot.WriteFieldEnd(); } if (__isset.createTime) { field.Name = "createTime"; field.Type = TType.I32; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI32(CreateTime); oprot.WriteFieldEnd(); } if (__isset.lastAccessTime) { field.Name = "lastAccessTime"; field.Type = TType.I32; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteI32(LastAccessTime); oprot.WriteFieldEnd(); } if (Sd != null && __isset.sd) { field.Name = "sd"; field.Type = TType.Struct; field.ID = 6; oprot.WriteFieldBegin(field); Sd.Write(oprot); oprot.WriteFieldEnd(); } if (Parameters != null && __isset.parameters) { field.Name = "parameters"; field.Type = TType.Map; field.ID = 7; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.String, Parameters.Count)); foreach (string _iter83 in Parameters.Keys) { oprot.WriteString(_iter83); oprot.WriteString(Parameters[_iter83]); oprot.WriteMapEnd(); } } oprot.WriteFieldEnd(); } if (Privileges != null && __isset.privileges) { field.Name = "privileges"; field.Type = TType.Struct; field.ID = 8; oprot.WriteFieldBegin(field); Privileges.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { Id = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { Description = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Struct) { PricePerUnit = new PricePerUnit(); PricePerUnit.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { UnitId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.String) { UnitDescription = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("SearchItemUnion"); oprot.WriteStructBegin(struc); TField field = new TField(); if (CategoryItem != null && __isset.categoryItem) { field.Name = "categoryItem"; field.Type = TType.Struct; field.ID = 1; oprot.WriteFieldBegin(field); CategoryItem.Write(oprot); oprot.WriteFieldEnd(); } if (SpotItem != null && __isset.spotItem) { field.Name = "spotItem"; field.Type = TType.Struct; field.ID = 2; oprot.WriteFieldBegin(field); SpotItem.Write(oprot); oprot.WriteFieldEnd(); } if (ProductItem != null && __isset.productItem) { field.Name = "productItem"; field.Type = TType.Struct; field.ID = 3; oprot.WriteFieldBegin(field); ProductItem.Write(oprot); oprot.WriteFieldEnd(); } if (ServiceItem != null && __isset.serviceItem) { field.Name = "serviceItem"; field.Type = TType.Struct; field.ID = 4; oprot.WriteFieldBegin(field); ServiceItem.Write(oprot); oprot.WriteFieldEnd(); } if (YellowpageItem != null && __isset.yellowpageItem) { field.Name = "yellowpageItem"; field.Type = TType.Struct; field.ID = 5; oprot.WriteFieldBegin(field); YellowpageItem.Write(oprot); oprot.WriteFieldEnd(); } if (OaItem != null && __isset.oaItem) { field.Name = "oaItem"; field.Type = TType.Struct; field.ID = 6; oprot.WriteFieldBegin(field); OaItem.Write(oprot); oprot.WriteFieldEnd(); } if (GeoAddressItem != null && __isset.geoAddressItem) { field.Name = "geoAddressItem"; field.Type = TType.Struct; field.ID = 7; oprot.WriteFieldBegin(field); GeoAddressItem.Write(oprot); oprot.WriteFieldEnd(); } if (ShortcutItem != null && __isset.shortcutItem) { field.Name = "shortcutItem"; field.Type = TType.Struct; field.ID = 8; oprot.WriteFieldBegin(field); ShortcutItem.Write(oprot); oprot.WriteFieldEnd(); } if (SquareItem != null && __isset.squareItem) { field.Name = "squareItem"; field.Type = TType.Struct; field.ID = 9; oprot.WriteFieldBegin(field); SquareItem.Write(oprot); oprot.WriteFieldEnd(); } if (SquareCategoryItem != null && __isset.squareCategoryItem) { field.Name = "squareCategoryItem"; field.Type = TType.Struct; field.ID = 10; oprot.WriteFieldBegin(field); SquareCategoryItem.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Moves = new List <event_move>(); TList _list0 = iprot.ReadListBegin(); for (int _i1 = 0; _i1 < _list0.Count; ++_i1) { event_move _elem2; _elem2 = new event_move(); _elem2.Read(iprot); Moves.Add(_elem2); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { Messages = new List <string>(); TList _list3 = iprot.ReadListBegin(); for (int _i4 = 0; _i4 < _list3.Count; ++_i4) { string _elem5; _elem5 = iprot.ReadString(); Messages.Add(_elem5); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { bool isset_dbName = false; bool isset_tblName = false; bool isset_colNames = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { DbName = iprot.ReadString(); isset_dbName = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { TblName = iprot.ReadString(); isset_tblName = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.List) { { ColNames = new List <string>(); TList _list161 = iprot.ReadListBegin(); for (int _i162 = 0; _i162 < _list161.Count; ++_i162) { string _elem163 = null; _elem163 = iprot.ReadString(); ColNames.Add(_elem163); } iprot.ReadListEnd(); } isset_colNames = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_dbName) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_tblName) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_colNames) { throw new TProtocolException(TProtocolException.INVALID_DATA); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { bool isset_updateSequenceNum = false; bool isset_updated = false; bool isset_saved = false; bool isset_title = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { UpdateSequenceNum = iprot.ReadI32(); isset_updateSequenceNum = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I64) { Updated = iprot.ReadI64(); isset_updated = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I64) { Saved = iprot.ReadI64(); isset_saved = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { Title = iprot.ReadString(); isset_title = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I32) { LastEditorId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_updateSequenceNum) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field UpdateSequenceNum not set"); } if (!isset_updated) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Updated not set"); } if (!isset_saved) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Saved not set"); } if (!isset_title) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Title not set"); } } finally { iprot.DecrementRecursionDepth(); } }
public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { oprot.IncrementRecursionDepth(); try { var struc = new TStruct("FileMetaData"); await oprot.WriteStructBeginAsync(struc, cancellationToken); var field = new TField(); field.Name = "version"; field.Type = TType.I32; field.ID = 1; await oprot.WriteFieldBeginAsync(field, cancellationToken); await oprot.WriteI32Async(Version, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); field.Name = "schema"; field.Type = TType.List; field.ID = 2; await oprot.WriteFieldBeginAsync(field, cancellationToken); { await oprot.WriteListBeginAsync(new TList(TType.Struct, Schema.Count), cancellationToken); foreach (SchemaElement _iter56 in Schema) { await _iter56.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); } await oprot.WriteFieldEndAsync(cancellationToken); field.Name = "num_rows"; field.Type = TType.I64; field.ID = 3; await oprot.WriteFieldBeginAsync(field, cancellationToken); await oprot.WriteI64Async(Num_rows, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); field.Name = "row_groups"; field.Type = TType.List; field.ID = 4; await oprot.WriteFieldBeginAsync(field, cancellationToken); { await oprot.WriteListBeginAsync(new TList(TType.Struct, Row_groups.Count), cancellationToken); foreach (RowGroup _iter57 in Row_groups) { await _iter57.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); } await oprot.WriteFieldEndAsync(cancellationToken); if (Key_value_metadata != null && __isset.key_value_metadata) { field.Name = "key_value_metadata"; field.Type = TType.List; field.ID = 5; await oprot.WriteFieldBeginAsync(field, cancellationToken); { await oprot.WriteListBeginAsync(new TList(TType.Struct, Key_value_metadata.Count), cancellationToken); foreach (KeyValue _iter58 in Key_value_metadata) { await _iter58.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); } await oprot.WriteFieldEndAsync(cancellationToken); } if (Created_by != null && __isset.created_by) { field.Name = "created_by"; field.Type = TType.String; field.ID = 6; await oprot.WriteFieldBeginAsync(field, cancellationToken); await oprot.WriteStringAsync(Created_by, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (Column_orders != null && __isset.column_orders) { field.Name = "column_orders"; field.Type = TType.List; field.ID = 7; await oprot.WriteFieldBeginAsync(field, cancellationToken); { await oprot.WriteListBeginAsync(new TList(TType.Struct, Column_orders.Count), cancellationToken); foreach (ColumnOrder _iter59 in Column_orders) { await _iter59.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); } await oprot.WriteFieldEndAsync(cancellationToken); } await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); } finally { oprot.DecrementRecursionDepth(); } }
private static async Task RunClientAsync(TProtocol protocol, CancellationToken cancellationToken) { try { var client = new Calculator.Client(protocol); await client.OpenTransportAsync(cancellationToken); try { // Async version Logger.LogInformation("PingAsync()"); await client.pingAsync(cancellationToken); Logger.LogInformation("AddAsync(1,1)"); var sum = await client.addAsync(1, 1, cancellationToken); Logger.LogInformation($"AddAsync(1,1)={sum}"); var work = new Work { Op = Operation.DIVIDE, Num1 = 1, Num2 = 0 }; try { Logger.LogInformation("CalculateAsync(1)"); await client.calculateAsync(1, work, cancellationToken); Logger.LogInformation("Whoa we can divide by 0"); } catch (InvalidOperation io) { Logger.LogInformation("Invalid operation: " + io); } work.Op = Operation.SUBTRACT; work.Num1 = 15; work.Num2 = 10; try { Logger.LogInformation("CalculateAsync(1)"); var diff = await client.calculateAsync(1, work, cancellationToken); Logger.LogInformation($"15-10={diff}"); } catch (InvalidOperation io) { Logger.LogInformation("Invalid operation: " + io); } Logger.LogInformation("GetStructAsync(1)"); var log = await client.getStructAsync(1, cancellationToken); Logger.LogInformation($"Check log: {log.Value}"); Logger.LogInformation("ZipAsync() with delay 100mc on server side"); await client.zipAsync(cancellationToken); } catch (Exception ex) { Logger.LogError(ex.ToString()); } finally { protocol.Transport.Close(); } } catch (TApplicationException x) { Logger.LogError(x.ToString()); } }
public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin) : base(protocol) { _msgBegin = messageBegin; }
public static async Task SkipAsync(TProtocol prot, TType type, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { await Task.FromCanceled(cancellationToken); } prot.IncrementRecursionDepth(); try { switch (type) { case TType.Bool: await prot.ReadBoolAsync(cancellationToken); break; case TType.Byte: await prot.ReadByteAsync(cancellationToken); break; case TType.I16: await prot.ReadI16Async(cancellationToken); break; case TType.I32: await prot.ReadI32Async(cancellationToken); break; case TType.I64: await prot.ReadI64Async(cancellationToken); break; case TType.Double: await prot.ReadDoubleAsync(cancellationToken); break; case TType.String: // Don't try to decode the string, just skip it. await prot.ReadBinaryAsync(cancellationToken); break; case TType.Struct: await prot.ReadStructBeginAsync(cancellationToken); while (true) { var field = await prot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } await SkipAsync(prot, field.Type, cancellationToken); await prot.ReadFieldEndAsync(cancellationToken); } await prot.ReadStructEndAsync(cancellationToken); break; case TType.Map: var map = await prot.ReadMapBeginAsync(cancellationToken); for (var i = 0; i < map.Count; i++) { await SkipAsync(prot, map.KeyType, cancellationToken); await SkipAsync(prot, map.ValueType, cancellationToken); } await prot.ReadMapEndAsync(cancellationToken); break; case TType.Set: var set = await prot.ReadSetBeginAsync(cancellationToken); for (var i = 0; i < set.Count; i++) { await SkipAsync(prot, set.ElementType, cancellationToken); } await prot.ReadSetEndAsync(cancellationToken); break; case TType.List: var list = await prot.ReadListBeginAsync(cancellationToken); for (var i = 0; i < list.Count; i++) { await SkipAsync(prot, list.ElementType, cancellationToken); } await prot.ReadListEndAsync(cancellationToken); break; default: throw new TProtocolException(TProtocolException.INVALID_DATA, "Unknown data type " + type.ToString("d")); } } finally { prot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Id = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { Name = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { SeatCount = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { SubSeatCount = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I32) { BedCount = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.I32) { SubBedCount = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { PayCoin = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { FreeCoin = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { Type = (PayloadType)iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { RewardCoin = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("TBus"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Id != null && __isset.Id) { field.Name = "Id"; field.Type = TType.String; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteString(Id); oprot.WriteFieldEnd(); } if (Name != null && __isset.name) { field.Name = "name"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteString(Name); oprot.WriteFieldEnd(); } if (__isset.SeatCount) { field.Name = "SeatCount"; field.Type = TType.I32; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteI32(SeatCount); oprot.WriteFieldEnd(); } if (__isset.SubSeatCount) { field.Name = "SubSeatCount"; field.Type = TType.I32; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI32(SubSeatCount); oprot.WriteFieldEnd(); } if (__isset.BedCount) { field.Name = "BedCount"; field.Type = TType.I32; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteI32(BedCount); oprot.WriteFieldEnd(); } if (__isset.SubBedCount) { field.Name = "SubBedCount"; field.Type = TType.I32; field.ID = 6; oprot.WriteFieldBegin(field); oprot.WriteI32(SubBedCount); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I64) { SubjectDate = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Double) { Latitude = iprot.ReadDouble(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.Double) { Longitude = iprot.ReadDouble(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.Double) { Altitude = iprot.ReadDouble(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 13: if (field.Type == TType.String) { Author = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 14: if (field.Type == TType.String) { Source = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 15: if (field.Type == TType.String) { SourceURL = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 16: if (field.Type == TType.String) { SourceApplication = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 17: if (field.Type == TType.I64) { ShareDate = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 18: if (field.Type == TType.I64) { ReminderOrder = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 19: if (field.Type == TType.I64) { ReminderDoneTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 20: if (field.Type == TType.I64) { ReminderTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 21: if (field.Type == TType.String) { PlaceName = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 22: if (field.Type == TType.String) { ContentClass = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 23: if (field.Type == TType.Struct) { ApplicationData = new LazyMap(); ApplicationData.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 24: if (field.Type == TType.String) { LastEditedBy = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 26: if (field.Type == TType.Map) { { Classifications = new Dictionary <string, string>(); TMap _map17 = iprot.ReadMapBegin(); for (int _i18 = 0; _i18 < _map17.Count; ++_i18) { string _key19; string _val20; _key19 = iprot.ReadString(); _val20 = iprot.ReadString(); Classifications[_key19] = _val20; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 27: if (field.Type == TType.I32) { CreatorId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 28: if (field.Type == TType.I32) { LastEditorId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
/** * Wrap the specified protocol, allowing it to be used to communicate with a * multiplexing server. The <code>serviceName</code> is required as it is * prepended to the message header so that the multiplexing server can broker * the function call to the proper service. * * Args: * protocol Your communication protocol of choice, e.g. TBinaryProtocol * serviceName The service name of the service communicating via this protocol. */ public TMultiplexedProtocol(TProtocol protocol, string serviceName) : base(protocol) { _serviceName = serviceName; }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("NoteAttributes"); oprot.WriteStructBegin(struc); TField field = new TField(); if (__isset.subjectDate) { field.Name = "subjectDate"; field.Type = TType.I64; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteI64(SubjectDate); oprot.WriteFieldEnd(); } if (__isset.latitude) { field.Name = "latitude"; field.Type = TType.Double; field.ID = 10; oprot.WriteFieldBegin(field); oprot.WriteDouble(Latitude); oprot.WriteFieldEnd(); } if (__isset.longitude) { field.Name = "longitude"; field.Type = TType.Double; field.ID = 11; oprot.WriteFieldBegin(field); oprot.WriteDouble(Longitude); oprot.WriteFieldEnd(); } if (__isset.altitude) { field.Name = "altitude"; field.Type = TType.Double; field.ID = 12; oprot.WriteFieldBegin(field); oprot.WriteDouble(Altitude); oprot.WriteFieldEnd(); } if (Author != null && __isset.author) { field.Name = "author"; field.Type = TType.String; field.ID = 13; oprot.WriteFieldBegin(field); oprot.WriteString(Author); oprot.WriteFieldEnd(); } if (Source != null && __isset.source) { field.Name = "source"; field.Type = TType.String; field.ID = 14; oprot.WriteFieldBegin(field); oprot.WriteString(Source); oprot.WriteFieldEnd(); } if (SourceURL != null && __isset.sourceURL) { field.Name = "sourceURL"; field.Type = TType.String; field.ID = 15; oprot.WriteFieldBegin(field); oprot.WriteString(SourceURL); oprot.WriteFieldEnd(); } if (SourceApplication != null && __isset.sourceApplication) { field.Name = "sourceApplication"; field.Type = TType.String; field.ID = 16; oprot.WriteFieldBegin(field); oprot.WriteString(SourceApplication); oprot.WriteFieldEnd(); } if (__isset.shareDate) { field.Name = "shareDate"; field.Type = TType.I64; field.ID = 17; oprot.WriteFieldBegin(field); oprot.WriteI64(ShareDate); oprot.WriteFieldEnd(); } if (__isset.reminderOrder) { field.Name = "reminderOrder"; field.Type = TType.I64; field.ID = 18; oprot.WriteFieldBegin(field); oprot.WriteI64(ReminderOrder); oprot.WriteFieldEnd(); } if (__isset.reminderDoneTime) { field.Name = "reminderDoneTime"; field.Type = TType.I64; field.ID = 19; oprot.WriteFieldBegin(field); oprot.WriteI64(ReminderDoneTime); oprot.WriteFieldEnd(); } if (__isset.reminderTime) { field.Name = "reminderTime"; field.Type = TType.I64; field.ID = 20; oprot.WriteFieldBegin(field); oprot.WriteI64(ReminderTime); oprot.WriteFieldEnd(); } if (PlaceName != null && __isset.placeName) { field.Name = "placeName"; field.Type = TType.String; field.ID = 21; oprot.WriteFieldBegin(field); oprot.WriteString(PlaceName); oprot.WriteFieldEnd(); } if (ContentClass != null && __isset.contentClass) { field.Name = "contentClass"; field.Type = TType.String; field.ID = 22; oprot.WriteFieldBegin(field); oprot.WriteString(ContentClass); oprot.WriteFieldEnd(); } if (ApplicationData != null && __isset.applicationData) { field.Name = "applicationData"; field.Type = TType.Struct; field.ID = 23; oprot.WriteFieldBegin(field); ApplicationData.Write(oprot); oprot.WriteFieldEnd(); } if (LastEditedBy != null && __isset.lastEditedBy) { field.Name = "lastEditedBy"; field.Type = TType.String; field.ID = 24; oprot.WriteFieldBegin(field); oprot.WriteString(LastEditedBy); oprot.WriteFieldEnd(); } if (Classifications != null && __isset.classifications) { field.Name = "classifications"; field.Type = TType.Map; field.ID = 26; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.String, Classifications.Count)); foreach (string _iter21 in Classifications.Keys) { oprot.WriteString(_iter21); oprot.WriteString(Classifications[_iter21]); oprot.WriteMapEnd(); } } oprot.WriteFieldEnd(); } if (__isset.creatorId) { field.Name = "creatorId"; field.Type = TType.I32; field.ID = 27; oprot.WriteFieldBegin(field); oprot.WriteI32(CreatorId); oprot.WriteFieldEnd(); } if (__isset.lastEditorId) { field.Name = "lastEditorId"; field.Type = TType.I32; field.ID = 28; oprot.WriteFieldBegin(field); oprot.WriteI32(LastEditorId); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
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 async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { ReqSeq = await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.Struct) { SquareChat = new SquareChat(); await SquareChat.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.List) { { TList _list292 = await iprot.ReadListBeginAsync(cancellationToken); SquareMemberMids = new List <string>(_list292.Count); for (int _i293 = 0; _i293 < _list292.Count; ++_i293) { string _elem294; _elem294 = await iprot.ReadStringAsync(cancellationToken); SquareMemberMids.Add(_elem294); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); } finally { iprot.DecrementRecursionDepth(); } }
public static void Skip(TProtocol prot, TType type) { switch (type) { case TType.Bool: prot.ReadBool(); break; case TType.Byte: prot.ReadByte(); break; case TType.I16: prot.ReadI16(); break; case TType.I32: prot.ReadI32(); break; case TType.I64: prot.ReadI64(); break; case TType.Double: prot.ReadDouble(); break; case TType.String: // Don't try to decode the string, just skip it. prot.ReadBinary(); break; case TType.Struct: prot.ReadStructBegin(); while (true) { TField field = prot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } Skip(prot, field.Type); prot.ReadFieldEnd(); } prot.ReadStructEnd(); break; case TType.Map: TMap map = prot.ReadMapBegin(); for (int i = 0; i < map.Count; i++) { Skip(prot, map.KeyType); Skip(prot, map.ValueType); } prot.ReadMapEnd(); break; case TType.Set: TSet set = prot.ReadSetBegin(); for (int i = 0; i < set.Count; i++) { Skip(prot, set.ElementType); } prot.ReadSetEnd(); break; case TType.List: TList list = prot.ReadListBegin(); for (int i = 0; i < list.Count; i++) { Skip(prot, list.ElementType); } prot.ReadListEnd(); break; } }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Values = new List <string>(); TList _list75 = iprot.ReadListBegin(); for (int _i76 = 0; _i76 < _list75.Count; ++_i76) { string _elem77 = null; _elem77 = iprot.ReadString(); Values.Add(_elem77); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { DbName = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { TableName = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { CreateTime = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I32) { LastAccessTime = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Struct) { Sd = new StorageDescriptor(); Sd.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Map) { { Parameters = new Dictionary <string, string>(); TMap _map78 = iprot.ReadMapBegin(); for (int _i79 = 0; _i79 < _map78.Count; ++_i79) { string _key80; string _val81; _key80 = iprot.ReadString(); _val81 = iprot.ReadString(); Parameters[_key80] = _val81; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Struct) { Privileges = new PrincipalPrivilegeSet(); Privileges.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output, CancellationToken cancellationToken) { callCount++; return Task.CompletedTask; }
public uint Read(TProtocol iprot) { return((uint)iprot.ReadI32()); }