codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
// XplCheatEditor.Form1 private void BytesOpen(byte[] bs) { try { int i = 8; while (i < bs.Length - 4) { int num = this.NameEndPoint(ref bs, i);//NULLすとりんぐ検索 byte b = bs[num + 5]; Form1.GameCode gameCode = default(Form1.GameCode); gameCode.code_names = new StringCollection(); gameCode.code_datas = new StringCollection(); gameCode.game_name = this.GameName(ref bs, i, num); i = num + 7; for (int j = 0; j < (int)b; j++) { num = this.NameEndPoint(ref bs, i); gameCode.code_names.Add(this.GameName(ref bs, i, num)); int num2 = (int)bs[num + 5]; i = num + 7; if (num2 == 0) { gameCode.code_datas.Add("00000000 00000000"); } else { gameCode.code_datas.Add(this.GetCodes(ref bs, num2, i)); i += 8 * num2; } } this.code_array.Add(gameCode); } Form1.Del del = new Form1.Del(this.TreeViewAdd); this.treeView1.Invoke(del); } catch { this.code_array.Clear(); this.treeView1.get_Nodes().Clear(); MessageBox.Show("ファイルの読み込みに失敗しました。", "エラー"); } } // XplCheatEditor.Form1 private string GameName(ref byte[] bs, int start, int end) { byte[] array = new byte[(end - start + 1) / 2]; int num = 0; int num2 = 0; for (int i = start; i < end; i++) { if (num == 0 || num == 1) { array[num2] = bs[i]; num2++; } else if (num == 3) { num = -1; } num++; } return Encoding.get_Unicode().GetString(array, 0, array.Length); } // XplCheatEditor.Form1 private string GetCodes(ref byte[] bs, int loop, int start) { string text = ""; for (int i = 0; i < loop; i++) { string text2 = ""; string text3 = ""; for (int j = 7; j >= 0; j--) { if (j < 4) { text2 += bs[start + j + i * 8].ToString("X2"); } else { text3 += bs[start + j + i * 8].ToString("X2"); } } string text4 = text; text = string.Concat(new string[] { text4, text2, " ", text3, "\r\n" }); } return text; } // XplCheatEditor.Form1 private void FileSave(string path) { MemoryStream memoryStream = new MemoryStream(); for (int i = 0; i < this.code_array.get_Count(); i++) { Form1.GameCode gameCode = (Form1.GameCode)this.code_array.get_Item(i); byte[] array = this.Name2Byte(gameCode.game_name); memoryStream.Write(array, 0, array.Length); int count = gameCode.code_names.get_Count(); memoryStream.WriteByte((byte)count); memoryStream.WriteByte(0); for (int j = 0; j < count; j++) { array.Initialize(); array = this.Name2Byte(gameCode.code_names.get_Item(j)); memoryStream.Write(array, 0, array.Length); array.Initialize(); array = this.Codes2Byte(gameCode.code_datas.get_Item(j)); memoryStream.Write(array, 0, array.Length); } } if (memoryStream.get_Length() == 0L) { memoryStream.Close(); MessageBox.Show("コードがないので書き込みを中止しました。", "エラー"); return; } memoryStream.Write(new byte[] { 255, 255, 255, 255 }, 0, 4); byte[] array2 = memoryStream.ToArray(); string s = memoryStream.get_Length().ToString("X2"); s = this.NlenTo8len(s); Crc32 crc = new Crc32(); crc.Reset(); crc.Update(array2); string s2 = crc.Value.ToString("X2"); s2 = this.NlenTo8len(s2); byte[] array3 = this.String2Byte(s); byte[] array4 = this.String2Byte(s2); FileStream fileStream = new FileStream(path, 2, 2); fileStream.Write(array3, 0, array3.Length);//ファイルのサイズ fileStream.Write(array4, 0, array4.Length);//ふぁいるのCRC32 fileStream.Write(array2, 0, array2.Length);//コード全体 fileStream.Close(); memoryStream.Close(); } // XplCheatEditor.Form1 private int NameEndPoint(ref byte[] bs, int start) { byte b = 0; int num = 0; int num2 = start; while (true) { byte b2 = bs[num2]; if (b2 == 0 && b == 0) { num++; } else { num = 0; } if (num == 5) { break; } b = b2; num2++; } if (num2 % 2 == 0) { num2++; } return num2 - 4; }
Private
[
?
]
Run code
Submit