public override void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2 value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteRaw(this.____stringByteKeys[0]);
            writer.WriteString(value.Name);
            writer.WriteRaw(this.____stringByteKeys[1]);
            writer.WriteBoolean(value.BoolValue);
            writer.WriteRaw(this.____stringByteKeys[2]);
            writer.WriteSingle(value.FloatValue);
            writer.WriteRaw(this.____stringByteKeys[3]);
            writer.WriteInt32(value.IntValue);
            writer.WriteRaw(this.____stringByteKeys[4]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Vector2>(formatterResolver).Serialize(ref writer, value.Vector2, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[5]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Bounds>(formatterResolver).Serialize(ref writer, value.Bounds, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[6]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.HideFlags>(formatterResolver).Serialize(ref writer, value.Flags, formatterResolver);

            writer.WriteEndObject();
        }
        public void Serialize(ref global::Utf8Json.JsonWriter writer, global::UnityEngine.AI.NavMeshBuildSettings value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            writer.WriteRaw(this.____stringByteKeys[0]);
            writer.WriteInt32(value.agentTypeID);
            writer.WriteRaw(this.____stringByteKeys[1]);
            writer.WriteSingle(value.agentRadius);
            writer.WriteRaw(this.____stringByteKeys[2]);
            writer.WriteSingle(value.agentHeight);
            writer.WriteRaw(this.____stringByteKeys[3]);
            writer.WriteSingle(value.agentSlope);
            writer.WriteRaw(this.____stringByteKeys[4]);
            writer.WriteSingle(value.agentClimb);
            writer.WriteRaw(this.____stringByteKeys[5]);
            writer.WriteSingle(value.minRegionArea);
            writer.WriteRaw(this.____stringByteKeys[6]);
            writer.WriteBoolean(value.overrideVoxelSize);
            writer.WriteRaw(this.____stringByteKeys[7]);
            writer.WriteSingle(value.voxelSize);
            writer.WriteRaw(this.____stringByteKeys[8]);
            writer.WriteBoolean(value.overrideTileSize);
            writer.WriteRaw(this.____stringByteKeys[9]);
            writer.WriteInt32(value.tileSize);

            writer.WriteEndObject();
        }
Esempio n. 3
0
        private static void WriterUtf8JsonHelloWorldHelper(byte[] output)
        {
            global::Utf8Json.JsonWriter json = new global::Utf8Json.JsonWriter(output);

            json.WriteBeginObject();
            json.WritePropertyName("message");
            json.WriteString("Hello, World!");
            json.WriteEndObject();
        }
        public override void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.Target3 value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteBeginObject();
            writer.WriteEndObject();
        }
Esempio n. 5
0
        //[Benchmark]
        public void Utf8JsonWriteString()
        {
            global::Utf8Json.JsonWriter json = new global::Utf8Json.JsonWriter();

            json.WriteBeginObject();
            for (int i = 0; i < 100; i++)
            {
                json.WritePropertyName("fir\nst");
                json.WriteString("Joh\nn");
            }
            json.WriteEndObject();
        }
        public override void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Runtime.Tests.TestEncoding.Target2 value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteRaw(this.____stringByteKeys[0]);
            writer.WriteBoolean(value.Value);

            writer.WriteEndObject();
        }
        public override void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.TargetCollection value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteRaw(this.____stringByteKeys[0]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::System.Collections.Generic.List <global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.ITarget> >(formatterResolver).Serialize(ref writer, value.Targets, formatterResolver);

            writer.WriteEndObject();
        }
Esempio n. 8
0
        //[Benchmark]
        public void WriteArrayUtf8Json()
        {
            global::Utf8Json.JsonWriter json = new global::Utf8Json.JsonWriter(_output);

            json.WriteBeginObject();
            json.WritePropertyName("message");
            json.WriteBeginArray();
            for (int i = 0; i < _longs.Length; i++)
            {
                json.WriteInt64(_longs[i]);
            }
            json.WriteEndArray();
            json.WriteEndObject();
        }
Esempio n. 9
0
        private static void WriterUtf8JsonBasic(ReadOnlySpan <int> data)
        {
            global::Utf8Json.JsonWriter json = new global::Utf8Json.JsonWriter();

            json.WriteBeginObject();
            json.WritePropertyName("age");
            json.WriteInt32(42);
            json.WriteValueSeparator();
            json.WritePropertyName("first");
            json.WriteString("John");
            json.WriteValueSeparator();
            json.WritePropertyName("last");
            json.WriteString("Smith");
            json.WriteValueSeparator();
            json.WritePropertyName("phoneNumbers");
            json.WriteBeginArray();
            json.WriteString("425-000-1212");
            json.WriteValueSeparator();
            json.WriteString("425-000-1213");
            json.WriteEndArray();
            json.WriteValueSeparator();
            json.WritePropertyName("address");
            json.WriteBeginObject();
            json.WritePropertyName("street");
            json.WriteString("1 Microsoft Way");
            json.WriteValueSeparator();
            json.WritePropertyName("city");
            json.WriteString("Redmond");
            json.WriteValueSeparator();
            json.WritePropertyName("zip");
            json.WriteInt32(98052);
            json.WriteEndObject();
            json.WriteValueSeparator();

            json.WritePropertyName("ExtraArray");
            json.WriteBeginArray();
            for (var i = 0; i < data.Length - 1; i++)
            {
                json.WriteInt32(data[i]);
                json.WriteValueSeparator();
            }
            if (data.Length > 0)
            {
                json.WriteInt32(data[data.Length - 1]);
            }
            json.WriteEndArray();

            json.WriteEndObject();
        }
        public override void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Runtime.Tests.TestSerialization.Target2 value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteRaw(this.____stringByteKeys[0]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Vector2>(formatterResolver).Serialize(ref writer, value.Vector2, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[1]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Bounds>(formatterResolver).Serialize(ref writer, value.Bounds, formatterResolver);

            writer.WriteEndObject();
        }
Esempio n. 11
0
        //[Benchmark]
        public void Utf8JsonWriteStringRaw()
        {
            global::Utf8Json.JsonWriter json = new global::Utf8Json.JsonWriter();

            byte[] first = global::Utf8Json.JsonWriter.GetEncodedPropertyName("fir\nst");
            byte[] john  = global::Utf8Json.JsonWriter.GetEncodedPropertyName("Joh\nn");

            json.WriteBeginObject();
            for (int i = 0; i < 100; i++)
            {
                json.WriteRaw(first);
                json.WriteNameSeparator();
                json.WriteRaw(john);
            }
            json.WriteEndObject();
        }
Esempio n. 12
0
        private static void WriterUtf8JsonArrayOnly(ReadOnlySpan <int> data, byte[] output)
        {
            global::Utf8Json.JsonWriter json = new global::Utf8Json.JsonWriter(output);

            json.WriteBeginArray();
            json.WritePropertyName("ExtraArray");
            for (var i = 0; i < data.Length - 1; i++)
            {
                json.WriteInt32(data[i]);
                json.WriteValueSeparator();
            }
            if (data.Length > 0)
            {
                json.WriteInt32(data[data.Length - 1]);
            }
            json.WriteEndArray();
        }
Esempio n. 13
0
        public void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Editor.Tests.TestEditorAssembly.TestEditorTarget value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteRaw(this.____stringByteKeys[0]);
            writer.WriteBoolean(value.BoolValue);
            writer.WriteRaw(this.____stringByteKeys[1]);
            writer.WriteString(value.StringValue);
            writer.WriteRaw(this.____stringByteKeys[2]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Vector2>(formatterResolver).Serialize(ref writer, value.Vector2, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[3]);
            writer.WriteSingle(value.FloatValue);
            writer.WriteRaw(this.____stringByteKeys[4]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Bounds>(formatterResolver).Serialize(ref writer, value.Bounds, formatterResolver);

            writer.WriteEndObject();
        }
        public void Serialize(ref global::Utf8Json.JsonWriter writer, global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget3 value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
                return;
            }


            writer.WriteRaw(this.____stringByteKeys[0]);
            writer.WriteString(value.Name);
            writer.WriteRaw(this.____stringByteKeys[1]);
            writer.WriteBoolean(value.BoolValue);
            writer.WriteRaw(this.____stringByteKeys[2]);
            writer.WriteSingle(value.FloatValue);
            writer.WriteRaw(this.____stringByteKeys[3]);
            writer.WriteInt32(value.IntValue);
            writer.WriteRaw(this.____stringByteKeys[4]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Vector2>(formatterResolver).Serialize(ref writer, value.Vector2, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[5]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Bounds>(formatterResolver).Serialize(ref writer, value.Bounds, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[6]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.HideFlags>(formatterResolver).Serialize(ref writer, value.Flags, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[7]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <int[]>(formatterResolver).Serialize(ref writer, value.ArrayInt, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[8]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::System.Collections.Generic.List <int> >(formatterResolver).Serialize(ref writer, value.ListInt, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[9]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2[]>(formatterResolver).Serialize(ref writer, value.ArrayTarget, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[10]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::System.Collections.Generic.List <global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2> >(formatterResolver).Serialize(ref writer, value.ListTarget, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[11]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Keyframe[]>(formatterResolver).Serialize(ref writer, value.ArrayFrames, formatterResolver);
            writer.WriteRaw(this.____stringByteKeys[12]);
            global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <int[, ]>(formatterResolver).Serialize(ref writer, value.ArrayInt2, formatterResolver);

            writer.WriteEndObject();
        }
 public void Serialize(ref global::Utf8Json.JsonWriter writer, global::UnityEngine.HideFlags value, global::Utf8Json.IJsonFormatterResolver formatterResolver)
 {
     writer.WriteInt32((Int32)value);
 }