File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
ValveKeyValue/ValveKeyValue/Deserialization/KeyValues3 Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1- using System . Linq ;
1+ using System . Buffers ;
22using System . Text ;
33using ValveKeyValue . KeyValues3 ;
44using Encoding = ValveKeyValue . KeyValues3 . Encoding ;
@@ -16,15 +16,13 @@ class KV3TokenReader : KVTokenReader
1616 const char Assignment = '=' ;
1717 const char Comma = ',' ;
1818
19+ // Dota 2 binary from 2017 used "+" as a terminate (for flagged values), but then they changed it to "|"
20+ static readonly SearchValues < char > TokenTerminators = SearchValues . Create ( "{}[]=, \t \n \r '\" :|;" ) ;
21+
1922 public KV3TokenReader ( TextReader textReader ) : base ( textReader )
2023 {
21- // Dota 2 binary from 2017 used "+" as a terminate (for flagged values), but then they changed it to "|"
22- var terminators = "{}[]=, \t \n \r '\" :|;" . ToCharArray ( ) ;
23- integerTerminators = new HashSet < int > ( terminators . Select ( t => ( int ) t ) ) ;
2424 }
2525
26- readonly HashSet < int > integerTerminators ;
27-
2826 public KVToken ReadNextToken ( )
2927 {
3028 ObjectDisposedException . ThrowIf ( disposed , this ) ;
@@ -315,7 +313,7 @@ string ReadToken()
315313 {
316314 next = Peek ( ) ;
317315
318- if ( next <= ' ' || integerTerminators . Contains ( next ) )
316+ if ( next <= ' ' || TokenTerminators . Contains ( ( char ) next ) )
319317 {
320318 break ;
321319 }
You can’t perform that action at this time.
0 commit comments