|
|
@ -91,8 +91,9 @@ public static class PngDataHelper |
|
|
|
private static byte[] BuildTextChunk(string key, string value) |
|
|
|
private static byte[] BuildTextChunk(string key, string value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var textData = $"{key}\0{value}"; |
|
|
|
var textData = $"{key}\0{value}"; |
|
|
|
var textDataLength = BitConverter.GetBytes(textData.Length).Reverse(); |
|
|
|
var dataBytes = Encoding.UTF8.GetBytes(textData); |
|
|
|
var textDataBytes = Text.Concat(Encoding.UTF8.GetBytes(textData)).ToArray(); |
|
|
|
var textDataLength = BitConverter.GetBytes(dataBytes.Length).Reverse(); |
|
|
|
|
|
|
|
var textDataBytes = Text.Concat(dataBytes).ToArray(); |
|
|
|
var crc = BitConverter.GetBytes(Crc32Algorithm.Compute(textDataBytes)); |
|
|
|
var crc = BitConverter.GetBytes(Crc32Algorithm.Compute(textDataBytes)); |
|
|
|
|
|
|
|
|
|
|
|
return textDataLength.Concat(textDataBytes).Concat(crc).ToArray(); |
|
|
|
return textDataLength.Concat(textDataBytes).Concat(crc).ToArray(); |
|
|
|