Lineendings

This commit is contained in:
Philip Schell 2019-03-07 15:08:21 +01:00
parent e687b86fd5
commit 853958acda

View File

@ -1,43 +1,43 @@
#region Header #region Header
/** /**
* JsonWriter.cs * JsonWriter.cs
* Stream-like facility to output JSON text. * Stream-like facility to output JSON text.
* *
* The authors disclaim copyright to this source code. For more details, see * The authors disclaim copyright to this source code. For more details, see
* the COPYING file included with this distribution. * the COPYING file included with this distribution.
**/ **/
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
namespace LitJson namespace LitJson
{ {
internal enum Condition internal enum Condition
{ {
InArray, InArray,
InObject, InObject,
NotAProperty, NotAProperty,
Property, Property,
Value Value
} }
internal class WriterContext internal class WriterContext
{ {
public Int32 Count; public Int32 Count;
public Boolean InArray; public Boolean InArray;
public Boolean InObject; public Boolean InObject;
public Boolean ExpectingValue; public Boolean ExpectingValue;
public Int32 Padding; public Int32 Padding;
} }
public class JsonWriter { public class JsonWriter {
#region Fields #region Fields
private static readonly NumberFormatInfo number_format; private static readonly NumberFormatInfo number_format;
private WriterContext context; private WriterContext context;
@ -51,10 +51,10 @@ namespace LitJson
private Boolean validate; private Boolean validate;
private Boolean lower_case_properties; private Boolean lower_case_properties;
private TextWriter writer; private TextWriter writer;
#endregion #endregion
#region Properties #region Properties
public Int32 IndentValue { public Int32 IndentValue {
get { return this.indent_value; } get { return this.indent_value; }
set { set {
@ -81,10 +81,10 @@ namespace LitJson
get { return this.lower_case_properties; } get { return this.lower_case_properties; }
set { this.lower_case_properties = value; } set { this.lower_case_properties = value; }
} }
#endregion #endregion
#region Constructors #region Constructors
static JsonWriter() { static JsonWriter() {
number_format = NumberFormatInfo.InvariantInfo; number_format = NumberFormatInfo.InvariantInfo;
} }
@ -105,10 +105,10 @@ namespace LitJson
Init(); Init();
} }
#endregion #endregion
#region Private Methods #region Private Methods
private void DoValidation(Condition cond) { private void DoValidation(Condition cond) {
if (!this.context.ExpectingValue) { if (!this.context.ExpectingValue) {
this.context.Count++; this.context.Count++;
@ -282,7 +282,7 @@ namespace LitJson
this.indentation -= this.indent_value; this.indentation -= this.indent_value;
} }
} }
#endregion #endregion
public override String ToString() { public override String ToString() {
@ -449,7 +449,7 @@ namespace LitJson
this.context.Padding = propertyName.Length; this.context.Padding = propertyName.Length;
} }
for (Int32 i = this.context.Padding - propertyName.Length; for (Int32 i = this.context.Padding - propertyName.Length;
i >= 0; i--) { i >= 0; i--) {
this.writer.Write(' '); this.writer.Write(' ');
} }
@ -461,5 +461,5 @@ namespace LitJson
this.context.ExpectingValue = true; this.context.ExpectingValue = true;
} }
} }
} }