public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("Transaction"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Source != null && __isset.source) { field.Name = "source"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteBinary(Source); oprot.WriteFieldEnd(); } if (Target != null && __isset.target) { field.Name = "target"; field.Type = TType.String; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteBinary(Target); oprot.WriteFieldEnd(); } if (Amount != null && __isset.amount) { field.Name = "amount"; field.Type = TType.Struct; field.ID = 4; oprot.WriteFieldBegin(field); Amount.Write(oprot); oprot.WriteFieldEnd(); } if (Balance != null && __isset.balance) { field.Name = "balance"; field.Type = TType.Struct; field.ID = 5; oprot.WriteFieldBegin(field); Balance.Write(oprot); oprot.WriteFieldEnd(); } if (Signature != null && __isset.signature) { field.Name = "signature"; field.Type = TType.String; field.ID = 7; oprot.WriteFieldBegin(field); oprot.WriteBinary(Signature); oprot.WriteFieldEnd(); } if (SmartContract != null && __isset.smartContract) { field.Name = "smartContract"; field.Type = TType.Struct; field.ID = 8; oprot.WriteFieldBegin(field); SmartContract.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public override string ToString() { StringBuilder __sb = new StringBuilder("Transaction("); bool __first = true; if (Source != null && __isset.source) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Source: "); __sb.Append(Source); } if (Target != null && __isset.target) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Target: "); __sb.Append(Target); } if (Amount != null && __isset.amount) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Amount: "); __sb.Append(Amount == null ? "<null>" : Amount.ToString()); } if (Balance != null && __isset.balance) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Balance: "); __sb.Append(Balance == null ? "<null>" : Balance.ToString()); } if (Signature != null && __isset.signature) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Signature: "); __sb.Append(Signature); } if (SmartContract != null && __isset.smartContract) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("SmartContract: "); __sb.Append(SmartContract == null ? "<null>" : SmartContract.ToString()); } __sb.Append(")"); return(__sb.ToString()); }
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 2: if (field.Type == TType.String) { Source = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { Target = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Struct) { Amount = new Amount(); Amount.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Struct) { Balance = new Amount(); Balance.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.String) { Signature = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Struct) { SmartContract = new SmartContractInvocation(); SmartContract.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }