public static String32 Decode(XdrDataInputStream stream) { String32 decodedString32 = new String32(); decodedString32.InnerValue = stream.ReadString(); return(decodedString32); }
public static void Encode(XdrDataOutputStream stream, AccountEntry encodedAccountEntry) { AccountID.Encode(stream, encodedAccountEntry.AccountID); Int64.Encode(stream, encodedAccountEntry.Balance); SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum); Uint32.Encode(stream, encodedAccountEntry.NumSubEntries); if (encodedAccountEntry.InflationDest != null) { stream.WriteInt(1); AccountID.Encode(stream, encodedAccountEntry.InflationDest); } else { stream.WriteInt(0); } Uint32.Encode(stream, encodedAccountEntry.Flags); String32.Encode(stream, encodedAccountEntry.HomeDomain); Thresholds.Encode(stream, encodedAccountEntry.Thresholds); int signerssize = encodedAccountEntry.Signers.Length; stream.WriteInt(signerssize); for (int i = 0; i < signerssize; i++) { Signer.Encode(stream, encodedAccountEntry.Signers[i]); } AccountEntryExt.Encode(stream, encodedAccountEntry.Ext); }
public static AccountEntry Decode(XdrDataInputStream stream) { AccountEntry decodedAccountEntry = new AccountEntry(); decodedAccountEntry.AccountID = AccountID.Decode(stream); decodedAccountEntry.Balance = Int64.Decode(stream); decodedAccountEntry.SeqNum = SequenceNumber.Decode(stream); decodedAccountEntry.NumSubEntries = Uint32.Decode(stream); int InflationDestPresent = stream.ReadInt(); if (InflationDestPresent != 0) { decodedAccountEntry.InflationDest = AccountID.Decode(stream); } decodedAccountEntry.Flags = Uint32.Decode(stream); decodedAccountEntry.HomeDomain = String32.Decode(stream); decodedAccountEntry.Thresholds = Thresholds.Decode(stream); int signerssize = stream.ReadInt(); decodedAccountEntry.Signers = new Signer[signerssize]; for (int i = 0; i < signerssize; i++) { decodedAccountEntry.Signers[i] = Signer.Decode(stream); } decodedAccountEntry.Ext = AccountEntryExt.Decode(stream); return(decodedAccountEntry); }
public static SetOptionsOp Decode(XdrDataInputStream stream) { SetOptionsOp decodedSetOptionsOp = new SetOptionsOp(); int InflationDestPresent = stream.ReadInt(); if (InflationDestPresent != 0) { decodedSetOptionsOp.InflationDest = AccountID.Decode(stream); } int ClearFlagsPresent = stream.ReadInt(); if (ClearFlagsPresent != 0) { decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream); } int SetFlagsPresent = stream.ReadInt(); if (SetFlagsPresent != 0) { decodedSetOptionsOp.SetFlags = Uint32.Decode(stream); } int MasterWeightPresent = stream.ReadInt(); if (MasterWeightPresent != 0) { decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream); } int LowThresholdPresent = stream.ReadInt(); if (LowThresholdPresent != 0) { decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream); } int MedThresholdPresent = stream.ReadInt(); if (MedThresholdPresent != 0) { decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream); } int HighThresholdPresent = stream.ReadInt(); if (HighThresholdPresent != 0) { decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream); } int HomeDomainPresent = stream.ReadInt(); if (HomeDomainPresent != 0) { decodedSetOptionsOp.HomeDomain = String32.Decode(stream); } int SignerPresent = stream.ReadInt(); if (SignerPresent != 0) { decodedSetOptionsOp.Signer = Signer.Decode(stream); } return(decodedSetOptionsOp); }
public static void Encode(XdrDataOutputStream stream, SetOptionsOp encodedSetOptionsOp) { if (encodedSetOptionsOp.InflationDest != null) { stream.WriteInt(1); AccountID.Encode(stream, encodedSetOptionsOp.InflationDest); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.ClearFlags != null) { stream.WriteInt(1); Uint32.Encode(stream, encodedSetOptionsOp.ClearFlags); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.SetFlags != null) { stream.WriteInt(1); Uint32.Encode(stream, encodedSetOptionsOp.SetFlags); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.MasterWeight != null) { stream.WriteInt(1); Uint32.Encode(stream, encodedSetOptionsOp.MasterWeight); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.LowThreshold != null) { stream.WriteInt(1); Uint32.Encode(stream, encodedSetOptionsOp.LowThreshold); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.MedThreshold != null) { stream.WriteInt(1); Uint32.Encode(stream, encodedSetOptionsOp.MedThreshold); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.HighThreshold != null) { stream.WriteInt(1); Uint32.Encode(stream, encodedSetOptionsOp.HighThreshold); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.HomeDomain != null) { stream.WriteInt(1); String32.Encode(stream, encodedSetOptionsOp.HomeDomain); } else { stream.WriteInt(0); } if (encodedSetOptionsOp.Signer != null) { stream.WriteInt(1); Signer.Encode(stream, encodedSetOptionsOp.Signer); } else { stream.WriteInt(0); } }
public static void Encode(XdrDataOutputStream stream, String32 encodedString32) { stream.WriteString(encodedString32.InnerValue); }
public override sdkxdr.Operation.OperationBody ToOperationBody() { var op = new sdkxdr.SetOptionsOp(); if (InflationDestination != null) { var inflationDestination = new sdkxdr.AccountID(); inflationDestination.InnerValue = InflationDestination.XdrPublicKey; op.InflationDest = inflationDestination; } if (ClearFlags != null) { var clearFlags = new sdkxdr.Uint32(); clearFlags.InnerValue = ClearFlags.Value; op.ClearFlags = clearFlags; } if (SetFlags != null) { var setFlags = new sdkxdr.Uint32(); setFlags.InnerValue = SetFlags.Value; op.SetFlags = setFlags; } if (MasterKeyWeight != null) { var uint32 = new sdkxdr.Uint32(); uint32.InnerValue = MasterKeyWeight.Value; op.MasterWeight = uint32; } if (LowThreshold != null) { var uint32 = new sdkxdr.Uint32(); uint32.InnerValue = LowThreshold.Value; op.LowThreshold = uint32; } if (MediumThreshold != null) { var uint32 = new sdkxdr.Uint32(); uint32.InnerValue = MediumThreshold.Value; op.MedThreshold = uint32; } if (HighThreshold != null) { var uint32 = new sdkxdr.Uint32(); uint32.InnerValue = HighThreshold.Value; op.HighThreshold = uint32; } if (HomeDomain != null) { var homeDomain = new sdkxdr.String32(); homeDomain.InnerValue = HomeDomain; op.HomeDomain = homeDomain; } if (Signer != null) { var signer = new sdkxdr.Signer(); var weight = new sdkxdr.Uint32(); weight.InnerValue = SignerWeight.Value & 0xFF; signer.Key = Signer; signer.Weight = weight; op.Signer = signer; } var body = new sdkxdr.Operation.OperationBody(); body.Discriminant = sdkxdr.OperationType.Create(sdkxdr.OperationType.OperationTypeEnum.SET_OPTIONS); body.SetOptionsOp = op; return(body); }