public StsPacket(StsReason reason = StsReason.OK, int sequence = 0)
        {
            stsWriter = new BinaryWriter(new MemoryStream());
            xmlWriter = new BinaryWriter(new MemoryStream());

            WriteStringLine($"STS/1.0 {(int)reason} {reason.ToString()}");

            Header = new StsHeader
            {
                Sequence = (byte)sequence
            };
        }
        public void ReadHeader(Tuple<string, string[], int> headerInfo)
        {
            if (headerInfo.Item2.Length >= 2)
            {
                var identifier = headerInfo.Item2[0].Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                if (identifier.Length == 3)
                {
                    var msgString = identifier[1].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[1];
                    byte sequence = 0;
                    ushort length = 0;

                    if (headerInfo.Item2.Length >= 4)
                    {
                        sequence = Convert.ToByte(headerInfo.Item2[1].Remove(0, 2));
                        length = Convert.ToUInt16(headerInfo.Item2[3].Remove(0, 2));
                    }
                    else if (headerInfo.Item2.Length >= 2)
                        length = Convert.ToUInt16(headerInfo.Item2[1].Remove(0, 2));

                    StsMessage msg;

                    if (!Enum.TryParse(msgString, out msg))
                        msg = StsMessage.Unknown;

                    Header = new StsHeader
                    {
                        Message    = msg,
                        Length     = (ushort)headerInfo.Item3,
                        DataLength = length,
                        Sequence   = sequence
                    };
                }
            }
        }