public IsValid ( string message, FramingMethod framing ) : bool | ||
message | string | |
framing | FramingMethod | |
Результат | bool |
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; }
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); }