Esempio n. 1
0
 static void PackJsonNumber(System.IO.Stream stream, MyJson.JsonNode_ValueNumber number)
 {
     if (number.isNull)
     {
         stream.WriteByte(MakeNumberTag(false, false, true, 0));
     }
     else if (number.isBool)
     {
         stream.WriteByte(MakeNumberTag(false, true, number.AsBool(), 0));
     }
     else
     {
         string numstr = number.ToString();
         if (numstr.Contains(".") || numstr.Contains("e") || numstr.Contains("E"))
         {
             WriteFloatData(stream, (float)number.AsDouble());
         }
         else
         {
             WriteIntData(stream, number.AsInt());
         }
     }
 }