Exemple #1
0
        public byte[] ReaderUtf8JsonReturnBytes()
        {
            var json = new global::Utf8Json.JsonReader(_dataUtf8);

            var         outputArray = new byte[_dataUtf8.Length * 2];
            Span <byte> destination = outputArray;

            global::Utf8Json.JsonToken token = json.GetCurrentJsonToken();
            while (token != global::Utf8Json.JsonToken.None)
            {
                json.ReadNext();
                token = json.GetCurrentJsonToken();

                switch (token)
                {
                case global::Utf8Json.JsonToken.String:
                case global::Utf8Json.JsonToken.Number:
                case global::Utf8Json.JsonToken.True:
                case global::Utf8Json.JsonToken.False:
                case global::Utf8Json.JsonToken.Null:
                    ReadOnlySpan <byte> valueSpan = json.ReadNextBlockSegment();
                    valueSpan.CopyTo(destination);
                    destination[valueSpan.Length]     = (byte)',';
                    destination[valueSpan.Length + 1] = (byte)' ';
                    destination = destination.Slice(valueSpan.Length + 2);
                    break;

                default:
                    break;
                }
            }

            return(outputArray);
        }
Exemple #2
0
        public void ReaderUtf8JsonEmptyLoop()
        {
            var json = new global::Utf8Json.JsonReader(_dataUtf8);

            while (json.GetCurrentJsonToken() != global::Utf8Json.JsonToken.None)
            {
                json.ReadNext();
            }
        }
        public override global::UGF.Utf8Json.Runtime.Tests.TestEncoding.Target2 Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (reader.ReadIsNull())
            {
                return(null);
            }


            var __Value__    = default(bool);
            var __Value__b__ = false;

            var ____count = 0;

            reader.ReadIsBeginObjectWithVerify();
            while (!reader.ReadIsEndObjectWithSkipValueSeparator(ref ____count))
            {
                var stringKey = reader.ReadPropertyNameSegmentRaw();
                int key;
                if (!____keyMapping.TryGetValue(stringKey, out key))
                {
                    reader.ReadNextBlock();
                    goto NEXT_LOOP;
                }

                switch (key)
                {
                case 0:
                    __Value__    = reader.ReadBoolean();
                    __Value__b__ = true;
                    break;

                default:
                    reader.ReadNextBlock();
                    break;
                }

NEXT_LOOP:
                continue;
            }

            var ____result = new global::UGF.Utf8Json.Runtime.Tests.TestEncoding.Target2();

            if (__Value__b__)
            {
                ____result.Value = __Value__;
            }

            return(____result);
        }
        public override global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (reader.ReadIsNull())
            {
                return(null);
            }


            var __Name__           = default(string);
            var __Name__b__        = false;
            var __BoolValue__      = default(bool);
            var __BoolValue__b__   = false;
            var __FloatValue__     = default(float);
            var __FloatValue__b__  = false;
            var __IntValue__       = default(int);
            var __IntValue__b__    = false;
            var __Vector2__        = default(global::UnityEngine.Vector2);
            var __Vector2__b__     = false;
            var __Bounds__         = default(global::UnityEngine.Bounds);
            var __Bounds__b__      = false;
            var __Flags__          = default(global::UnityEngine.HideFlags);
            var __Flags__b__       = false;
            var __ArrayInt__       = default(int[]);
            var __ArrayInt__b__    = false;
            var __ListInt__        = default(global::System.Collections.Generic.List <int>);
            var __ListInt__b__     = false;
            var __ArrayTarget__    = default(global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2[]);
            var __ArrayTarget__b__ = false;
            var __ListTarget__     = default(global::System.Collections.Generic.List <global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2>);
            var __ListTarget__b__  = false;
            var __ArrayFrames__    = default(global::UnityEngine.Keyframe[]);
            var __ArrayFrames__b__ = false;

            var ____count = 0;

            reader.ReadIsBeginObjectWithVerify();
            while (!reader.ReadIsEndObjectWithSkipValueSeparator(ref ____count))
            {
                var stringKey = reader.ReadPropertyNameSegmentRaw();
                int key;
                if (!____keyMapping.TryGetValue(stringKey, out key))
                {
                    reader.ReadNextBlock();
                    goto NEXT_LOOP;
                }

                switch (key)
                {
                case 0:
                    __Name__    = reader.ReadString();
                    __Name__b__ = true;
                    break;

                case 1:
                    __BoolValue__    = reader.ReadBoolean();
                    __BoolValue__b__ = true;
                    break;

                case 2:
                    __FloatValue__    = reader.ReadSingle();
                    __FloatValue__b__ = true;
                    break;

                case 3:
                    __IntValue__    = reader.ReadInt32();
                    __IntValue__b__ = true;
                    break;

                case 4:
                    __Vector2__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Vector2>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __Vector2__b__ = true;
                    break;

                case 5:
                    __Bounds__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Bounds>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __Bounds__b__ = true;
                    break;

                case 6:
                    __Flags__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.HideFlags>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __Flags__b__ = true;
                    break;

                case 7:
                    __ArrayInt__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <int[]>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __ArrayInt__b__ = true;
                    break;

                case 8:
                    __ListInt__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::System.Collections.Generic.List <int> >(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __ListInt__b__ = true;
                    break;

                case 9:
                    __ArrayTarget__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2[]>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __ArrayTarget__b__ = true;
                    break;

                case 10:
                    __ListTarget__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::System.Collections.Generic.List <global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget2> >(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __ListTarget__b__ = true;
                    break;

                case 11:
                    __ArrayFrames__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Keyframe[]>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __ArrayFrames__b__ = true;
                    break;

                default:
                    reader.ReadNextBlock();
                    break;
                }

NEXT_LOOP:
                continue;
            }

            var ____result = new global::UGF.Utf8Json.Runtime.Tests.TestAssembly.TestTarget();

            if (__Name__b__)
            {
                ____result.Name = __Name__;
            }
            if (__BoolValue__b__)
            {
                ____result.BoolValue = __BoolValue__;
            }
            if (__FloatValue__b__)
            {
                ____result.FloatValue = __FloatValue__;
            }
            if (__IntValue__b__)
            {
                ____result.IntValue = __IntValue__;
            }
            if (__Vector2__b__)
            {
                ____result.Vector2 = __Vector2__;
            }
            if (__Bounds__b__)
            {
                ____result.Bounds = __Bounds__;
            }
            if (__Flags__b__)
            {
                ____result.Flags = __Flags__;
            }
            if (__ArrayInt__b__)
            {
                ____result.ArrayInt = __ArrayInt__;
            }
            if (__ListInt__b__)
            {
                ____result.ListInt = __ListInt__;
            }
            if (__ArrayTarget__b__)
            {
                ____result.ArrayTarget = __ArrayTarget__;
            }
            if (__ListTarget__b__)
            {
                ____result.ListTarget = __ListTarget__;
            }
            if (__ArrayFrames__b__)
            {
                ____result.ArrayFrames = __ArrayFrames__;
            }

            return(____result);
        }
 public global::UnityEngine.HideFlags Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
 {
     return((global::UnityEngine.HideFlags)reader.ReadInt32());
 }
Exemple #6
0
        public global::UGF.Utf8Json.Editor.Tests.TestEditorAssembly.TestEditorTarget Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (reader.ReadIsNull())
            {
                return(null);
            }


            var __BoolValue__      = default(bool);
            var __BoolValue__b__   = false;
            var __StringValue__    = default(string);
            var __StringValue__b__ = false;
            var __Vector2__        = default(global::UnityEngine.Vector2);
            var __Vector2__b__     = false;
            var __FloatValue__     = default(float);
            var __FloatValue__b__  = false;
            var __Bounds__         = default(global::UnityEngine.Bounds);
            var __Bounds__b__      = false;

            var ____count = 0;

            reader.ReadIsBeginObjectWithVerify();
            while (!reader.ReadIsEndObjectWithSkipValueSeparator(ref ____count))
            {
                var stringKey = reader.ReadPropertyNameSegmentRaw();
                int key;
                if (!____keyMapping.TryGetValue(stringKey, out key))
                {
                    reader.ReadNextBlock();
                    goto NEXT_LOOP;
                }

                switch (key)
                {
                case 0:
                    __BoolValue__    = reader.ReadBoolean();
                    __BoolValue__b__ = true;
                    break;

                case 1:
                    __StringValue__    = reader.ReadString();
                    __StringValue__b__ = true;
                    break;

                case 2:
                    __Vector2__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Vector2>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __Vector2__b__ = true;
                    break;

                case 3:
                    __FloatValue__    = reader.ReadSingle();
                    __FloatValue__b__ = true;
                    break;

                case 4:
                    __Bounds__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::UnityEngine.Bounds>(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __Bounds__b__ = true;
                    break;

                default:
                    reader.ReadNextBlock();
                    break;
                }

NEXT_LOOP:
                continue;
            }

            var ____result = new global::UGF.Utf8Json.Editor.Tests.TestEditorAssembly.TestEditorTarget();

            if (__BoolValue__b__)
            {
                ____result.BoolValue = __BoolValue__;
            }
            if (__StringValue__b__)
            {
                ____result.StringValue = __StringValue__;
            }
            if (__Vector2__b__)
            {
                ____result.Vector2 = __Vector2__;
            }
            if (__FloatValue__b__)
            {
                ____result.FloatValue = __FloatValue__;
            }
            if (__Bounds__b__)
            {
                ____result.Bounds = __Bounds__;
            }

            return(____result);
        }
        public override global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.TargetCollection Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (reader.ReadIsNull())
            {
                return(null);
            }


            var __Targets__    = default(global::System.Collections.Generic.List <global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.ITarget>);
            var __Targets__b__ = false;

            var ____count = 0;

            reader.ReadIsBeginObjectWithVerify();
            while (!reader.ReadIsEndObjectWithSkipValueSeparator(ref ____count))
            {
                var stringKey = reader.ReadPropertyNameSegmentRaw();
                int key;
                if (!____keyMapping.TryGetValue(stringKey, out key))
                {
                    reader.ReadNextBlock();
                    goto NEXT_LOOP;
                }

                switch (key)
                {
                case 0:
                    __Targets__    = global::Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify <global::System.Collections.Generic.List <global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.ITarget> >(formatterResolver).Deserialize(ref reader, formatterResolver);
                    __Targets__b__ = true;
                    break;

                default:
                    reader.ReadNextBlock();
                    break;
                }

NEXT_LOOP:
                continue;
            }

            var ____result = new global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.TargetCollection();

            if (__Targets__b__)
            {
                ____result.Targets = __Targets__;
            }

            return(____result);
        }
        public override global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.Target3 Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (reader.ReadIsNull())
            {
                return(null);
            }



            var ____count = 0;

            reader.ReadIsBeginObjectWithVerify();
            while (!reader.ReadIsEndObjectWithSkipValueSeparator(ref ____count))
            {
                var stringKey = reader.ReadPropertyNameSegmentRaw();
                int key;
                if (!____keyMapping.TryGetValue(stringKey, out key))
                {
                    reader.ReadNextBlock();
                    goto NEXT_LOOP;
                }

                switch (key)
                {
                default:
                    reader.ReadNextBlock();
                    break;
                }

NEXT_LOOP:
                continue;
            }

            var ____result = new global::UGF.Utf8Json.Runtime.Tests.Formatters.Typed.TestTypedFormatter.Target3();

            return(____result);
        }
        public global::UnityEngine.AI.NavMeshBuildSettings Deserialize(ref global::Utf8Json.JsonReader reader, global::Utf8Json.IJsonFormatterResolver formatterResolver)
        {
            if (reader.ReadIsNull())
            {
                throw new InvalidOperationException("typecode is null, struct not supported");
            }


            var __agentTypeID__          = default(int);
            var __agentTypeID__b__       = false;
            var __agentRadius__          = default(float);
            var __agentRadius__b__       = false;
            var __agentHeight__          = default(float);
            var __agentHeight__b__       = false;
            var __agentSlope__           = default(float);
            var __agentSlope__b__        = false;
            var __agentClimb__           = default(float);
            var __agentClimb__b__        = false;
            var __minRegionArea__        = default(float);
            var __minRegionArea__b__     = false;
            var __overrideVoxelSize__    = default(bool);
            var __overrideVoxelSize__b__ = false;
            var __voxelSize__            = default(float);
            var __voxelSize__b__         = false;
            var __overrideTileSize__     = default(bool);
            var __overrideTileSize__b__  = false;
            var __tileSize__             = default(int);
            var __tileSize__b__          = false;

            var ____count = 0;

            reader.ReadIsBeginObjectWithVerify();
            while (!reader.ReadIsEndObjectWithSkipValueSeparator(ref ____count))
            {
                var stringKey = reader.ReadPropertyNameSegmentRaw();
                int key;
                if (!____keyMapping.TryGetValue(stringKey, out key))
                {
                    reader.ReadNextBlock();
                    goto NEXT_LOOP;
                }

                switch (key)
                {
                case 0:
                    __agentTypeID__    = reader.ReadInt32();
                    __agentTypeID__b__ = true;
                    break;

                case 1:
                    __agentRadius__    = reader.ReadSingle();
                    __agentRadius__b__ = true;
                    break;

                case 2:
                    __agentHeight__    = reader.ReadSingle();
                    __agentHeight__b__ = true;
                    break;

                case 3:
                    __agentSlope__    = reader.ReadSingle();
                    __agentSlope__b__ = true;
                    break;

                case 4:
                    __agentClimb__    = reader.ReadSingle();
                    __agentClimb__b__ = true;
                    break;

                case 5:
                    __minRegionArea__    = reader.ReadSingle();
                    __minRegionArea__b__ = true;
                    break;

                case 6:
                    __overrideVoxelSize__    = reader.ReadBoolean();
                    __overrideVoxelSize__b__ = true;
                    break;

                case 7:
                    __voxelSize__    = reader.ReadSingle();
                    __voxelSize__b__ = true;
                    break;

                case 8:
                    __overrideTileSize__    = reader.ReadBoolean();
                    __overrideTileSize__b__ = true;
                    break;

                case 9:
                    __tileSize__    = reader.ReadInt32();
                    __tileSize__b__ = true;
                    break;

                default:
                    reader.ReadNextBlock();
                    break;
                }

NEXT_LOOP:
                continue;
            }

            var ____result = new global::UnityEngine.AI.NavMeshBuildSettings();

            if (__agentTypeID__b__)
            {
                ____result.agentTypeID = __agentTypeID__;
            }
            if (__agentRadius__b__)
            {
                ____result.agentRadius = __agentRadius__;
            }
            if (__agentHeight__b__)
            {
                ____result.agentHeight = __agentHeight__;
            }
            if (__agentSlope__b__)
            {
                ____result.agentSlope = __agentSlope__;
            }
            if (__agentClimb__b__)
            {
                ____result.agentClimb = __agentClimb__;
            }
            if (__minRegionArea__b__)
            {
                ____result.minRegionArea = __minRegionArea__;
            }
            if (__overrideVoxelSize__b__)
            {
                ____result.overrideVoxelSize = __overrideVoxelSize__;
            }
            if (__voxelSize__b__)
            {
                ____result.voxelSize = __voxelSize__;
            }
            if (__overrideTileSize__b__)
            {
                ____result.overrideTileSize = __overrideTileSize__;
            }
            if (__tileSize__b__)
            {
                ____result.tileSize = __tileSize__;
            }

            return(____result);
        }