~ruther/NosSmooth

13302797a0316dca05a60697cb651eb8b43f075a — František Boháček 3 years ago d610c7b
feat: skip to last token of nested levels if possible
M Core/NosSmooth.PacketSerializersGenerator/AttributeGenerators/PacketIndexAttributeGenerator.cs => Core/NosSmooth.PacketSerializersGenerator/AttributeGenerators/PacketIndexAttributeGenerator.cs +9 -0
@@ 95,6 95,15 @@ if ({parameterInfo.Name}Result.Entity is null) {{

        if (pushedLevel)
        {
            // If we know that we are not on the last token in the item level, just skip to the end of the item.
            // Note that if this is the case, then that means the converter is either corrupted
            // or the packet has more fields.
            textWriter.WriteLine($@"
while (stringEnumerator.IsOnLastToken() == false)
{{
    stringEnumerator.GetNextToken();
}}
");
            textWriter.WriteLine("stringEnumerator.PopLevel();");
        }


M Core/NosSmooth.Packets/Converters/Special/ListTypeConverter.cs => Core/NosSmooth.Packets/Converters/Special/ListTypeConverter.cs +9 -0
@@ 53,6 53,15 @@ public class ListTypeConverter : ISpecialTypeConverter
            }

            var result = _typeConverterRepository.Deserialize(genericType, stringEnumerator);

            // If we know that we are not on the last token in the item level, just skip to the end of the item.
            // Note that if this is the case, then that means the converter is either corrupted
            // or the packet has more fields.
            while (stringEnumerator.IsOnLastToken() == false)
            {
                stringEnumerator.GetNextToken();
            }

            stringEnumerator.PopLevel();
            if (!result.IsSuccess)
            {

Do not follow this link