| 214 | } |
| 215 | |
| 216 | FTPCache* FTPCache::LoadCache(const TiXmlElement * cacheElem) { |
| 217 | if (!cacheElem) |
| 218 | return NULL; |
| 219 | |
| 220 | if ( strcmp(FTPCache::CacheElem, cacheElem->Value()) ) |
| 221 | return NULL; |
| 222 | |
| 223 | FTPCache * cache = new FTPCache(); |
| 224 | |
| 225 | const char * localpathstr = NULL; |
| 226 | const char * externalpathstr = NULL; |
| 227 | const TiXmlElement* child = cacheElem->FirstChildElement("Location"); |
| 228 | for( ; child; child = child->NextSiblingElement("Location") ) |
| 229 | { |
| 230 | localpathstr = child->Attribute("localpath"); |
| 231 | if (!localpathstr) |
| 232 | continue; |
| 233 | TCHAR * localpath = SU::Utf8ToTChar(localpathstr); |
| 234 | if (!localpath) |
| 235 | continue; |
| 236 | |
| 237 | externalpathstr = child->Attribute("externalpath"); |
| 238 | if (!externalpathstr) |
| 239 | continue; |
| 240 | |
| 241 | cache->AddPathMap(localpath, externalpathstr); |
| 242 | SU::FreeTChar(localpath); |
| 243 | } |
| 244 | |
| 245 | return cache; |
| 246 | } |
| 247 | |
| 248 | int FTPCache::AddPathMap(const TCHAR * localpath, const char * externalpath) { |
| 249 | if (localpath == 0 || externalpath == 0) |
nothing calls this directly
no test coverage detected