| 105 | |
| 106 | |
| 107 | uint32_t WorldDownLoader::processChunk(void* buf, uint16_t len, int bytesLeft) { |
| 108 | if (cacheOut) { |
| 109 | cacheOut->write((char*)buf, len); |
| 110 | } |
| 111 | |
| 112 | worldPtr += len; |
| 113 | |
| 114 | const int totalSize = worldPtr + bytesLeft; |
| 115 | const int doneSize = worldPtr; |
| 116 | const int complete = (100 * doneSize) / totalSize; |
| 117 | const int remaining = bytesLeft / 1024; |
| 118 | |
| 119 | showError( |
| 120 | TextUtils::format("Downloading World (%2d%% complete/%d kb remaining)...", |
| 121 | complete, remaining).c_str()); |
| 122 | |
| 123 | if (bytesLeft == 0) { |
| 124 | if (cacheOut) { |
| 125 | delete cacheOut; |
| 126 | cacheOut = NULL; |
| 127 | } |
| 128 | loadCached(); |
| 129 | if (isCacheTemp) { |
| 130 | markOld(worldCachePath); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | return (bytesLeft > 0) ? worldPtr : 0; |
| 135 | } |
| 136 | |
| 137 | |
| 138 | void WorldDownLoader::cleanCache() { |
no test coverage detected