public MessageFlagCollection ParseMessageFlagCollection(byte[] source) { MessageFlagCollection flags = new MessageFlagCollection(); Regex regex = new Regex(@"\\([^\s]+)"); string input = this.DefaultEncoding.GetString(source, 0, source.Length); foreach (Match match in regex.Matches(input)) { flags.Add(new MessageFlag(match.Groups[1].Value)); } return(flags); }
public MessageFlagCollection ParseFlags(string flags) { MessageFlagCollection messageFlagCollection = new MessageFlagCollection(); if (!string.IsNullOrEmpty(flags) && flags.Contains(@"\")) { string[] flagNames = flags.Split(new char[] { '\\', ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (string flag in flagNames) { messageFlagCollection.Add(new MessageFlag(flag)); } } return(messageFlagCollection); }