22using System . Text ;
33using System . Text . Json ;
44using ExifLibrary ;
5+ using KGySoft . CoreLibraries ;
56using MetadataExtractor ;
67using MetadataExtractor . Formats . Exif ;
78using MetadataExtractor . Formats . Png ;
@@ -52,8 +53,8 @@ public static System.Drawing.Size GetImageSize(byte[] inputImage)
5253 {
5354 var imageWidthBytes = inputImage [ 0x10 ..0x14 ] ;
5455 var imageHeightBytes = inputImage [ 0x14 ..0x18 ] ;
55- var imageWidth = BitConverter . ToInt32 ( imageWidthBytes . Reverse ( ) . ToArray ( ) ) ;
56- var imageHeight = BitConverter . ToInt32 ( imageHeightBytes . Reverse ( ) . ToArray ( ) ) ;
56+ var imageWidth = BitConverter . ToInt32 ( imageWidthBytes . AsEnumerable ( ) . Reverse ( ) . ToArray ( ) ) ;
57+ var imageHeight = BitConverter . ToInt32 ( imageHeightBytes . AsEnumerable ( ) . Reverse ( ) . ToArray ( ) ) ;
5758
5859 return new System . Drawing . Size ( imageWidth , imageHeight ) ;
5960 }
@@ -66,8 +67,8 @@ public static System.Drawing.Size GetImageSize(BinaryReader reader)
6667 var imageWidthBytes = reader . ReadBytes ( 4 ) ;
6768 var imageHeightBytes = reader . ReadBytes ( 4 ) ;
6869
69- var imageWidth = BitConverter . ToInt32 ( imageWidthBytes . Reverse ( ) . ToArray ( ) ) ;
70- var imageHeight = BitConverter . ToInt32 ( imageHeightBytes . Reverse ( ) . ToArray ( ) ) ;
70+ var imageWidth = BitConverter . ToInt32 ( imageWidthBytes . AsEnumerable ( ) . Reverse ( ) . ToArray ( ) ) ;
71+ var imageHeight = BitConverter . ToInt32 ( imageHeightBytes . AsEnumerable ( ) . Reverse ( ) . ToArray ( ) ) ;
7172
7273 reader . BaseStream . Position = oldPosition ;
7374
@@ -169,7 +170,7 @@ public static string ReadTextChunk(BinaryReader byteStream, string key)
169170
170171 while ( byteStream . BaseStream . Position < byteStream . BaseStream . Length - 4 )
171172 {
172- var chunkSize = BitConverter . ToInt32 ( byteStream . ReadBytes ( 4 ) . Reverse ( ) . ToArray ( ) ) ;
173+ var chunkSize = BitConverter . ToInt32 ( byteStream . ReadBytes ( 4 ) . AsEnumerable ( ) . Reverse ( ) . ToArray ( ) ) ;
173174 var chunkType = Encoding . UTF8 . GetString ( byteStream . ReadBytes ( 4 ) ) ;
174175
175176 if ( chunkType == Encoding . UTF8 . GetString ( Idat ) )
@@ -220,7 +221,7 @@ public static string ReadTextChunk(BinaryReader byteStream, string key)
220221 while ( byteStream . BaseStream . Position < byteStream . BaseStream . Length - 4 )
221222 {
222223 var chunkSizeBytes = byteStream . ReadBytes ( 4 ) ;
223- var chunkSize = BitConverter . ToInt32 ( chunkSizeBytes . Reverse ( ) . ToArray ( ) ) ;
224+ var chunkSize = BitConverter . ToInt32 ( chunkSizeBytes . AsEnumerable ( ) . Reverse ( ) . ToArray ( ) ) ;
224225 var chunkTypeBytes = byteStream . ReadBytes ( 4 ) ;
225226 var chunkType = Encoding . UTF8 . GetString ( chunkTypeBytes ) ;
226227
0 commit comments