| 217 | } |
| 218 | |
| 219 | boost::optional<model::Component> VersionTranslator::loadComponent(const openstudio::path& pathToOldOsc, ProgressBar* progressBar) { |
| 220 | LOG(Trace, "Loading component from " << toString(pathToOldOsc) << "."); |
| 221 | if (getFileExtension(pathToOldOsc) != componentFileExtension()) { |
| 222 | LOG(Error, "Cannot loadComponent for path'" << toString(pathToOldOsc) << "'. Extension must be '" << componentFileExtension() << "'. For '" |
| 223 | << modelFileExtension() << "'s use loadModel."); |
| 224 | return boost::none; |
| 225 | } |
| 226 | path wp = completePathToFile(pathToOldOsc, path(), componentFileExtension(), false); |
| 227 | openstudio::filesystem::ifstream inFile(wp); |
| 228 | if (inFile) { |
| 229 | return loadComponent(inFile, progressBar); |
| 230 | } |
| 231 | |
| 232 | return boost::none; |
| 233 | } |
| 234 | |
| 235 | boost::optional<model::Component> VersionTranslator::loadComponent(std::istream& is, ProgressBar* progressBar) { |
| 236 | model::OptionalModel result = updateVersion(is, true, progressBar); |