Пример #1
0
        /// <summary>
        /// Add a deploy config.
        /// </summary>
        public void Add(DeployConfig item)
        {
            if(Contains(item.Name))
                throw new InvalidOperationException(string.Format("Deploy config '{0}' already exists.", item.Name));

            _list.Add(item);
        }
Пример #2
0
        /// <summary>
        /// Scans a directory and all subdirectory and returns all the files found that match the scan filter.
        /// If we are to use project filter, files are read from project instead of directory.
        /// </summary>
        /// <param name="project">The current project settings.</param>
        /// <param name="modifiedSince">Only return files modified after this date.</param>
        /// <returns>A structure with the files that were found.</returns>
        internal DeploymentStructure FindFiles(DeploymentProject project, DateTime modifiedSince)
        {
            // These members are used for easy access during scanning
            _project = project;
            _config = project.ActiveDeployConfig;
            if (_config == null)
                throw new ApplicationException("The project has no active deploy configuration.");

            // Build structure of matching files
            _structure = new DeploymentStructure();

            if (_config.UseProjectFilter) {
                string projectFilename = project.GetVisualStudioProjectFileName();
                if (projectFilename == null)
                    throw new ApplicationException("Could not find a Visual Studio project file in the root directory.");

                ScanProjectFile(projectFilename, project.LocalPathAbsolute, modifiedSince);
            }
            else
                ScanDirectoryRecurse(project.LocalPathAbsolute, string.Empty, modifiedSince);

            return _structure;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new project with default settings.
        /// </summary>
        public void InitNewProject()
        {
            _fileFormatVersion = 1;

            DeployConfig config = new DeployConfig(DefaultConfigName);
            _deployconfigs.Add(config);

            _localPath = ".";

            FilterSettings fs = new FilterSettings();
            ActiveDeployConfig.FilterSettings.Add(fs);

            // Add some default file types
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.asax"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.ascx"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.asp"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.aspx"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.html"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.cshtml"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.dll"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.pdb"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.png"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.gif"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.jpg"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.css"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.xslt"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.js"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.swf"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"web.config"));

            PluginManager.UnloadPlugins();
        }