Example #1
0
 public override void PopulateElement(JStream stream)
 {
     if (stream.GetSubString(Constants.Null.Length) == Constants.Null)
     {
         stream.NextTimes(Constants.Null.Length);
     }
     else
     {
         throw new ArgumentException("Cannot parse null value");
     }
 }
Example #2
0
        public override void PopulateElement(JStream stream)
        {
            var posibleValueStr = stream.Char == TrueValue[0] ? TrueValue : FalseValue;

            if (stream.GetSubString(posibleValueStr.Length) == posibleValueStr)
            {
                value = posibleValueStr == TrueValue;
                stream.NextTimes(posibleValueStr.Length);
            }
            else
            {
                throw new Exception(string.Format("Cannot parse boolean value ({0})", stream.GetSubString(20)));
            }
        }