MCPcopy Create free account
hub / github.com/amule-project/amule / performConvertToeMule

Method performConvertToeMule

src/PartFileConvert.cpp:224–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224ConvStatus CPartFileConvert::performConvertToeMule(const CPath& fileName)
225{
226 wxString filepartindex;
227
228 CPath folder = fileName.GetPath();
229 CPath partfile = fileName.GetFullName();
230 CPath newfilename;
231
232 CDirIterator finder(folder);
233
234 Notify_ConvertUpdateProgressFull(0, _("Reading temp folder"), s_pfconverting->folder.GetPrintable());
235
236 filepartindex = partfile.RemoveAllExt().GetRaw();
237
238 Notify_ConvertUpdateProgress(4, _("Retrieving basic information from download info file"));
239
240 CPartFile* file = new CPartFile();
241 s_pfconverting->partmettype = file->LoadPartFile(folder, partfile, false, true);
242
243 switch (s_pfconverting->partmettype) {
244 case PMT_UNKNOWN:
245 case PMT_BADFORMAT:
246 delete file;
247 return CONV_BADFORMAT;
248 }
249
250 CPath oldfile = folder.JoinPaths(partfile.RemoveExt());
251
252 {
253 wxMutexLocker lock(s_mutex);
254 s_pfconverting->size = file->GetFileSize();
255 s_pfconverting->filename = file->GetFileName();
256 s_pfconverting->filehash = file->GetFileHash().Encode();
257 }
258
259 Notify_ConvertUpdateJobInfo(s_pfconverting);
260
261 if (theApp->downloadqueue->GetFileByID(file->GetFileHash())) {
262 delete file;
263 return CONV_ALREADYEXISTS;
264 }
265
266 if (s_pfconverting->partmettype == PMT_SPLITTED) {
267 unsigned fileindex;
268 char *ba = new char [PARTSIZE];
269
270 try {
271 CFile inputfile;
272
273 // just count
274 unsigned maxindex = 0;
275 unsigned partfilecount = 0;
276 CPath filePath = finder.GetFirstFile(CDirIterator::File, filepartindex + ".*.part");
277 while (filePath.IsOk()) {
278 long l;
279 ++partfilecount;
280 filePath.GetFullName().RemoveExt().GetExt().ToLong(&l);
281 fileindex = (unsigned)l;

Callers

nothing calls this directly

Calls 15

CFormatClass · 0.85
GetPathMethod · 0.80
GetFullNameMethod · 0.80
GetPrintableMethod · 0.80
GetRawMethod · 0.80
RemoveAllExtMethod · 0.80
LoadPartFileMethod · 0.80
JoinPathsMethod · 0.80
RemoveExtMethod · 0.80
GetFirstFileMethod · 0.80
GetExtMethod · 0.80
GetNextFileMethod · 0.80

Tested by

no test coverage detected