/** * * Autogenerated by Thrift Compiler (0.19.0) * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * */ using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Thrift; using Thrift.Collections; using Thrift.Protocol; using Thrift.Protocol.Entities; using Thrift.Protocol.Utilities; using Thrift.Transport; using Thrift.Transport.Client; using Thrift.Transport.Server; using Thrift.Processor; #pragma warning disable IDE0079 // remove unnecessary pragmas #pragma warning disable IDE0017 // object init can be simplified #pragma warning disable IDE0028 // collection init can be simplified #pragma warning disable IDE1006 // parts of the code use IDL spelling #pragma warning disable CA1822 // empty DeepCopy() methods still non-static #pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions namespace Echo.ThriftModel { public partial class Attachment : TBase { private string _name; private string _mimeType; private byte[] _data; public string Name { get { return _name; } set { __isset.@name = true; this._name = value; } } public string MimeType { get { return _mimeType; } set { __isset.mimeType = true; this._mimeType = value; } } public byte[] Data { get { return _data; } set { __isset.@data = true; this._data = value; } } public Isset __isset; public struct Isset { public bool @name; public bool mimeType; public bool @data; } public Attachment() { } public Attachment DeepCopy() { var tmp50 = new Attachment(); if((Name != null) && __isset.@name) { tmp50.Name = this.Name; } tmp50.__isset.@name = this.__isset.@name; if((MimeType != null) && __isset.mimeType) { tmp50.MimeType = this.MimeType; } tmp50.__isset.mimeType = this.__isset.mimeType; if((Data != null) && __isset.@data) { tmp50.Data = this.Data.ToArray(); } tmp50.__isset.@data = this.__isset.@data; return tmp50; } public async global::System.Threading.Tasks.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.String) { Name = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.String) { MimeType = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.String) { Data = await iprot.ReadBinaryAsync(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 async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { oprot.IncrementRecursionDepth(); try { var tmp51 = new TStruct("Attachment"); await oprot.WriteStructBeginAsync(tmp51, cancellationToken); var tmp52 = new TField(); if((Name != null) && __isset.@name) { tmp52.Name = "name"; tmp52.Type = TType.String; tmp52.ID = 1; await oprot.WriteFieldBeginAsync(tmp52, cancellationToken); await oprot.WriteStringAsync(Name, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((MimeType != null) && __isset.mimeType) { tmp52.Name = "mimeType"; tmp52.Type = TType.String; tmp52.ID = 2; await oprot.WriteFieldBeginAsync(tmp52, cancellationToken); await oprot.WriteStringAsync(MimeType, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Data != null) && __isset.@data) { tmp52.Name = "data"; tmp52.Type = TType.String; tmp52.ID = 3; await oprot.WriteFieldBeginAsync(tmp52, cancellationToken); await oprot.WriteBinaryAsync(Data, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); } finally { oprot.DecrementRecursionDepth(); } } public override bool Equals(object that) { if (!(that is Attachment other)) return false; if (ReferenceEquals(this, other)) return true; return ((__isset.@name == other.__isset.@name) && ((!__isset.@name) || (global::System.Object.Equals(Name, other.Name)))) && ((__isset.mimeType == other.__isset.mimeType) && ((!__isset.mimeType) || (global::System.Object.Equals(MimeType, other.MimeType)))) && ((__isset.@data == other.__isset.@data) && ((!__isset.@data) || (TCollections.Equals(Data, other.Data)))); } public override int GetHashCode() { int hashcode = 157; unchecked { if((Name != null) && __isset.@name) { hashcode = (hashcode * 397) + Name.GetHashCode(); } if((MimeType != null) && __isset.mimeType) { hashcode = (hashcode * 397) + MimeType.GetHashCode(); } if((Data != null) && __isset.@data) { hashcode = (hashcode * 397) + Data.GetHashCode(); } } return hashcode; } public override string ToString() { var tmp53 = new StringBuilder("Attachment("); int tmp54 = 0; if((Name != null) && __isset.@name) { if(0 < tmp54++) { tmp53.Append(", "); } tmp53.Append("Name: "); Name.ToString(tmp53); } if((MimeType != null) && __isset.mimeType) { if(0 < tmp54++) { tmp53.Append(", "); } tmp53.Append("MimeType: "); MimeType.ToString(tmp53); } if((Data != null) && __isset.@data) { if(0 < tmp54++) { tmp53.Append(", "); } tmp53.Append("Data: "); Data.ToString(tmp53); } tmp53.Append(')'); return tmp53.ToString(); } } }