Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }