public static SCPStatement Decode(IByteReader stream) { SCPStatement decodedSCPStatement = new SCPStatement(); decodedSCPStatement.NodeID = NodeID.Decode(stream); decodedSCPStatement.SlotIndex = Uint64.Decode(stream); decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); return decodedSCPStatement; }
public static SCPEnvelope Decode(XdrDataInputStream stream) { var decodedSCPEnvelope = new SCPEnvelope(); decodedSCPEnvelope.Statement = SCPStatement.Decode(stream); decodedSCPEnvelope.Signature = Signature.Decode(stream); return(decodedSCPEnvelope); }
public static SCPEnvelope Decode(IByteReader stream) { SCPEnvelope decodedSCPEnvelope = new SCPEnvelope(); decodedSCPEnvelope.Statement = SCPStatement.Decode(stream); decodedSCPEnvelope.Signature = Signature.Decode(stream); return(decodedSCPEnvelope); }
public static SCPStatement Decode(XdrDataInputStream stream) { var decodedSCPStatement = new SCPStatement(); decodedSCPStatement.NodeID = NodeID.Decode(stream); decodedSCPStatement.SlotIndex = Uint64.Decode(stream); decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); return(decodedSCPStatement); }
public static SCPStatement Decode(IByteReader stream) { SCPStatement decodedSCPStatement = new SCPStatement(); decodedSCPStatement.NodeID = NodeID.Decode(stream); decodedSCPStatement.SlotIndex = Uint64.Decode(stream); decodedSCPStatement.Pledges = SCPStatementPledges.Decode(stream); return(decodedSCPStatement); }
protected override int _Read(byte[] buffer, int offset) { int startsize = Marshal.SizeOf(_Confirmed) + SCPDate.Size + SCPTime.Size + Marshal.SizeOf(_NrStatements); int end = offset - Size + Length; if ((offset + startsize) > end) { return(0x1); } _Confirmed = (byte)BytesTool.readBytes(buffer, offset, Marshal.SizeOf(_Confirmed), true); offset += Marshal.SizeOf(_Confirmed); _Date = new SCPDate(); _Date.Read(buffer, offset); offset += SCPDate.Size; _Time = new SCPTime(); _Time.Read(buffer, offset); offset += SCPTime.Size; _NrStatements = (byte)BytesTool.readBytes(buffer, offset, Marshal.SizeOf(_NrStatements), true); offset += Marshal.SizeOf(_NrStatements); if (_NrStatements > 0) { _Statements = new SCPStatement[_NrStatements]; int loper = 0; for (; loper < _NrStatements; loper++) { _Statements[loper] = new SCPStatement(); int err = _Statements[loper].Read(buffer, offset); if (err != 0) { return(0x2); } offset += _Statements[loper].getLength(); } if (loper != _NrStatements) { _NrStatements = (byte)loper; return(0x4); } } return(0x0); }
// setting diagnositc information. public int setDiagnosticStatements(Statements stat) { if ((stat != null) && (stat.time.Year > 1000) && (stat.statement != null) && (stat.statement.Length > 0)) { Empty(); _Confirmed = (byte)(stat.confirmed ? 1 : 0); if (stat.time == DateTime.MinValue) { _Date = new SCPDate(); _Time = new SCPTime(); } else { _Date = new SCPDate(stat.time.Year, stat.time.Month, stat.time.Day); _Time = new SCPTime(stat.time.Hour, stat.time.Minute, stat.time.Second); } _NrStatements = (byte)stat.statement.Length; _Statements = new SCPStatement[_NrStatements]; for (int loper = 0; loper < _NrStatements; loper++) { _Statements[loper] = new SCPStatement(); _Statements[loper].SequenceNr = (byte)(loper + 1); if (stat.statement[loper] != null) { _Statements[loper].Length = (ushort)(stat.statement[loper].Length + 1); _Statements[loper].Field = new byte[_Statements[loper].Length]; BytesTool.writeString(_Encoding, stat.statement[loper], _Statements[loper].Field, 0, _Statements[loper].Length); } else { _Statements[loper].Length = 1; _Statements[loper].Field = new byte[_Statements[loper].Length]; } } return(0); } return(1); }
public static void Encode(XdrDataOutputStream stream, SCPEnvelope encodedSCPEnvelope) { SCPStatement.Encode(stream, encodedSCPEnvelope.Statement); Signature.Encode(stream, encodedSCPEnvelope.Signature); }
public static void Encode(IByteWriter stream, SCPEnvelope encodedSCPEnvelope) { SCPStatement.Encode(stream, encodedSCPEnvelope.Statement); Signature.Encode(stream, encodedSCPEnvelope.Signature); }
public static void Encode(XdrDataOutputStream stream, SCPStatement encodedSCPStatement) { NodeID.Encode(stream, encodedSCPStatement.NodeID); Uint64.Encode(stream, encodedSCPStatement.SlotIndex); SCPStatementPledges.Encode(stream, encodedSCPStatement.Pledges); }
public static void Encode(IByteWriter stream, SCPStatement encodedSCPStatement) { NodeID.Encode(stream, encodedSCPStatement.NodeID); Uint64.Encode(stream, encodedSCPStatement.SlotIndex); SCPStatementPledges.Encode(stream, encodedSCPStatement.Pledges); }
public static void Encode(IByteWriter stream, SCPStatement encodedSCPStatement) { NodeID.Encode(stream, encodedSCPStatement.NodeID); Uint64.Encode(stream, encodedSCPStatement.SlotIndex); SCPStatementPledges.Encode(stream, encodedSCPStatement.Pledges); }