2 // This file is part of the aMule Project.
4 // Copyright (c) 2008 Dévai Tamás ( gonosztopi@amule.org )
5 // Copyright (c) 2004-2008 aMule Team ( admin@amule.org / http://www.amule.org )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "../../SafeFile.h"
30 void DecodePreferencesKadDat(const CFileDataIO
& file
)
32 DoPrint(wxT("IP : ")); Print(CKadIP(file
.ReadUInt32())); DoPrint(wxT("\n"));
33 DoPrint(wxT("(unused): ")); Print(file
.ReadUInt16()); DoPrint(wxT("\n"));
34 DoPrint(wxT("ClientID: ")); Print(file
.ReadUInt128()); DoPrint(wxT("\n"));
37 void DecodeLoadIndexDat(const CFileDataIO
& file
)
39 DoPrint(wxT("Version : ")); Print(file
.ReadUInt32()); DoPrint(wxT("\n"));
40 DoPrint(wxT("(savetime): ")); Print((time_t)file
.ReadUInt32()); DoPrint(wxT("\n"));
41 uint32_t numLoad
= file
.ReadUInt32();
42 DoPrint(wxT("numLoad : ")); Print(numLoad
); DoPrint(wxT("\n"));
43 for (uint32_t i
= 0; i
< numLoad
; i
++) {
44 DoPrint(wxString::Format(wxT("\t: { "), i
)); Print(file
.ReadUInt128()); DoPrint(wxT(", ")); Print((time_t)file
.ReadUInt32()); DoPrint(wxT(" }\n"));
48 void DecodeKeyIndexDat(const CFileDataIO
& file
)
56 DoPrint(wxT("Version : ")); Print(version
= file
.ReadUInt32()); DoPrint(wxT("\n"));
57 DoPrint(wxT("SaveTime: ")); Print((time_t)file
.ReadUInt32()); DoPrint(wxT("\n"));
58 DoPrint(wxT("ID : ")); Print(file
.ReadUInt128()); DoPrint(wxT("\n"));
59 DoPrint(wxT("numKeys : ")); Print(numKeys
= file
.ReadUInt32()); DoPrint(wxT("\n"));
60 for (uint32_t ik
= 0; ik
< numKeys
; ik
++) {
61 DoPrint(wxT("\tKeyID : ")); Print(file
.ReadUInt128()); DoPrint(wxT("\n"));
62 DoPrint(wxT("\tnumSource: ")); Print(numSource
= file
.ReadUInt32()); DoPrint(wxT("\n"));
63 for (uint32_t is
= 0; is
< numSource
; is
++) {
64 DoPrint(wxT("\t\tSourceID: ")); Print(file
.ReadUInt128()); DoPrint(wxT("\n"));
65 DoPrint(wxT("\t\tnumName : ")); Print(numName
= file
.ReadUInt32()); DoPrint(wxT("\n"));
66 for (uint32_t iN
= 0; iN
< numName
; iN
++) {
67 DoPrint(wxT("\t\t\tLifeTime : ")); Print((time_t)file
.ReadUInt32()); DoPrint(wxT("\n"));
70 DoPrint(wxT("\t\t\tnameCount: ")); Print(count
= file
.ReadUInt32()); DoPrint(wxT("\n"));
71 for (uint32_t i
= 0; i
< count
; i
++) {
72 DoPrint(wxT("\t\t\t\t{ ")); Print(file
.ReadString(true, 2)); DoPrint(wxT(", "));
73 Print(file
.ReadUInt32()); DoPrint(wxT(" }\n"));
75 DoPrint(wxT("\t\t\tipCount : ")); Print(count
= file
.ReadUInt32()); DoPrint(wxT("\n"));
76 for (uint32_t i
= 0; i
< count
; i
++) {
77 DoPrint(wxT("\t\t\t\t{ ")); Print(CKadIP(file
.ReadUInt32())); DoPrint(wxT(", "));
78 Print((time_t)file
.ReadUInt32());
82 DoPrint(wxT("\t\t\ttagCount: ")); Print(tagCount
= file
.ReadUInt8()); DoPrint(wxT("\n"));
83 for (uint32_t it
= 0; it
< tagCount
; it
++) {
84 DoPrint(wxT("\t\t\t\t"));
85 CTag
*tag
= file
.ReadTag();
95 void DecodeSourceIndexDat(const CFileDataIO
& file
)
102 DoPrint(wxT("Version : ")); Print(file
.ReadUInt32()); DoPrint(wxT("\n"));
103 DoPrint(wxT("SaveTime: ")); Print((time_t)file
.ReadUInt32()); DoPrint(wxT("\n"));
104 DoPrint(wxT("numKeys : ")); Print(numKeys
= file
.ReadUInt32()); DoPrint(wxT("\n"));
105 for (uint32_t ik
= 0; ik
< numKeys
; ik
++) {
106 DoPrint(wxT("\tKeyID : ")); Print(file
.ReadUInt128()); DoPrint(wxT("\n"));
107 DoPrint(wxT("\tnumSource: ")); Print(numSource
= file
.ReadUInt32()); DoPrint(wxT("\n"));
108 for (uint32_t is
= 0; is
< numSource
; is
++) {
109 DoPrint(wxT("\t\tSourceID: ")); Print(file
.ReadUInt128()); DoPrint(wxT("\n"));
110 DoPrint(wxT("\t\tnumName : ")); Print(numName
= file
.ReadUInt32()); DoPrint(wxT("\n"));
111 for (uint32_t iN
= 0; iN
< numName
; iN
++) {
112 DoPrint(wxT("\t\t\tLifeTime: ")); Print((time_t)file
.ReadUInt32()); DoPrint(wxT("\n"));
113 DoPrint(wxT("\t\t\ttagCount: ")); Print(tagCount
= file
.ReadUInt8()); DoPrint(wxT("\n"));
114 for (uint32_t it
= 0; it
< tagCount
; it
++) {
115 DoPrint(wxT("\t\t\t\t"));
116 CTag
*tag
= file
.ReadTag();
126 void DecodeNodesDat(const CFileDataIO
& file
)
128 uint32_t numContacts
= file
.ReadUInt32();
129 uint32_t fileVersion
= 0;
131 DoPrint(wxT("NumContacts #1: ")); Print(numContacts
); DoPrint(wxT("\n"));
132 if (numContacts
== 0) {
133 DoPrint(wxT("FileVersion : ")); Print(fileVersion
= file
.ReadUInt32()); DoPrint(wxT("\n"));
134 if (fileVersion
>= 1) {
135 DoPrint(wxT("NumContacts #2: ")); Print(numContacts
= file
.ReadUInt32()); DoPrint(wxT("\n"));
138 for (uint32_t i
= 0; i
< numContacts
; i
++) {
139 DoPrint(wxT("\t{ "));
140 Print(file
.ReadUInt128()); DoPrint(wxT(", "));
141 Print(CKadIP(file
.ReadUInt32())); DoPrint(wxT(", "));
142 Print(file
.ReadUInt16()); DoPrint(wxT(", "));
143 Print(file
.ReadUInt16()); DoPrint(wxT(", "));
144 Print(file
.ReadUInt8());
145 if (fileVersion
>= 2) {
146 DoPrint(wxT(", { "));
147 PrintHex(file
.ReadUInt32());
149 Print(CKadIP(file
.ReadUInt32()));
150 DoPrint(wxT(" }, "));
151 Print(file
.ReadUInt8() != 0);
153 DoPrint(wxT(" }\n"));