Example #1
0
        public DataStringReaderUtil(string aData, DataStringType aType)
        {
            List <string> words = DataStringUtil.SplitSmart(aData, ',');

            if (words == null)
            {
                throw new ArgumentException("Poorly formed data string! Ensure sure quotes and brackets all match!");
            }

            _type  = aType;
            _words = string.IsNullOrEmpty(aData) ? new string[] { } : words.ToArray();

            if (_type == DataStringType.Named)
            {
                _names = new string[_words.Length];

                for (int i = 0; i < _words.Length; i++)
                {
                    int    sep  = _words[i].IndexOf(':');
                    string name = _words[i].Substring(0, sep);
                    string data = _words[i].Substring(sep + 1);

                    _words[i] = data;
                    _names[i] = name;
                }
            }
        }
Example #2
0
 public DataStringWriterUtil(DataStringType aType)
 {
     _type    = aType;
     _builder = new StringBuilder();
     _builder.Append('{');
 }