private SmlOpenResponse(SmlString a_codePage, SmlString a_clientId, SmlString a_requestFileId, SmlString a_serverId, SmlTime a_time, SmlUnsigned8 a_version) { m_codePage = a_codePage; if (m_codePage != null) { m_encoding = Encoding.GetEncoding(m_codePage.ValueString); } else { m_encoding = null; } m_clientId = m_encoding != null ? new SmlString(a_clientId.ValueBytes, m_encoding) : a_clientId; m_requestFileId = m_encoding != null ? new SmlString(a_requestFileId.ValueBytes, m_encoding) : a_requestFileId; m_serverId = m_encoding != null ? new SmlString(a_serverId.ValueBytes, m_encoding) : a_serverId; m_time = a_time; m_version = a_version; }
public override ParseResult ContinuePopulate(byte a_byte) { var ret = m_tl.ContinuePopulate(a_byte); if (ret == ParseResult.MoreBytesNeeded) { return(ParseResult.MoreBytesNeeded); } if (ret == ParseResult.Failed) { return(EndWithFailed()); } SmlList list = m_tl.EndPopulate() as SmlList; if (list == null || list.Length != 6) { return(EndWithFailed()); } m_transactionId = list.GetElement(0) as SmlString; if (m_transactionId == null) { return(EndWithFailed()); } m_groupNo = list.GetElement(1) as SmlUnsigned8; if (m_groupNo == null) { return(EndWithFailed()); } m_abortOnError = list.GetElement(2) as SmlUnsigned8; if (m_abortOnError == null) { return(EndWithFailed()); } var body = list.GetElement(3) as SmlList; if (body == null || body.Length != 2) { return(EndWithFailed()); } var type = body.GetElement(0) as SmlUnsigned32; if (type == null || !Enum.IsDefined(typeof(SmlMessageType), type.Value)) { return(EndWithFailed()); } m_messageType = (SmlMessageType)type.Value; m_body = SmlMessageBody.Create(m_messageType, body.GetElement(1)); if (m_body == null) { return(EndWithFailed()); } m_crc = list.GetElement(4) as SmlUnsigned16; if (m_crc == null) { return(EndWithFailed()); } var eom = list.GetElement(5) as SmlTypeLengthField; if (eom == null || eom.SmlFieldType != SmlFieldType.EndOfMessage) { return(EndWithFailed()); } m_state = State.Done; return(ParseResult.Done); }