| @@ -1,6 +1,7 | |||||
| 1 | using System; |
|
1 | using System; | |
| 2 | using System.Collections.Generic; |
|
2 | using System.Collections.Generic; | |
| 3 | using System.IO; |
|
3 | using System.IO; | |
|
|
4 | using System.Globalization; | |||
| 4 |
|
5 | |||
| 5 | namespace Implab.JSON { |
|
6 | namespace Implab.JSON { | |
| 6 | public class JSONWriter { |
|
7 | public class JSONWriter { | |
| @@ -35,7 +36,6 namespace Implab.JSON { | |||||
| 35 |
|
36 | |||
| 36 | public JSONWriter(TextWriter writer) { |
|
37 | public JSONWriter(TextWriter writer) { | |
| 37 | Safe.ArgumentNotNull(writer, "writer"); |
|
38 | Safe.ArgumentNotNull(writer, "writer"); | |
| 38 |
|
||||
| 39 | m_writer = writer; |
|
39 | m_writer = writer; | |
| 40 | } |
|
40 | } | |
| 41 |
|
41 | |||
| @@ -262,7 +262,14 namespace Implab.JSON { | |||||
| 262 | } |
|
262 | } | |
| 263 |
|
263 | |||
| 264 | void Write(double value) { |
|
264 | void Write(double value) { | |
| 265 |
|
|
265 | if (double.IsNaN(value)) | |
|
|
266 | Write("NaN"); | |||
|
|
267 | else if (double.IsNegativeInfinity(value)) | |||
|
|
268 | Write("-Infinity"); | |||
|
|
269 | else if (double.IsPositiveInfinity(value)) | |||
|
|
270 | Write("Infinity"); | |||
|
|
271 | else | |||
|
|
272 | m_writer.Write(value.ToString(CultureInfo.InvariantCulture)); | |||
| 266 | } |
|
273 | } | |
| 267 |
|
274 | |||
| 268 | void OperationNotApplicable(string opName) { |
|
275 | void OperationNotApplicable(string opName) { | |
General Comments 0
You need to be logged in to leave comments.
Login now
