From ed53b0c9ada0a49b54485db41286ece3ddb24cd7 Mon Sep 17 00:00:00 2001 From: JamesNK Date: Fri, 10 Apr 2009 04:45:58 +0000 Subject: [PATCH] -Rename JsonTokenReader, JsonTokenWriter, JsonTokenType to JTokenReader, JTokenWriter, JTokenType --- Src/Doc/ReadingWritingJSON.html | 6 +- ...TokenReaderTest.cs => JTokenReaderTest.cs} | 8 +- ...TokenWriterTest.cs => JTokenWriterTest.cs} | 6 +- .../Linq/JObjectTests.cs | 8 +- .../Linq/JPropertyTests.cs | 2 +- Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs | 16 ++-- .../Linq/LinqToJsonTest.cs | 6 +- .../Newtonsoft.Json.Tests.Compact.csproj | 4 +- .../Newtonsoft.Json.Tests.Silverlight.csproj | 4 +- .../Newtonsoft.Json.Tests.csproj | 4 +- .../Schema/JsonSchemaGeneratorTests.cs | 2 +- .../CamelCaseMappingResolverTests.cs | 4 +- Src/Newtonsoft.Json/JsonReader.cs | 46 +++++------ Src/Newtonsoft.Json/JsonSerializer.cs | 2 +- Src/Newtonsoft.Json/JsonValidatingReader.cs | 22 ++--- Src/Newtonsoft.Json/JsonWriter.cs | 54 ++++++------- Src/Newtonsoft.Json/Linq/JArray.cs | 8 +- Src/Newtonsoft.Json/Linq/JConstructor.cs | 6 +- Src/Newtonsoft.Json/Linq/JContainer.cs | 8 +- Src/Newtonsoft.Json/Linq/JObject.cs | 10 +-- Src/Newtonsoft.Json/Linq/JProperty.cs | 6 +- Src/Newtonsoft.Json/Linq/JToken.cs | 18 ++--- .../{JsonTokenReader.cs => JTokenReader.cs} | 42 +++++----- .../Linq/{JsonTokenType.cs => JTokenType.cs} | 2 +- .../{JsonTokenWriter.cs => JTokenWriter.cs} | 14 ++-- Src/Newtonsoft.Json/Linq/JValue.cs | 80 +++++++++---------- .../Newtonsoft.Json.Compact.csproj | 6 +- .../Newtonsoft.Json.Silverlight.csproj | 6 +- Src/Newtonsoft.Json/Newtonsoft.Json.csproj | 6 +- 29 files changed, 203 insertions(+), 203 deletions(-) rename Src/Newtonsoft.Json.Tests/{JsonTokenReaderTest.cs => JTokenReaderTest.cs} (93%) rename Src/Newtonsoft.Json.Tests/{JsonTokenWriterTest.cs => JTokenWriterTest.cs} (92%) rename Src/Newtonsoft.Json/Linq/{JsonTokenReader.cs => JTokenReader.cs} (81%) rename Src/Newtonsoft.Json/Linq/{JsonTokenType.cs => JTokenType.cs} (95%) rename Src/Newtonsoft.Json/Linq/{JsonTokenWriter.cs => JTokenWriter.cs} (91%) diff --git a/Src/Doc/ReadingWritingJSON.html b/Src/Doc/ReadingWritingJSON.html index 751d1821..64bbbdd4 100644 --- a/Src/Doc/ReadingWritingJSON.html +++ b/Src/Doc/ReadingWritingJSON.html @@ -59,8 +59,8 @@ -

JsonTokenReader and JsonTokenWriter

-

JsonTokenReader and JsonTokenWriter read and write LINQ to JSON objects. They are located in the Newtonsoft.Json.Linq namespace. These objects allow you to use LINQ to JSON objects with objects that read and write JSON such as the JsonSerializer. For example you can deserialize from a LINQ to JSON object into a regular .NET object and vice versa.

+

JTokenReader and JTokenWriter

+

JTokenReader and JTokenWriter read and write LINQ to JSON objects. They are located in the Newtonsoft.Json.Linq namespace. These objects allow you to use LINQ to JSON objects with objects that read and write JSON such as the JsonSerializer. For example you can deserialize from a LINQ to JSON object into a regular .NET object and vice versa.

@@ -71,7 +71,7 @@
  );
 
JsonSerializer serializer = new JsonSerializer();
-
Person p = (Person)serializer.Deserialize(new JsonTokenReader(o), typeof(Person));
+
Person p = (Person)serializer.Deserialize(new JTokenReader(o), typeof(Person));
 
// John Smith
Console.WriteLine(p.Name);
diff --git a/Src/Newtonsoft.Json.Tests/JsonTokenReaderTest.cs b/Src/Newtonsoft.Json.Tests/JTokenReaderTest.cs similarity index 93% rename from Src/Newtonsoft.Json.Tests/JsonTokenReaderTest.cs rename to Src/Newtonsoft.Json.Tests/JTokenReaderTest.cs index b9004b9f..77a10006 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTokenReaderTest.cs +++ b/Src/Newtonsoft.Json.Tests/JTokenReaderTest.cs @@ -33,7 +33,7 @@ using Newtonsoft.Json.Linq; namespace Newtonsoft.Json.Tests { - public class JsonTokenReaderTest : TestFixtureBase + public class JTokenReaderTest : TestFixtureBase { [Test] public void YahooFinance() @@ -46,7 +46,7 @@ namespace Newtonsoft.Json.Tests new JProperty("Test4", null) ); - using (JsonTokenReader jsonReader = new JsonTokenReader(o)) + using (JTokenReader jsonReader = new JTokenReader(o)) { IJsonLineInfo lineInfo = jsonReader; @@ -96,7 +96,7 @@ namespace Newtonsoft.Json.Tests Assert.IsFalse(jsonReader.Read()); } - using (JsonReader jsonReader = new JsonTokenReader(o.Property("Test2"))) + using (JsonReader jsonReader = new JTokenReader(o.Property("Test2"))) { Assert.IsTrue(jsonReader.Read()); Assert.AreEqual(JsonToken.PropertyName, jsonReader.TokenType); @@ -125,7 +125,7 @@ namespace Newtonsoft.Json.Tests JObject o = JObject.Parse(input); - using (JsonTokenReader jsonReader = new JsonTokenReader(o)) + using (JTokenReader jsonReader = new JTokenReader(o)) { IJsonLineInfo lineInfo = jsonReader; diff --git a/Src/Newtonsoft.Json.Tests/JsonTokenWriterTest.cs b/Src/Newtonsoft.Json.Tests/JTokenWriterTest.cs similarity index 92% rename from Src/Newtonsoft.Json.Tests/JsonTokenWriterTest.cs rename to Src/Newtonsoft.Json.Tests/JTokenWriterTest.cs index f6c404a9..e137759b 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTokenWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/JTokenWriterTest.cs @@ -34,13 +34,13 @@ using System.Linq; namespace Newtonsoft.Json.Tests { - public class JsonTokenWriterTest : TestFixtureBase + public class JTokenWriterTest : TestFixtureBase { [Test] public void ValueFormatting() { JToken root; - using (JsonTokenWriter jsonWriter = new JsonTokenWriter()) + using (JTokenWriter jsonWriter = new JTokenWriter()) { jsonWriter.WriteStartArray(); jsonWriter.WriteValue('@'); @@ -78,7 +78,7 @@ namespace Newtonsoft.Json.Tests [Test] public void State() { - using (JsonWriter jsonWriter = new JsonTokenWriter()) + using (JsonWriter jsonWriter = new JTokenWriter()) { Assert.AreEqual(WriteState.Start, jsonWriter.WriteState); diff --git a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs index dd3d7671..1527d5ce 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs @@ -246,13 +246,13 @@ Parameter name: arrayIndex")] JObject o = JObject.FromObject(raw); Assert.AreEqual("FirstNameValue", (string)o["first_name"]); - Assert.AreEqual(JsonTokenType.Raw, ((JValue)o["RawContent"]).Type); + Assert.AreEqual(JTokenType.Raw, ((JValue)o["RawContent"]).Type); Assert.AreEqual("[1,2,3,4,5]", (string)o["RawContent"]); Assert.AreEqual("LastNameValue", (string)o["last_name"]); } [Test] - public void JsonTokenReader() + public void JTokenReader() { PersonRaw raw = new PersonRaw { @@ -263,7 +263,7 @@ Parameter name: arrayIndex")] JObject o = JObject.FromObject(raw); - JsonReader reader = new JsonTokenReader(o); + JsonReader reader = new JTokenReader(o); Assert.IsTrue(reader.Read()); Assert.AreEqual(JsonToken.StartObject, reader.TokenType); @@ -304,7 +304,7 @@ Parameter name: arrayIndex")] JObject o = JObject.FromObject(raw); - JsonReader reader = new JsonTokenReader(o); + JsonReader reader = new JTokenReader(o); JsonSerializer serializer = new JsonSerializer(); raw = (PersonRaw)serializer.Deserialize(reader, typeof(PersonRaw)); diff --git a/Src/Newtonsoft.Json.Tests/Linq/JPropertyTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JPropertyTests.cs index a8b1ed85..c221c74b 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JPropertyTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JPropertyTests.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json.Tests.Linq property = JProperty.Load(reader); Assert.AreEqual("propertyname", property.Name); - Assert.IsTrue(JToken.DeepEquals(new JValue(null, JsonTokenType.Null), property.Value)); + Assert.IsTrue(JToken.DeepEquals(new JValue(null, JTokenType.Null), property.Value)); Assert.AreEqual(JsonToken.EndObject, reader.TokenType); } diff --git a/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs index 539b1295..e83cce30 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs @@ -39,23 +39,23 @@ namespace Newtonsoft.Json.Tests.Linq { JValue v = new JValue(true); Assert.AreEqual(true, v.Value); - Assert.AreEqual(JsonTokenType.Boolean, v.Type); + Assert.AreEqual(JTokenType.Boolean, v.Type); v.Value = "Pie"; Assert.AreEqual("Pie", v.Value); - Assert.AreEqual(JsonTokenType.String, v.Type); + Assert.AreEqual(JTokenType.String, v.Type); v.Value = null; Assert.AreEqual(null, v.Value); - Assert.AreEqual(JsonTokenType.Null, v.Type); + Assert.AreEqual(JTokenType.Null, v.Type); v.Value = (int?)null; Assert.AreEqual(null, v.Value); - Assert.AreEqual(JsonTokenType.Null, v.Type); + Assert.AreEqual(JTokenType.Null, v.Type); v.Value = "Pie"; Assert.AreEqual("Pie", v.Value); - Assert.AreEqual(JsonTokenType.String, v.Type); + Assert.AreEqual(JTokenType.String, v.Type); } [Test] @@ -63,11 +63,11 @@ namespace Newtonsoft.Json.Tests.Linq { JValue commentValue = JValue.CreateComment(null); Assert.AreEqual(null, commentValue.Value); - Assert.AreEqual(JsonTokenType.Comment, commentValue.Type); + Assert.AreEqual(JTokenType.Comment, commentValue.Type); commentValue.Value = "Comment"; Assert.AreEqual("Comment", commentValue.Value); - Assert.AreEqual(JsonTokenType.Comment, commentValue.Type); + Assert.AreEqual(JTokenType.Comment, commentValue.Type); } [Test] @@ -75,7 +75,7 @@ namespace Newtonsoft.Json.Tests.Linq { JValue stringValue = JValue.CreateString(null); Assert.AreEqual(null, stringValue.Value); - Assert.AreEqual(JsonTokenType.String, stringValue.Type); + Assert.AreEqual(JTokenType.String, stringValue.Type); } [Test] diff --git a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs index 2dfe0f4e..0e726aa5 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs @@ -76,7 +76,7 @@ namespace Newtonsoft.Json.Tests.Linq ); JsonSerializer serializer = new JsonSerializer(); - Person p = (Person)serializer.Deserialize(new JsonTokenReader(o), typeof(Person)); + Person p = (Person)serializer.Deserialize(new JTokenReader(o), typeof(Person)); // John Smith Console.WriteLine(p.Name); @@ -589,8 +589,8 @@ keyword such as type of business."" JsonSerializer jsonSerializer = new JsonSerializer(); - JsonTokenWriter jsonWriter; - using (jsonWriter = new JsonTokenWriter()) + JTokenWriter jsonWriter; + using (jsonWriter = new JTokenWriter()) { jsonSerializer.Serialize(jsonWriter, testDates); } diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj index b13c426f..9895c5db 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj @@ -60,6 +60,8 @@ + + @@ -120,8 +122,6 @@ - - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj index 68b36de3..fe249003 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj @@ -65,6 +65,8 @@ + + @@ -125,8 +127,6 @@ - - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj index 6ff647d2..a55cba9c 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj @@ -142,8 +142,8 @@ - - + + diff --git a/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs b/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs index 13339062..e0e91819 100644 --- a/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs +++ b/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs @@ -378,7 +378,7 @@ namespace Newtonsoft.Json.Tests.Schema DirectoryInfo temp = new DirectoryInfo(@"c:\temp"); - JsonTokenWriter jsonWriter = new JsonTokenWriter(); + JTokenWriter jsonWriter = new JTokenWriter(); JsonSerializer serializer = new JsonSerializer(); serializer.Converters.Add(new IsoDateTimeConverter()); serializer.MappingResolver = new CustomDirectoryInfoMapper(); diff --git a/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseMappingResolverTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseMappingResolverTests.cs index e0846007..1b2c6516 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseMappingResolverTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseMappingResolverTests.cs @@ -68,7 +68,7 @@ namespace Newtonsoft.Json.Tests.Serialization } [Test] - public void JsonTokenWriter() + public void JTokenWriter() { JsonIgnoreAttributeOnClassTestClass ignoreAttributeOnClassTestClass = new JsonIgnoreAttributeOnClassTestClass(); ignoreAttributeOnClassTestClass.Field = int.MinValue; @@ -76,7 +76,7 @@ namespace Newtonsoft.Json.Tests.Serialization JsonSerializer serializer = new JsonSerializer(); serializer.MappingResolver = new CamelCaseMappingResolver(); - JsonTokenWriter writer = new JsonTokenWriter(); + JTokenWriter writer = new JTokenWriter(); serializer.Serialize(writer, ignoreAttributeOnClassTestClass); diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs index 7dd7dd7d..137486a5 100644 --- a/Src/Newtonsoft.Json/JsonReader.cs +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -115,7 +115,7 @@ namespace Newtonsoft.Json private int _top; - private readonly List _stack; + private readonly List _stack; /// /// Gets the quotation mark character used to enclose the value of a string. @@ -173,27 +173,27 @@ namespace Newtonsoft.Json { //_testBuffer = new StringBuilder(); _currentState = State.Start; - _stack = new List(); + _stack = new List(); _top = 0; - Push(JsonTokenType.None); + Push(JTokenType.None); } - private void Push(JsonTokenType value) + private void Push(JTokenType value) { _stack.Add(value); _top++; } - private JsonTokenType Pop() + private JTokenType Pop() { - JsonTokenType value = Peek(); + JTokenType value = Peek(); _stack.RemoveAt(_stack.Count - 1); _top--; return value; } - private JsonTokenType Peek() + private JTokenType Peek() { return _stack[_top - 1]; } @@ -241,15 +241,15 @@ namespace Newtonsoft.Json { case JsonToken.StartObject: _currentState = State.ObjectStart; - Push(JsonTokenType.Object); + Push(JTokenType.Object); break; case JsonToken.StartArray: _currentState = State.ArrayStart; - Push(JsonTokenType.Array); + Push(JTokenType.Array); break; case JsonToken.StartConstructor: _currentState = State.ConstructorStart; - Push(JsonTokenType.Constructor); + Push(JTokenType.Constructor); break; case JsonToken.EndObject: ValidateEnd(JsonToken.EndObject); @@ -265,7 +265,7 @@ namespace Newtonsoft.Json break; case JsonToken.PropertyName: _currentState = State.Property; - Push(JsonTokenType.Property); + Push(JTokenType.Property); break; case JsonToken.Undefined: case JsonToken.Integer: @@ -279,8 +279,8 @@ namespace Newtonsoft.Json break; } - JsonTokenType current = Peek(); - if (current == JsonTokenType.Property && _currentState == State.PostValue) + JTokenType current = Peek(); + if (current == JTokenType.Property && _currentState == State.PostValue) Pop(); if (value != null) @@ -297,7 +297,7 @@ namespace Newtonsoft.Json private void ValidateEnd(JsonToken endToken) { - JsonTokenType currentObject = Pop(); + JTokenType currentObject = Pop(); if (GetTypeForCloseToken(endToken) != currentObject) throw new JsonReaderException("JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, currentObject)); @@ -308,20 +308,20 @@ namespace Newtonsoft.Json /// protected void SetStateBasedOnCurrent() { - JsonTokenType currentObject = Peek(); + JTokenType currentObject = Peek(); switch (currentObject) { - case JsonTokenType.Object: + case JTokenType.Object: _currentState = State.Object; break; - case JsonTokenType.Array: + case JTokenType.Array: _currentState = State.Array; break; - case JsonTokenType.Constructor: + case JTokenType.Constructor: _currentState = State.Constructor; break; - case JsonTokenType.None: + case JTokenType.None: _currentState = State.Finished; break; default: @@ -357,16 +357,16 @@ namespace Newtonsoft.Json } } - private JsonTokenType GetTypeForCloseToken(JsonToken token) + private JTokenType GetTypeForCloseToken(JsonToken token) { switch (token) { case JsonToken.EndObject: - return JsonTokenType.Object; + return JTokenType.Object; case JsonToken.EndArray: - return JsonTokenType.Array; + return JTokenType.Array; case JsonToken.EndConstructor: - return JsonTokenType.Constructor; + return JTokenType.Constructor; default: throw new JsonReaderException("Not a valid close JsonToken: " + token); } diff --git a/Src/Newtonsoft.Json/JsonSerializer.cs b/Src/Newtonsoft.Json/JsonSerializer.cs index bdff788c..74ac81c7 100644 --- a/Src/Newtonsoft.Json/JsonSerializer.cs +++ b/Src/Newtonsoft.Json/JsonSerializer.cs @@ -238,7 +238,7 @@ namespace Newtonsoft.Json private JToken CreateJToken(JsonReader reader) { JToken token; - using (JsonTokenWriter writer = new JsonTokenWriter()) + using (JTokenWriter writer = new JTokenWriter()) { writer.WriteToken(reader); token = writer.Token; diff --git a/Src/Newtonsoft.Json/JsonValidatingReader.cs b/Src/Newtonsoft.Json/JsonValidatingReader.cs index d0021689..b9e57782 100644 --- a/Src/Newtonsoft.Json/JsonValidatingReader.cs +++ b/Src/Newtonsoft.Json/JsonValidatingReader.cs @@ -39,7 +39,7 @@ namespace Newtonsoft.Json { private class SchemaScope { - private readonly JsonTokenType _tokenType; + private readonly JTokenType _tokenType; private readonly JsonSchemaModel _schema; private readonly Dictionary _requiredProperties; @@ -56,12 +56,12 @@ namespace Newtonsoft.Json get { return _requiredProperties; } } - public JsonTokenType TokenType + public JTokenType TokenType { get { return _tokenType; } } - public SchemaScope(JsonTokenType tokenType, JsonSchemaModel schema) + public SchemaScope(JTokenType tokenType, JsonSchemaModel schema) { _tokenType = tokenType; _schema = schema; @@ -154,9 +154,9 @@ namespace Newtonsoft.Json switch (_currentScope.TokenType) { - case JsonTokenType.None: + case JTokenType.None: return _currentScope.Schema; - case JsonTokenType.Object: + case JTokenType.Object: if (_currentScope.CurrentPropertyName == null) throw new Exception("CurrentPropertyName has not been set on scope."); @@ -165,7 +165,7 @@ namespace Newtonsoft.Json return propertySchema; return (CurrentSchema.AllowAdditionalProperties) ? CurrentSchema.AdditionalProperties : null; - case JsonTokenType.Array: + case JTokenType.Array: if (!CollectionUtils.IsNullOrEmpty(CurrentSchema.Items)) { if (CurrentSchema.Items.Count == 1) @@ -176,7 +176,7 @@ namespace Newtonsoft.Json } return (CurrentSchema.AllowAdditionalProperties) ? CurrentSchema.AdditionalProperties : null; - case JsonTokenType.Constructor: + case JTokenType.Constructor: return null; default: throw new ArgumentOutOfRangeException("TokenType", "Unexpected token type: {0}".FormatWith(CultureInfo.InvariantCulture, _currentScope.TokenType)); @@ -296,17 +296,17 @@ namespace Newtonsoft.Json JsonSchemaModel objectSchema = (ValidateObject(CurrentMemberSchema)) ? CurrentMemberSchema : null; - Push(new SchemaScope(JsonTokenType.Object, objectSchema)); + Push(new SchemaScope(JTokenType.Object, objectSchema)); break; case JsonToken.StartArray: ProcessValue(); JsonSchemaModel arraySchema = (ValidateArray(CurrentMemberSchema)) ? CurrentMemberSchema : null; - Push(new SchemaScope(JsonTokenType.Array, arraySchema)); + Push(new SchemaScope(JTokenType.Array, arraySchema)); break; case JsonToken.StartConstructor: - Push(new SchemaScope(JsonTokenType.Constructor, null)); + Push(new SchemaScope(JTokenType.Constructor, null)); break; case JsonToken.PropertyName: ValidatePropertyName(CurrentSchema); @@ -457,7 +457,7 @@ namespace Newtonsoft.Json private void ProcessValue() { - if (_currentScope != null && _currentScope.TokenType == JsonTokenType.Array) + if (_currentScope != null && _currentScope.TokenType == JTokenType.Array) { _currentScope.ArrayItemCount++; diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index 7734927c..99111027 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -121,7 +121,7 @@ namespace Newtonsoft.Json private int _top; - private List _stack; + private List _stack; private State _currentState; private Formatting _formatting; private List _serializeStack; @@ -192,13 +192,13 @@ namespace Newtonsoft.Json /// public JsonWriter() { - _stack = new List(8); - _stack.Add(JsonTokenType.None); + _stack = new List(8); + _stack.Add(JTokenType.None); _currentState = State.Start; _formatting = Formatting.None; } - private void Push(JsonTokenType value) + private void Push(JTokenType value) { _top++; if (_stack.Count <= _top) @@ -207,15 +207,15 @@ namespace Newtonsoft.Json _stack[_top] = value; } - private JsonTokenType Pop() + private JTokenType Pop() { - JsonTokenType value = Peek(); + JTokenType value = Peek(); _top--; return value; } - private JsonTokenType Peek() + private JTokenType Peek() { return _stack[_top]; } @@ -239,7 +239,7 @@ namespace Newtonsoft.Json public virtual void WriteStartObject() { AutoComplete(JsonToken.StartObject); - Push(JsonTokenType.Object); + Push(JTokenType.Object); } /// @@ -256,7 +256,7 @@ namespace Newtonsoft.Json public virtual void WriteStartArray() { AutoComplete(JsonToken.StartArray); - Push(JsonTokenType.Array); + Push(JTokenType.Array); } /// @@ -274,7 +274,7 @@ namespace Newtonsoft.Json public virtual void WriteStartConstructor(string name) { AutoComplete(JsonToken.StartConstructor); - Push(JsonTokenType.Constructor); + Push(JTokenType.Constructor); } /// @@ -433,17 +433,17 @@ namespace Newtonsoft.Json } } - private void WriteEnd(JsonTokenType type) + private void WriteEnd(JTokenType type) { switch (type) { - case JsonTokenType.Object: + case JTokenType.Object: WriteEndObject(); break; - case JsonTokenType.Array: + case JTokenType.Array: WriteEndArray(); break; - case JsonTokenType.Constructor: + case JTokenType.Constructor: WriteEndConstructor(); break; default: @@ -459,30 +459,30 @@ namespace Newtonsoft.Json } } - private JsonTokenType GetTypeForCloseToken(JsonToken token) + private JTokenType GetTypeForCloseToken(JsonToken token) { switch (token) { case JsonToken.EndObject: - return JsonTokenType.Object; + return JTokenType.Object; case JsonToken.EndArray: - return JsonTokenType.Array; + return JTokenType.Array; case JsonToken.EndConstructor: - return JsonTokenType.Constructor; + return JTokenType.Constructor; default: throw new JsonWriterException("No type for token: " + token); } } - private JsonToken GetCloseTokenForType(JsonTokenType type) + private JsonToken GetCloseTokenForType(JTokenType type) { switch (type) { - case JsonTokenType.Object: + case JTokenType.Object: return JsonToken.EndObject; - case JsonTokenType.Array: + case JTokenType.Array: return JsonToken.EndArray; - case JsonTokenType.Constructor: + case JTokenType.Constructor: return JsonToken.EndConstructor; default: throw new JsonWriterException("No close token for type: " + type); @@ -519,20 +519,20 @@ namespace Newtonsoft.Json WriteEnd(token); } - JsonTokenType currentLevelType = Peek(); + JTokenType currentLevelType = Peek(); switch (currentLevelType) { - case JsonTokenType.Object: + case JTokenType.Object: _currentState = State.Object; break; - case JsonTokenType.Array: + case JTokenType.Array: _currentState = State.Array; break; - case JsonTokenType.Constructor: + case JTokenType.Constructor: _currentState = State.Array; break; - case JsonTokenType.None: + case JTokenType.None: _currentState = State.Start; break; default: diff --git a/Src/Newtonsoft.Json/Linq/JArray.cs b/Src/Newtonsoft.Json/Linq/JArray.cs index 6e7426ac..d233055a 100644 --- a/Src/Newtonsoft.Json/Linq/JArray.cs +++ b/Src/Newtonsoft.Json/Linq/JArray.cs @@ -42,9 +42,9 @@ namespace Newtonsoft.Json.Linq /// Gets the node type for this . /// /// The type. - public override JsonTokenType Type + public override JTokenType Type { - get { return JsonTokenType.Array; } + get { return JTokenType.Array; } } /// @@ -134,7 +134,7 @@ namespace Newtonsoft.Json.Linq { ValidationUtils.ArgumentNotNull(o, "o"); - if (o.Type == JsonTokenType.Property) + if (o.Type == JTokenType.Property) throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); } @@ -147,7 +147,7 @@ namespace Newtonsoft.Json.Linq { JToken token = FromObjectInternal(o); - if (token.Type != JsonTokenType.Array) + if (token.Type != JTokenType.Array) throw new ArgumentException("Object serialized to {0}. JArray instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); return (JArray)token; diff --git a/Src/Newtonsoft.Json/Linq/JConstructor.cs b/Src/Newtonsoft.Json/Linq/JConstructor.cs index 069048bd..3ffea382 100644 --- a/Src/Newtonsoft.Json/Linq/JConstructor.cs +++ b/Src/Newtonsoft.Json/Linq/JConstructor.cs @@ -53,9 +53,9 @@ namespace Newtonsoft.Json.Linq /// Gets the node type for this . /// /// The type. - public override JsonTokenType Type + public override JTokenType Type { - get { return JsonTokenType.Constructor; } + get { return JTokenType.Constructor; } } /// @@ -117,7 +117,7 @@ namespace Newtonsoft.Json.Linq switch (o.Type) { - case JsonTokenType.Property: + case JTokenType.Property: throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); } } diff --git a/Src/Newtonsoft.Json/Linq/JContainer.cs b/Src/Newtonsoft.Json/Linq/JContainer.cs index 031fb0b0..d9cdcaa3 100644 --- a/Src/Newtonsoft.Json/Linq/JContainer.cs +++ b/Src/Newtonsoft.Json/Linq/JContainer.cs @@ -253,7 +253,7 @@ namespace Newtonsoft.Json.Linq { ValidationUtils.ArgumentNotNull(o, "o"); - if (o.Type == JsonTokenType.Property) + if (o.Type == JTokenType.Property) throw new Exception("Can not add {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); } @@ -289,7 +289,7 @@ namespace Newtonsoft.Json.Linq /// An that is ready to have content written to it. public JsonWriter CreateWriter() { - return new JsonTokenWriter(this); + return new JTokenWriter(this); } /// @@ -436,12 +436,12 @@ namespace Newtonsoft.Json.Linq parent.AddObjectSkipNotify(v); break; case JsonToken.Null: - v = new JValue(null, JsonTokenType.Null); + v = new JValue(null, JTokenType.Null); v.SetLineInfo(lineInfo); parent.AddObjectSkipNotify(v); break; case JsonToken.Undefined: - v = new JValue(null, JsonTokenType.Undefined); + v = new JValue(null, JTokenType.Undefined); v.SetLineInfo(lineInfo); parent.AddObjectSkipNotify(v); break; diff --git a/Src/Newtonsoft.Json/Linq/JObject.cs b/Src/Newtonsoft.Json/Linq/JObject.cs index 3798f59e..11261c23 100644 --- a/Src/Newtonsoft.Json/Linq/JObject.cs +++ b/Src/Newtonsoft.Json/Linq/JObject.cs @@ -82,7 +82,7 @@ namespace Newtonsoft.Json.Linq { ValidationUtils.ArgumentNotNull(o, "o"); - if (o.Type != JsonTokenType.Property) + if (o.Type != JTokenType.Property) throw new Exception("Can not add {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); JProperty property = (JProperty)o; @@ -100,9 +100,9 @@ namespace Newtonsoft.Json.Linq /// Gets the node type for this . /// /// The type. - public override JsonTokenType Type + public override JTokenType Type { - get { return JsonTokenType.Object; } + get { return JTokenType.Object; } } /// @@ -228,7 +228,7 @@ namespace Newtonsoft.Json.Linq { JToken token = FromObjectInternal(o); - if (token.Type != JsonTokenType.Object) + if (token.Type != JTokenType.Object) throw new ArgumentException("Object serialized to {0}. JObject instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); return (JObject)token; @@ -238,7 +238,7 @@ namespace Newtonsoft.Json.Linq { ValidationUtils.ArgumentNotNull(o, "o"); - if (o.Type != JsonTokenType.Property) + if (o.Type != JTokenType.Property) throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); } diff --git a/Src/Newtonsoft.Json/Linq/JProperty.cs b/Src/Newtonsoft.Json/Linq/JProperty.cs index 4ac2ccdc..89f05337 100644 --- a/Src/Newtonsoft.Json/Linq/JProperty.cs +++ b/Src/Newtonsoft.Json/Linq/JProperty.cs @@ -86,10 +86,10 @@ namespace Newtonsoft.Json.Linq /// Gets the node type for this . /// /// The type. - public override JsonTokenType Type + public override JTokenType Type { [DebuggerStepThrough] - get { return JsonTokenType.Property; } + get { return JTokenType.Property; } } /// @@ -133,7 +133,7 @@ namespace Newtonsoft.Json.Linq { ValidationUtils.ArgumentNotNull(o, "o"); - if (o.Type == JsonTokenType.Property) + if (o.Type == JTokenType.Property) throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); } diff --git a/Src/Newtonsoft.Json/Linq/JToken.cs b/Src/Newtonsoft.Json/Linq/JToken.cs index 365e6284..94aaf40e 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.cs @@ -101,7 +101,7 @@ namespace Newtonsoft.Json.Linq /// Gets the node type for this . /// /// The type. - public abstract JsonTokenType Type { get; } + public abstract JTokenType Type { get; } /// /// Gets a value indicating whether this token has childen tokens. @@ -376,32 +376,32 @@ namespace Newtonsoft.Json.Linq private static bool IsNullable(JToken o) { - return (o.Type == JsonTokenType.Undefined || o.Type == JsonTokenType.Null); + return (o.Type == JTokenType.Undefined || o.Type == JTokenType.Null); } private static bool ValidateFloat(JToken o, bool nullable) { - return (o.Type == JsonTokenType.Float || o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); + return (o.Type == JTokenType.Float || o.Type == JTokenType.Integer || (nullable && IsNullable(o))); } private static bool ValidateInteger(JToken o, bool nullable) { - return (o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); + return (o.Type == JTokenType.Integer || (nullable && IsNullable(o))); } private static bool ValidateDate(JToken o, bool nullable) { - return (o.Type == JsonTokenType.Date || (nullable && IsNullable(o))); + return (o.Type == JTokenType.Date || (nullable && IsNullable(o))); } private static bool ValidateBoolean(JToken o, bool nullable) { - return (o.Type == JsonTokenType.Boolean || (nullable && IsNullable(o))); + return (o.Type == JTokenType.Boolean || (nullable && IsNullable(o))); } private static bool ValidateString(JToken o) { - return (o.Type == JsonTokenType.String || o.Type == JsonTokenType.Comment || o.Type == JsonTokenType.Raw || IsNullable(o)); + return (o.Type == JTokenType.String || o.Type == JTokenType.Comment || o.Type == JTokenType.Raw || IsNullable(o)); } private static string GetType(JToken t) @@ -763,7 +763,7 @@ namespace Newtonsoft.Json.Linq public JsonReader CreateReader() { - return new JsonTokenReader(this); + return new JTokenReader(this); } internal static JToken FromObjectInternal(object o) @@ -773,7 +773,7 @@ namespace Newtonsoft.Json.Linq JsonSerializer jsonSerializer = new JsonSerializer(); JToken token; - using (JsonTokenWriter jsonWriter = new JsonTokenWriter()) + using (JTokenWriter jsonWriter = new JTokenWriter()) { jsonSerializer.Serialize(jsonWriter, o); token = jsonWriter.Token; diff --git a/Src/Newtonsoft.Json/Linq/JsonTokenReader.cs b/Src/Newtonsoft.Json/Linq/JTokenReader.cs similarity index 81% rename from Src/Newtonsoft.Json/Linq/JsonTokenReader.cs rename to Src/Newtonsoft.Json/Linq/JTokenReader.cs index ce1814a6..c2640d60 100644 --- a/Src/Newtonsoft.Json/Linq/JsonTokenReader.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenReader.cs @@ -9,17 +9,17 @@ namespace Newtonsoft.Json.Linq /// /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. /// - public class JsonTokenReader : JsonReader, IJsonLineInfo + public class JTokenReader : JsonReader, IJsonLineInfo { private readonly JToken _root; private JToken _parent; private JToken _current; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The token to read from. - public JsonTokenReader(JToken token) + public JTokenReader(JToken token) { ValidationUtils.ArgumentNotNull(token, "token"); @@ -84,13 +84,13 @@ namespace Newtonsoft.Json.Linq { switch (c.Type) { - case JsonTokenType.Object: + case JTokenType.Object: return JsonToken.EndObject; - case JsonTokenType.Array: + case JTokenType.Array: return JsonToken.EndArray; - case JsonTokenType.Constructor: + case JTokenType.Constructor: return JsonToken.EndConstructor; - case JsonTokenType.Property: + case JTokenType.Property: return null; default: throw MiscellaneousUtils.CreateArgumentOutOfRangeException("Type", c.Type, "Unexpected JContainer type."); @@ -133,47 +133,47 @@ namespace Newtonsoft.Json.Linq { switch (token.Type) { - case JsonTokenType.Object: + case JTokenType.Object: SetToken(JsonToken.StartObject); break; - case JsonTokenType.Array: + case JTokenType.Array: SetToken(JsonToken.StartArray); break; - case JsonTokenType.Constructor: + case JTokenType.Constructor: SetToken(JsonToken.StartConstructor); break; - case JsonTokenType.Property: + case JTokenType.Property: SetToken(JsonToken.PropertyName, ((JProperty)token).Name); break; - case JsonTokenType.Comment: + case JTokenType.Comment: SetToken(JsonToken.Comment, ((JValue)token).Value); break; - case JsonTokenType.Integer: + case JTokenType.Integer: SetToken(JsonToken.Integer, ((JValue)token).Value); break; - case JsonTokenType.Float: + case JTokenType.Float: SetToken(JsonToken.Float, ((JValue)token).Value); break; - case JsonTokenType.String: + case JTokenType.String: SetToken(JsonToken.String, ((JValue)token).Value); break; - case JsonTokenType.Boolean: + case JTokenType.Boolean: SetToken(JsonToken.Boolean, ((JValue)token).Value); break; - case JsonTokenType.Null: + case JTokenType.Null: SetToken(JsonToken.Null, ((JValue)token).Value); break; - case JsonTokenType.Undefined: + case JTokenType.Undefined: SetToken(JsonToken.Undefined, ((JValue)token).Value); break; - case JsonTokenType.Date: + case JTokenType.Date: SetToken(JsonToken.Date, ((JValue)token).Value); break; - case JsonTokenType.Raw: + case JTokenType.Raw: SetToken(JsonToken.Raw, ((JValue)token).Value); break; default: - throw MiscellaneousUtils.CreateArgumentOutOfRangeException("Type", token.Type, "Unexpected JsonTokenType."); + throw MiscellaneousUtils.CreateArgumentOutOfRangeException("Type", token.Type, "Unexpected JTokenType."); } } diff --git a/Src/Newtonsoft.Json/Linq/JsonTokenType.cs b/Src/Newtonsoft.Json/Linq/JTokenType.cs similarity index 95% rename from Src/Newtonsoft.Json/Linq/JsonTokenType.cs rename to Src/Newtonsoft.Json/Linq/JTokenType.cs index 65442fd3..d0106da3 100644 --- a/Src/Newtonsoft.Json/Linq/JsonTokenType.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenType.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json.Linq /// /// Specifies the type of token. /// - public enum JsonTokenType + public enum JTokenType { /// /// No token type has been set. diff --git a/Src/Newtonsoft.Json/Linq/JsonTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs similarity index 91% rename from Src/Newtonsoft.Json/Linq/JsonTokenWriter.cs rename to Src/Newtonsoft.Json/Linq/JTokenWriter.cs index 2ce79379..273dea37 100644 --- a/Src/Newtonsoft.Json/Linq/JsonTokenWriter.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs @@ -9,7 +9,7 @@ namespace Newtonsoft.Json.Linq /// /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. /// - public class JsonTokenWriter : JsonWriter + public class JTokenWriter : JsonWriter { private JContainer _token; private JContainer _parent; @@ -32,10 +32,10 @@ namespace Newtonsoft.Json.Linq } /// - /// Initializes a new instance of the class writing to the given . + /// Initializes a new instance of the class writing to the given . /// /// The container being written to. - public JsonTokenWriter(JContainer container) + public JTokenWriter(JContainer container) { ValidationUtils.ArgumentNotNull(container, "container"); @@ -44,9 +44,9 @@ namespace Newtonsoft.Json.Linq } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public JsonTokenWriter() + public JTokenWriter() { } @@ -89,7 +89,7 @@ namespace Newtonsoft.Json.Linq { _parent = _parent.Parent; - if (_parent != null && _parent.Type == JsonTokenType.Property) + if (_parent != null && _parent.Type == JTokenType.Property) _parent = _parent.Parent; } @@ -145,7 +145,7 @@ namespace Newtonsoft.Json.Linq { _parent.Add(value); - if (_parent.Type == JsonTokenType.Property) + if (_parent.Type == JTokenType.Property) _parent = _parent.Parent; } else diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 11c71894..bccfa8f2 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -37,10 +37,10 @@ namespace Newtonsoft.Json.Linq /// public class JValue : JToken { - private JsonTokenType _valueType; + private JTokenType _valueType; private object _value; - internal JValue(object value, JsonTokenType type) + internal JValue(object value, JTokenType type) { _value = value; _valueType = type; @@ -60,7 +60,7 @@ namespace Newtonsoft.Json.Linq /// /// The value. public JValue(long value) - : this(value, JsonTokenType.Integer) + : this(value, JTokenType.Integer) { } @@ -69,7 +69,7 @@ namespace Newtonsoft.Json.Linq /// /// The value. public JValue(ulong value) - : this(value, JsonTokenType.Integer) + : this(value, JTokenType.Integer) { } @@ -78,7 +78,7 @@ namespace Newtonsoft.Json.Linq /// /// The value. public JValue(double value) - : this(value, JsonTokenType.Float) + : this(value, JTokenType.Float) { } @@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Linq /// /// The value. public JValue(DateTime value) - : this(value, JsonTokenType.Date) + : this(value, JTokenType.Date) { } @@ -96,7 +96,7 @@ namespace Newtonsoft.Json.Linq /// /// The value. public JValue(bool value) - : this(value, JsonTokenType.Boolean) + : this(value, JTokenType.Boolean) { } @@ -105,7 +105,7 @@ namespace Newtonsoft.Json.Linq /// /// The value. public JValue(string value) - : this(value, JsonTokenType.String) + : this(value, JTokenType.String) { } @@ -145,18 +145,18 @@ namespace Newtonsoft.Json.Linq switch (_valueType) { - case JsonTokenType.Integer: + case JTokenType.Integer: if (objA is ulong || objB is ulong) return Convert.ToDecimal(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDecimal(objB, CultureInfo.InvariantCulture)); else return Convert.ToInt64(objA, CultureInfo.InvariantCulture).Equals(Convert.ToInt64(objB, CultureInfo.InvariantCulture)); - case JsonTokenType.Float: + case JTokenType.Float: return Convert.ToDouble(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDouble(objB, CultureInfo.InvariantCulture)); - case JsonTokenType.Comment: - case JsonTokenType.String: - case JsonTokenType.Boolean: + case JTokenType.Comment: + case JTokenType.String: + case JTokenType.Boolean: return objA.Equals(objB); - case JsonTokenType.Date: + case JTokenType.Date: return objA.Equals(objB); default: throw MiscellaneousUtils.CreateArgumentOutOfRangeException("valueType", _valueType, "Unexpected value type: {0}".FormatWith(CultureInfo.InvariantCulture, _valueType)); @@ -175,7 +175,7 @@ namespace Newtonsoft.Json.Linq /// A comment with the given value. public static JValue CreateComment(string value) { - return new JValue(value, JsonTokenType.Comment); + return new JValue(value, JTokenType.Comment); } /// @@ -185,7 +185,7 @@ namespace Newtonsoft.Json.Linq /// A string with the given value. public static JValue CreateString(string value) { - return new JValue(value, JsonTokenType.String); + return new JValue(value, JTokenType.String); } @@ -196,43 +196,43 @@ namespace Newtonsoft.Json.Linq /// A of raw JSON with the given value. public static JValue CreateRaw(string value) { - return new JValue(value, JsonTokenType.Raw); + return new JValue(value, JTokenType.Raw); } - private static JsonTokenType GetValueType(JsonTokenType? current, object value) + private static JTokenType GetValueType(JTokenType? current, object value) { if (value == null) - return JsonTokenType.Null; + return JTokenType.Null; else if (value is string) return GetStringValueType(current); else if (value is long || value is int || value is short || value is sbyte || value is ulong || value is uint || value is ushort || value is byte) - return JsonTokenType.Integer; + return JTokenType.Integer; else if (value is double || value is float || value is decimal) - return JsonTokenType.Float; + return JTokenType.Float; else if (value is DateTime) - return JsonTokenType.Date; + return JTokenType.Date; else if (value is DateTimeOffset) - return JsonTokenType.Date; + return JTokenType.Date; else if (value is bool) - return JsonTokenType.Boolean; + return JTokenType.Boolean; throw new ArgumentException("Could not determin JSON object type for type {0}.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); } - private static JsonTokenType GetStringValueType(JsonTokenType? current) + private static JTokenType GetStringValueType(JTokenType? current) { if (current == null) - return JsonTokenType.String; + return JTokenType.String; switch (current.Value) { - case JsonTokenType.Comment: - case JsonTokenType.String: - case JsonTokenType.Raw: + case JTokenType.Comment: + case JTokenType.String: + case JTokenType.Raw: return current.Value; default: - return JsonTokenType.String; + return JTokenType.String; } } @@ -240,7 +240,7 @@ namespace Newtonsoft.Json.Linq /// Gets the node type for this . /// /// The type. - public override JsonTokenType Type + public override JTokenType Type { get { return _valueType; } } @@ -284,22 +284,22 @@ namespace Newtonsoft.Json.Linq { switch (_valueType) { - case JsonTokenType.Comment: + case JTokenType.Comment: writer.WriteComment(_value.ToString()); break; - case JsonTokenType.Integer: + case JTokenType.Integer: WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToInt64(v, CultureInfo.InvariantCulture)), _value); break; - case JsonTokenType.Float: + case JTokenType.Float: WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToDouble(v, CultureInfo.InvariantCulture)), _value); break; - case JsonTokenType.String: + case JTokenType.String: WriteConvertableValue(writer, converters, v => writer.WriteValue(v.ToString()), _value); break; - case JsonTokenType.Boolean: + case JTokenType.Boolean: WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToBoolean(v, CultureInfo.InvariantCulture)), _value); break; - case JsonTokenType.Date: + case JTokenType.Date: WriteConvertableValue(writer, converters, v => { if (v is DateTimeOffset) @@ -308,13 +308,13 @@ namespace Newtonsoft.Json.Linq writer.WriteValue(Convert.ToDateTime(v, CultureInfo.InvariantCulture)); }, _value); break; - case JsonTokenType.Raw: + case JTokenType.Raw: writer.WriteRawValue(_value.ToString()); break; - case JsonTokenType.Null: + case JTokenType.Null: writer.WriteNull(); break; - case JsonTokenType.Undefined: + case JTokenType.Undefined: writer.WriteUndefined(); break; default: diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj index 3eb66ae5..2eacee4a 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj @@ -68,6 +68,9 @@ + + + @@ -94,11 +97,8 @@ - - - diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj index 4deeaa35..f072fe1b 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj @@ -87,11 +87,11 @@ - - - + + + diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj index a9c113bd..eaa96fc7 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj @@ -115,11 +115,11 @@ - - + + - +