(StringExtensions): ToLowerShiftJis method overload for byte arrays.

This commit is contained in:
morkt
2018-05-22 17:46:35 +04:00
parent 0b52b4db80
commit adfe0a6cea

View File

@@ -184,6 +184,12 @@ namespace GameRes.Formats
public static byte[] ToLowerShiftJis (this string text) public static byte[] ToLowerShiftJis (this string text)
{ {
var text_bytes = Encodings.cp932.GetBytes (text); var text_bytes = Encodings.cp932.GetBytes (text);
text_bytes.ToLowerShiftJis();
return text_bytes;
}
public static void ToLowerShiftJis (this byte[] text_bytes)
{
for (int i = 0; i < text_bytes.Length; ++i) for (int i = 0; i < text_bytes.Length; ++i)
{ {
byte c = text_bytes[i]; byte c = text_bytes[i];
@@ -192,7 +198,6 @@ namespace GameRes.Formats
else if (c > 0x7F && c < 0xA1 || c > 0xDF) else if (c > 0x7F && c < 0xA1 || c > 0xDF)
++i; ++i;
} }
return text_bytes;
} }
} }