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