| 416 | } |
| 417 | |
| 418 | bool ProjectControl::deleteItemFromProject(size_t _index) |
| 419 | { |
| 420 | bool deleted = false; |
| 421 | |
| 422 | MyGUI::UString fileName = common::concatenatePath(mProjectPath, mProjectName); |
| 423 | |
| 424 | MyGUI::xml::Document doc; |
| 425 | if (!doc.open(fileName)) |
| 426 | { |
| 427 | MYGUI_LOGGING(LogSection, Error, doc.getLastError()); |
| 428 | return false; |
| 429 | } |
| 430 | |
| 431 | MyGUI::xml::ElementPtr root = doc.getRoot(); |
| 432 | if ((nullptr == root) || (root->getName() != "MyGUI")) |
| 433 | { |
| 434 | MYGUI_LOGGING(LogSection, Error, "'" << fileName << "', tag 'MyGUI' not found"); |
| 435 | return false; |
| 436 | } |
| 437 | |
| 438 | if (root->findAttribute("type") == "Resource") |
| 439 | { |
| 440 | // берем детей и крутимся |
| 441 | MyGUI::xml::ElementEnumerator element = root->getElementEnumerator(); |
| 442 | while (element.next("Resource")) |
| 443 | { |
| 444 | if (element->findAttribute("type") == "ResourceLayout") |
| 445 | { |
| 446 | if (_index == 0) |
| 447 | { |
| 448 | root->removeChild(element.current()); |
| 449 | deleted = true; |
| 450 | break; |
| 451 | } |
| 452 | |
| 453 | _index--; |
| 454 | } |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | doc.save(fileName); |
| 459 | |
| 460 | return deleted; |
| 461 | } |
| 462 | |
| 463 | bool ProjectControl::renameItemInProject(size_t _index, const MyGUI::UString& _name) |
| 464 | { |
nothing calls this directly
no test coverage detected