|
|
@ -83,6 +83,7 @@ public: |
|
|
|
return fOutput->Write(count, buf); |
|
|
|
return fOutput->Write(count, buf); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plFileName GetFileName() const { return fFilename; } |
|
|
|
bool IsZipped() const { return fIsZipped; } |
|
|
|
bool IsZipped() const { return fIsZipped; } |
|
|
|
void Unlink() const { plFileSystem::Unlink(fFilename); } |
|
|
|
void Unlink() const { plFileSystem::Unlink(fFilename); } |
|
|
|
}; |
|
|
|
}; |
|
|
@ -104,16 +105,22 @@ static void FileDownloaded( |
|
|
|
switch (result) |
|
|
|
switch (result) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case kNetSuccess: |
|
|
|
case kNetSuccess: |
|
|
|
|
|
|
|
{ |
|
|
|
PatcherLog(kStatus, " Download Complete: %s", file.AsString().c_str()); |
|
|
|
PatcherLog(kStatus, " Download Complete: %s", file.AsString().c_str()); |
|
|
|
|
|
|
|
|
|
|
|
// If this is a PRP, then we need to add it to the ResManager
|
|
|
|
// If this is a PRP, then we need to add it to the ResManager
|
|
|
|
if (file.AsString().CompareI("prp") == 0) |
|
|
|
plFileName clientPath = static_cast<plResDownloadStream*>(writer)->GetFileName(); |
|
|
|
((plResManager*)hsgResMgr::ResMgr())->AddSinglePage(file); |
|
|
|
if (clientPath.GetFileExt().CompareI("prp") == 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
plResManager* clientResMgr = static_cast<plResManager*>(hsgResMgr::ResMgr()); |
|
|
|
|
|
|
|
clientResMgr->AddSinglePage(clientPath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Continue down the warpath
|
|
|
|
// Continue down the warpath
|
|
|
|
patcher->IssueRequest(); |
|
|
|
patcher->IssueRequest(); |
|
|
|
delete writer; |
|
|
|
delete writer; |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
case kNetErrFileNotFound: |
|
|
|
case kNetErrFileNotFound: |
|
|
|
PatcherLog(kError, " Download Failed: %s not found", file.AsString().c_str()); |
|
|
|
PatcherLog(kError, " Download Failed: %s not found", file.AsString().c_str()); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -125,7 +132,7 @@ static void FileDownloaded( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Failure case
|
|
|
|
// Failure case
|
|
|
|
((plResDownloadStream*)writer)->Unlink(); |
|
|
|
static_cast<plResDownloadStream*>(writer)->Unlink(); |
|
|
|
patcher->Finish(false); |
|
|
|
patcher->Finish(false); |
|
|
|
delete writer; |
|
|
|
delete writer; |
|
|
|
} |
|
|
|
} |
|
|
|