Exemple #1
0
        /// <summary>
        /// Validates the construction arguments required for migrating a project file.
        /// </summary>
        /// <param name="optionalProjectMigrationProperties">The construction arguments to be validated.</param>
        /// <exception cref="ArgumentException">Thrown when any construction property of
        /// <paramref name="optionalProjectMigrationProperties"/> is invalid.</exception>
        private static void ValidateProjectMigrationProperties(ProjectMigrationConstructionProperties optionalProjectMigrationProperties)
        {
            if (optionalProjectMigrationProperties.Migrator == null)
            {
                throw new ArgumentException(@"Project migrator should be set.", nameof(optionalProjectMigrationProperties));
            }

            if (optionalProjectMigrationProperties.MigrationFilePath == null)
            {
                throw new ArgumentException(@"Migration target file path should be set.", nameof(optionalProjectMigrationProperties));
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates a new instance of <see cref="OpenProjectActivity"/>.
        /// </summary>
        /// <param name="requiredOpenProjectProperties">All mandatory properties for being
        /// able to open a project.</param>
        /// <param name="optionalProjectMigrationProperties">Optional: Properties for migrating
        /// the project to the current version.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="requiredOpenProjectProperties"/>
        /// is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when any input argument has invalid values.</exception>
        public OpenProjectActivity(OpenProjectConstructionProperties requiredOpenProjectProperties,
                                   ProjectMigrationConstructionProperties optionalProjectMigrationProperties = null)
        {
            if (requiredOpenProjectProperties == null)
            {
                throw new ArgumentNullException(nameof(requiredOpenProjectProperties));
            }

            ValidateOpenProjectProperties(requiredOpenProjectProperties);
            if (optionalProjectMigrationProperties != null)
            {
                ValidateProjectMigrationProperties(optionalProjectMigrationProperties);

                migratedProjectFilePath = optionalProjectMigrationProperties.MigrationFilePath;
                migrator           = optionalProjectMigrationProperties.Migrator;
                totalNumberOfSteps = 3;
            }

            filePath     = requiredOpenProjectProperties.FilePath;
            projectOwner = requiredOpenProjectProperties.ProjectOwner;
            storage      = requiredOpenProjectProperties.ProjectStorage;

            Description = Resources.OpenProjectActivity_Open_project;
        }