0

OK、この時点で立ち往生しています... 2つのファイルを比較し、あるファイルから別のファイルに文字列をコピー(置換)したいと思います。

サンプルファイル1:

01cd74a8h: 65 00 00 00 54 45 53 54 00 00 00 00 00 00 00 00 ; e...TEST........
01cd74b8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd74c8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd74d8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd74e8h: 00 00 00 00 00 00 20 C5 00 00 00 00 00 00 20 C5 ; ...... ?..... ?
01cd74f8h: 00 00 20 45 00 00 00 00 00 00 20 45 01 00 00 00 ; .. E...... E....
01cd7508h: 00 00 00 00 00 00 00 00 C9 00 00 00 54 61 6D 20 ; ........?..Tam 
01cd7518h: 54 61 20 51 75 61 6E 00 00 00 00 00 00 00 00 00 ; Ta Quan.........
01cd7528h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd7538h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd7548h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 45 ; .............. E
01cd7558h: 00 00 00 00 00 00 20 C5 00 00 F0 45 00 00 00 00 ; ...... ?.餎....
01cd7568h: 00 00 20 45 01 00 00 00 00 00 00 00 00 00 00 00 ; .. E............
01cd7578h: 2D 01 00 00 4C 69 65 75 20 43 68 69 6E 68 20 51 ; -...Lieu Chinh Q
01cd7588h: 75 61 6E 00 00 00 00 00 00 00 00 00 00 00 00 00 ; uan.............
01cd7598h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd75a8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd75b8h: 00 00 00 00 00 00 F0 C5 00 00 00 00 00 00 20 C5 ; ......鹋...... ?
01cd75c8h: 00 00 20 C5 00 00 00 00 00 00 20 45 01 00 00 00 ; .. ?..... E....
01cd75d8h: 00 00 00 00 00 00 00 00 91 01 00 00 56 6F 20 54 ; ........?..Vo T
01cd75e8h: 68 69 65 6E 20 43 61 63 20 31 00 00 00 00 00 00 ; hien Cac 1......
01cd75f8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd7608h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01cd7618h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 C4 ; ..............H?
01cd7628h: 00 00 00 00 00 00 48 C4 00 00 48 44 00 00 00 00 ; ......H?.HD....
01cd7638h: 00 00 48 44 00 00 00 00 10 CA 9A 3B 00 00 00 00 ; ..HD.....蕷;....

サンプルファイル2:

01b954a8h: 65 00 00 00 43 65 6E 74 72 61 6C 20 56 61 6C 6C ; e...Central Vall
01b954b8h: 65 79 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ey..............
01b954c8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b954d8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b954e8h: 00 00 00 00 00 00 20 C5 00 00 00 00 00 00 20 C5 ; ...... ?..... ?
01b954f8h: 00 00 20 45 00 00 00 00 00 00 20 45 01 00 00 00 ; .. E...... E....
01b95508h: 00 00 00 00 00 00 00 00 C9 00 00 00 48 69 6C 6C ; ........?..Hill
01b95518h: 20 56 61 6C 6C 65 79 00 00 00 00 00 00 00 00 00 ;  Valley.........
01b95528h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b95538h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b95548h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 45 ; .............. E
01b95558h: 00 00 00 00 00 00 20 C5 00 00 F0 45 00 00 00 00 ; ...... ?.餎....
01b95568h: 00 00 20 45 01 00 00 00 00 00 00 00 00 00 00 00 ; .. E............
01b95578h: 2D 01 00 00 52 69 76 65 72 73 69 64 65 20 50 6C ; -...Riverside Pl
01b95588h: 61 69 6E 73 00 00 00 00 00 00 00 00 00 00 00 00 ; ains............
01b95598h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b955a8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b955b8h: 00 00 00 00 00 00 F0 C5 00 00 00 00 00 00 20 C5 ; ......鹋...... ?
01b955c8h: 00 00 20 C5 00 00 00 00 00 00 20 45 01 00 00 00 ; .. ?..... E....
01b955d8h: 00 00 00 00 00 00 00 00 91 01 00 00 46 6F 72 62 ; ........?..Forb
01b955e8h: 69 64 64 65 6E 20 54 6F 77 65 72 20 31 46 00 00 ; idden Tower 1F..
01b955f8h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b95608h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
01b95618h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 C4 ; ..............H?
01b95628h: 00 00 00 00 00 00 48 C4 00 00 48 44 00 00 00 00 ; ......H?.HD....
01b95638h: 00 00 48 44 00 00 00 00 10 CA 9A 3B 00 00 00 00 ; ..HD.....蕷;....

私がやりたいのは、File1とFile2を比較して、アイテムIDに一致するものがあるかどうかを確認し、アイテムが存在する場合にのみFile2の情報をFile1にコピーすることです。

アイテムIDは、アイテム名の4バイト後ろから始まります。

  01b954a8h: 65 00 00 00 43 65 6E 74 72 61 6C 20 56 61 6C 6C ; e...Central Vall
  01b954b8h: 65 79 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ey..............

  01b95508h: 00 00 00 00 00 00 00 00 C9 00 00 00 48 69 6C 6C ; ........?..Hill
  01b95518h: 20 56 61 6C 6C 65 79 00 00 00 00 00 00 00 00 00 ;  Valley.........

ここでは、「6500」と「C900」がそれぞれセントラルバレーとヒルバレーのIDであることがわかります。

4

2 に答える 2

1

私には、なぜこれを16進数で実行したいのかは明確ではありません。テキストとして扱うことができるようです。

私の考えでは、正規表現を使用して空白で区切られた単語を検索し、2、3文字をバックアップしてID文字を取得する必要があります(必要に応じて16進数に変換できます)。

于 2012-05-10T18:46:56.680 に答える
0

アイテムをリストボックスにロードする代わりに、アイテムを2つのDictionaryオブジェクトにロードします(整数はアイテムのID、文字列はアイテムの説明です。ファイルごとに1つのディクショナリをロードします。次に、ディクショナリ内のアイテムを比較して、何でも作成します。 1つの辞書に加える必要のある変更を加えて、ファイルに保存し直します。

于 2012-05-10T18:49:23.523 に答える