예제 #1
0
        internal static ReplicaSetTagSet ParseReplicaSetTagSet(string name, string s)
        {
            var tagSet = new ReplicaSetTagSet();

            foreach (var tagString in s.Split(','))
            {
                var parts = tagString.Split(':');
                if (parts.Length != 2)
                {
                    throw new FormatException(FormatMessage(name, s));
                }
                var tag = new ReplicaSetTag(parts[0].Trim(), parts[1].Trim());
                tagSet.Add(tag);
            }
            return(tagSet);
        }
예제 #2
0
        private IEnumerable <ReplicaSetTagSet> ParseReplicaSetTagSets(string value)
        {
            var tagSets = new List <ReplicaSetTagSet>();

            foreach (var tagSetString in value.Split('|'))
            {
                var tagSet = new ReplicaSetTagSet();
                foreach (var tagString in tagSetString.Split(','))
                {
                    var parts = tagString.Split(':');
                    if (parts.Length != 2)
                    {
                        var message = string.Format("Invalid tag: {0}.", tagString);
                    }
                    var tag = new ReplicaSetTag(parts[0], parts[1]);
                    tagSet.Add(tag);
                }
                tagSets.Add(tagSet);
            }
            return(tagSets);
        }