| 1714 | } |
| 1715 | |
| 1716 | bool PersistenceManager::saveDirtyFile() |
| 1717 | { |
| 1718 | FileStream stream; |
| 1719 | stream.open( mCurrentFile, Torque::FS::File::Write ); |
| 1720 | |
| 1721 | if ( stream.getStatus() != Stream::Ok ) |
| 1722 | { |
| 1723 | clearFileData(); |
| 1724 | |
| 1725 | return false; |
| 1726 | } |
| 1727 | |
| 1728 | for (U32 i = 0; i < mLineBuffer.size(); i++) |
| 1729 | stream.writeLine((const U8*)mLineBuffer[i]); |
| 1730 | |
| 1731 | stream.close(); |
| 1732 | |
| 1733 | //Con::printf("Successfully opened and wrote %s", mCurrentFile); |
| 1734 | |
| 1735 | //Con::errorf("Updated Results:"); |
| 1736 | |
| 1737 | //for (U32 i = 0; i < mObjectBuffer.size(); i++) |
| 1738 | //{ |
| 1739 | // ParsedObject* parsedObject = mObjectBuffer[i]; |
| 1740 | |
| 1741 | // Con::warnf(" mObjectBuffer[%d]:", i); |
| 1742 | // Con::warnf(" name = %s", parsedObject->name); |
| 1743 | // Con::warnf(" className = %s", parsedObject->className); |
| 1744 | // Con::warnf(" startLine = %d", parsedObject->startLine + 1); |
| 1745 | // Con::warnf(" endLine = %d", parsedObject->endLine + 1); |
| 1746 | |
| 1747 | // //if (mObjectBuffer[i]->properties.size() > 0) |
| 1748 | // //{ |
| 1749 | // // Con::warnf(" properties:"); |
| 1750 | // // for (U32 j = 0; j < mObjectBuffer[i]->properties.size(); j++) |
| 1751 | // // Con::warnf(" %s = %s;", mObjectBuffer[i]->properties[j].name, |
| 1752 | // // mObjectBuffer[i]->properties[j].value); |
| 1753 | // //} |
| 1754 | |
| 1755 | // if (!parsedObject->simObject.isNull()) |
| 1756 | // { |
| 1757 | // SimObject* simObject = parsedObject->simObject; |
| 1758 | |
| 1759 | // Con::warnf(" SimObject(%s) %d:", simObject->getName(), simObject->getId()); |
| 1760 | // Con::warnf(" declaration line = %d", simObject->getDeclarationLine()); |
| 1761 | // } |
| 1762 | //} |
| 1763 | |
| 1764 | // Clear our file data |
| 1765 | clearFileData(); |
| 1766 | |
| 1767 | return true; |
| 1768 | } |
| 1769 | |
| 1770 | S32 QSORT_CALLBACK PersistenceManager::compareFiles(const void* a,const void* b) |
| 1771 | { |