@@ -136,11 +136,11 @@ static Frame[] ReadAnimation(this XmlReader reader)
136136 . ToArray ( ) ;
137137 }
138138
139- static int [ ] ReadCSV ( this XmlReader reader , int size )
139+ static uint [ ] ReadCSV ( this XmlReader reader , int size )
140140 {
141141 var data = reader . ReadElementContentAsString ( )
142142 . Split ( new [ ] { '\r ' , '\n ' , ',' } , StringSplitOptions . RemoveEmptyEntries )
143- . Select ( int . Parse )
143+ . Select ( uint . Parse )
144144 . ToArray ( ) ;
145145
146146 if ( data . Length == size )
@@ -149,41 +149,39 @@ static int[] ReadCSV(this XmlReader reader, int size)
149149 throw new XmlException ( ) ;
150150 }
151151
152- static int [ ] ReadBase64 ( this XmlReader reader , int count )
152+ static uint [ ] ReadBase64 ( this XmlReader reader , int count )
153153 {
154- var buffer = new byte [ count * sizeof ( int ) ] ;
154+ var buffer = new byte [ count * sizeof ( uint ) ] ;
155155 var size = reader . ReadElementContentAsBase64 ( buffer , 0 , buffer . Length ) ;
156156 if ( reader . ReadElementContentAsBase64 ( buffer , 0 , buffer . Length ) != 0 )
157157 throw new InvalidDataException ( ) ;
158- var data = new int [ size / sizeof ( int ) ] ;
158+ var data = new uint [ size / sizeof ( uint ) ] ;
159159 Buffer . BlockCopy ( buffer , 0 , data , 0 , size ) ;
160160 return data ;
161161 }
162- static int [ ] ReadBase64Decompress < T > ( this XmlReader reader , Func < Stream , Zlib . CompressionMode , T > streamFactory , int size )
162+ static uint [ ] ReadBase64Decompress < T > ( this XmlReader reader , Func < Stream , Zlib . CompressionMode , T > streamFactory , int size )
163163 where T : Stream
164164 {
165- var buffer = new byte [ size * sizeof ( int ) ] ;
165+ var buffer = new byte [ size * sizeof ( uint ) ] ;
166166
167167 var total = reader . ReadElementContentAsBase64 ( buffer , 0 , buffer . Length ) ;
168168 if ( reader . ReadElementContentAsBase64 ( buffer , 0 , buffer . Length ) != 0 )
169169 throw new InvalidDataException ( ) ;
170170
171- using ( var mstream = new MemoryStream ( buffer , 0 , total ) )
172- using ( var stream = streamFactory ( mstream , Zlib . CompressionMode . Decompress ) )
171+ using var mstream = new MemoryStream ( buffer , 0 , total ) ;
172+ using var stream = streamFactory ( mstream , Zlib . CompressionMode . Decompress ) ;
173+ var data = new uint [ size ] ;
174+ var pos = 0 ;
175+ int count ;
176+ while ( ( count = stream . Read ( buffer , 0 , buffer . Length ) ) > 0 )
173177 {
174- var data = new int [ size ] ;
175- var pos = 0 ;
176- int count ;
177- while ( ( count = stream . Read ( buffer , 0 , buffer . Length ) ) > 0 )
178- {
179- Buffer . BlockCopy ( buffer , 0 , data , pos , count ) ;
180- pos += count ;
181- }
182- return data ;
178+ Buffer . BlockCopy ( buffer , 0 , data , pos , count ) ;
179+ pos += count ;
183180 }
181+ return data ;
184182 }
185183
186- public static int [ ] ReadData ( this XmlReader reader , int count , out string encoding , out string compression )
184+ public static uint [ ] ReadData ( this XmlReader reader , int count , out string encoding , out string compression )
187185 {
188186 encoding = reader [ "encoding" ] ;
189187 compression = reader [ "compression" ] ;
0 commit comments