From 002fe17a16f0a9fa5bb71654dd95c72c35f253b8 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 07 十二月 2020 23:10:46 +0800
Subject: [PATCH] 0312 更新ExecuteAlways 升级litjson

---
 Assets/Plugins/LitJson/JsonWriter.cs |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/Assets/Plugins/LitJson/JsonWriter.cs b/Assets/Plugins/LitJson/JsonWriter.cs
index bdcf9c4..7a410b3 100644
--- a/Assets/Plugins/LitJson/JsonWriter.cs
+++ b/Assets/Plugins/LitJson/JsonWriter.cs
@@ -39,7 +39,7 @@
     public class JsonWriter
     {
         #region Fields
-        private static NumberFormatInfo number_format;
+        private static readonly NumberFormatInfo number_format;
 
         private WriterContext        context;
         private Stack<WriterContext> ctx_stack;
@@ -50,6 +50,7 @@
         private StringBuilder        inst_string_builder;
         private bool                 pretty_print;
         private bool                 validate;
+        private bool                 lower_case_properties;
         private TextWriter           writer;
         #endregion
 
@@ -75,6 +76,11 @@
         public bool Validate {
             get { return validate; }
             set { validate = value; }
+        }
+
+        public bool LowerCaseProperties {
+            get { return lower_case_properties; }
+            set { lower_case_properties = value; }
         }
         #endregion
 
@@ -166,6 +172,7 @@
             indent_value = 4;
             pretty_print = false;
             validate = true;
+            lower_case_properties = false;
 
             ctx_stack = new Stack<WriterContext> ();
             context = new WriterContext ();
@@ -216,7 +223,7 @@
                 writer.Write (',');
 
             if (pretty_print && ! context.ExpectingValue)
-                writer.Write ('\n');
+                writer.Write (Environment.NewLine);
         }
 
         private void PutString (string str)
@@ -365,6 +372,7 @@
             context.ExpectingValue = false;
         }
 
+        [CLSCompliant(false)]
         public void Write (ulong number)
         {
             DoValidation (Condition.Value);
@@ -441,14 +449,17 @@
         {
             DoValidation (Condition.Property);
             PutNewline ();
+            string propertyName = (property_name == null || !lower_case_properties)
+                ? property_name
+                : property_name.ToLowerInvariant();
 
-            PutString (property_name);
+            PutString (propertyName);
 
             if (pretty_print) {
-                if (property_name.Length > context.Padding)
-                    context.Padding = property_name.Length;
+                if (propertyName.Length > context.Padding)
+                    context.Padding = propertyName.Length;
 
-                for (int i = context.Padding - property_name.Length;
+                for (int i = context.Padding - propertyName.Length;
                      i >= 0; i--)
                     writer.Write (' ');
 

--
Gitblit v1.8.0