public static void DumpDictionary() { var fileBytes = File.ReadAllBytes("Game.exe"); var query = new byte[] { 0xC0, 0x00, 0xC1, 0x00, 0xC2, 0x00, 0xC3, 0x00, 0xC4, 0x00, 0xC5, 0x00, 0xC6, 0x00, 0xC7, 0x00, }; for (var i = 0; i < fileBytes.Length - query.Length; i++) { if (MemoryUtil.ByteCompare(query, fileBytes, (uint)i)) { var outBuffer = new List <byte>(); var j = i; while (j - i < 14000) { outBuffer.Add(fileBytes[j]); j++; } while (!(fileBytes[j] == 0 && fileBytes[j + 1] == 0)) { outBuffer.Add(fileBytes[j]); j++; } File.WriteAllBytes("encoding_dict.txt", outBuffer.ToArray()); return; } } }
public void TestEncode() { var input = "右耳に当て"; var actualOutput = SteinsEncoding.Encode(input); var expectedOutput = new byte[] { 0xFB, 0x02, 0x02, 0x07, 0x01, 0x02, 0xAC, 0x0A, 0xFC, 0x01 }; Console.WriteLine(expectedOutput.ToByteString()); Console.WriteLine(actualOutput.ToByteString()); Assert.IsTrue(MemoryUtil.ByteCompare(actualOutput, expectedOutput, 0)); }