Esempio n. 1
0
        public void ExportFile()
        {
            // Impersonate the Site owner.
            ImpersonateSuperUser();

            IEnumerable<IExportAction> actions;

            if (!IsAnySwitchDefined("ConfigFilename", "Types", "Metadata", "Version", "SiteSettings", "Steps")) {
                // Get default configured actions.
                actions = GetDefaultConfiguration();
            }
            else {
                // Read config file if specified.
                var configurationDocument = UpdateExportConfiguration(ReadExportConfigurationFile(ConfigFilename), Types, Metadata, Data, Version, SiteSettings, Steps);

                // Get all the steps based on the configuration.
                actions = _importExportService.ParseExportActions(configurationDocument);
            }

            Context.Output.WriteLine(T("Export starting..."));
            var exportContext = new ExportActionContext();
            _importExportService.Export(exportContext, actions);
            var exportFilePath = _importExportService.WriteExportFile(exportContext.RecipeDocument);

            if (!String.IsNullOrEmpty(Filename)) {
                var directory = Path.GetDirectoryName(Filename);
                if (!Directory.Exists(directory))
                    Directory.CreateDirectory(directory);
                File.Copy(exportFilePath, Filename, overwrite: true);
                exportFilePath = Filename;
            }

            Context.Output.WriteLine(T("Export completed at {0}", exportFilePath));
        }
Esempio n. 2
0
 public void Export(ExportActionContext context, IEnumerable<IExportAction> actions = null) {
     foreach (var action in actions ?? _exportActions) {
         action.Execute(context);
     }
 }
Esempio n. 3
0
 public override void Execute(ExportActionContext context)
 {
     context.RecipeDocument = _recipeBuilder.Build(RecipeBuilderSteps);
 }
Esempio n. 4
0
 public abstract void Execute(ExportActionContext context);