Example #1
0
        public virtual AttributeCollection CreateAttributeCollection(SlpReader reader)
        {
            var tmp = reader.ReadRawString();

            var result = new AttributeCollection();

            foreach (var item in tmp.Split(','))
            {
                var    pair = item.Split('=');
                string key = null, value = null;
                if (pair.Length == 1)
                {
                    key = reader.Unescape(pair[0]);
                }
                else if (pair.Length == 2)
                {
                    key   = reader.Unescape(pair[0]);
                    value = reader.Unescape(pair[1]);
                }
                else
                {
                    throw new ServiceProtocolException(ServiceErrorCode.ParseError);
                }

                result.Add(key, value);
            }

            return(result);
        }
Example #2
0
        public virtual AttributeCollection CreateAttributeCollection(SlpReader reader)
        {
            var tmp = reader.ReadRawString();

            var result = new AttributeCollection();
            foreach (var item in tmp.Split(','))
            {
                var pair = item.Split('=');
                string key = null, value = null;
                if (pair.Length == 1)
                    key = reader.Unescape(pair[0]);
                else if (pair.Length == 2)
                {
                    key = reader.Unescape(pair[0]);
                    value = reader.Unescape(pair[1]);
                }
                else
                    throw new ServiceProtocolException(ServiceErrorCode.ParseError);

                result.Add(key, value);
            }

            return result;
        }