All these nights (except weekends) are breaking down the code of another project by the author of Lingoes-Extractor, which is also used to analyze the LD2 file, but only one java file is done, it's really great for beginners like me to use JAVA '...
Since the first time I found the Extractor code, I have been very skeptical that this author has something to do with Lingoes, or is a real cracking master... because Extractor is perfect... there are not many codes, but they clearly mark and break down the data of each segment of LD2 and the relationship between the data... my doubts come from my understanding of the ld2 file format. The meaning of each byte in each segment is very accurate. What's more amazing is the magic number of untraceable objects, for example, the word index interval is fixed to 10, 14 bytes of index data blocks, and so on... how are these pushed out...
I prefer the latter to doubt myself, because by viewing the author's other code, it not only breaks down the ld2 file, but also contains the data files of multiple dictionaries... (If you are shocked, watch it yourself... in addition, googlecode.com is a good place ...)
I don't care about the answer, because I'm already very happy-the Extractor eventually gave me the opportunity to see the secrets of the Lingoes ld2 file...
Post the code in a segment and use the reward code to knock on it for multiple nights... (the Java code I wrote, the table is serious ...)
Private static void getData (final int index) throws IOException {
RandomAccessFile file = new RandomAccessFile ("output. data", "r ");
Final ByteBuffer buf = ByteBuffer. allocate (int) file. getChannel (). size ());
File. getChannel (). read (buf );
Buf. order (ByteOrder. LITTLE_ENDIAN );
Int offset = 29;
Final int idx [] = new int [6]; //
GetIndex (buf, offset * 10, idx );
If (idx [5]! = Idx [1]) {
Output ("self xml =" + getXml (buf, idx [1], idx [5]-idx [1]);
}
If (idx [3] = 0 ){
Output ("word =" + getWord (buf, idx [0], idx [4]-idx [0]);
}
Else {
Int ref = idx [3];
Int offsetword = idx [0];
Final int lenword = idx [4]-idx [0];
While (ref --> 0 ){
Offset = buf. getInt (lenInflatedWordsIndex + idx [0]);
GetIndex (buf, offset * 10, idx );
Output ("ref (" + offset + ") xml =" + getXml (buf, idx [1], idx [5]-idx [1]);
Offsetword + = 4;
}
Output ("word =" + getWord (buf, offsetword, lenword ));
}
File. close ();
}