private XElement getConvertedElementFrom(byte[] serializationBytes, out int version) { var element = ElementFrom(serializationBytes); version = versionFrom(element); if (!ProjectVersions.CanLoadVersion(version)) { throw new InvalidProjectVersionException(version); } convertXml(element, version); return(element); }
private (XElement element, int originalVersion, bool conversionHappened) getConvertedElementFrom(byte[] serializationBytes) { var element = ElementFrom(serializationBytes); var originalVersion = versionFrom(element); if (!ProjectVersions.CanLoadVersion(originalVersion)) { throw new InvalidProjectVersionException(originalVersion); } var conversionHappened = convertXml(element, originalVersion); return(element, originalVersion, conversionHappened); }
public IPKSimProject Load(ISession session) { var projectFromDb = projectFromDatabase(session); if (projectFromDb == null) { throw new InvalidProjectFileException(); } if (ProjectVersions.CanLoadVersion(projectFromDb.Version)) { return(projectFrom(projectFromDb)); } //Project was created with a newer version of the software throw new InvalidProjectVersionException(projectFromDb.Version); }
public IMoBiProject Load(IMoBiContext context) { var projectFromDb = projectFromDatabase(); if (projectFromDb == null) { return(null); } if (!ProjectVersions.CanLoadVersion(projectFromDb.Version)) { throw new InvalidProjectFileException(projectFromDb.Version); } var project = projectFrom(projectFromDb); _postSerializationStepsMaker.PerformPostDeserializationFor(project, projectFromDb.Version); context.LoadFrom(project); return(project); }