IsValid() public method

public IsValid ( string message, FramingMethod framing ) : bool
message string
framing FramingMethod
return bool
Ejemplo n.º 1
0
        private static ServerMsgSet FromStringOctetCounting(string s, ServerMsgSet serverMsgSet)
        {
            var matches = Regex
                .Split(s, "(\\d{1,11} <\\d{1,3}>)")
                .Where(x => !string.IsNullOrEmpty(x))
                .Select((value, index) => new { value, index })
                .ToArray();
            serverMsgSet.messages = matches
                .Where(x => x.index % 2 == 0)
                .Select(x => x.value + (matches.Length <= x.index + 1 ? string.Empty : matches[x.index + 1].value))
                .ToArray();

            serverMsgSet.LastIsPartial = !serverMsgSet.IsValid(serverMsgSet.LastMessage, FramingMethod.OctetCounting);

            return serverMsgSet;
        }
Ejemplo n.º 2
0
        private static ServerMsgSet FromStringOctetCounting(string s, ServerMsgSet serverMsgSet)
        {
            var matches = Regex
                          .Split(s, "(\\d{1,11} <\\d{1,3}>)")
                          .Where(x => !string.IsNullOrEmpty(x))
                          .Select((value, index) => new { value, index })
                          .ToArray();

            serverMsgSet.messages = matches
                                    .Where(x => x.index % 2 == 0)
                                    .Select(x => x.value + (matches.Length <= x.index + 1 ? string.Empty : matches[x.index + 1].value))
                                    .ToArray();

            serverMsgSet.LastIsPartial = !serverMsgSet.IsValid(serverMsgSet.LastMessage, FramingMethod.OctetCounting);

            return(serverMsgSet);
        }