예제 #1
0
        public static WizardOperationSettings CollectSettings(XmlTextReader xReader)
        {
            WizardOperationSettings settings = null;

            while (xReader.Read())
            {
                if (xReader.Name == "ImportSettings")
                {
                    settings = WizardDeployment.CollectImportSettings(xReader);
                }
                if (xReader.Name == "ExportSettings")
                {
                    settings = WizardDeployment.CollectExportSettings(xReader);
                }
            }

            return(settings);
        }
예제 #2
0
        private string validateSettings(StringDictionary keyValues, DeploymentType deploymentType)
        {
            string sMessage = null;

            string sSettingsFilePath = keyValues[f_csSETTINGS_FILE_PARAM];

            if (string.IsNullOrEmpty(sSettingsFilePath))
            {
                sMessage = "Error - no settings file was specifed! You must specify the path to an XML settings file " +
                           "in the 'settingsFile' parameter. This file should be generated by saving import or export " +
                           "settings in the Content Deployment Wizard";
            }

            if (!File.Exists(sSettingsFilePath))
            {
                sMessage = string.Format("Error - unable to find settings file at path '{0}'!", sSettingsFilePath);
            }

            using (XmlTextReader xReader = new XmlTextReader(sSettingsFilePath))
            {
                WizardOperationSettings settings = WizardDeployment.CollectSettings(xReader);
                if (settings is WizardExportSettings && deploymentType == DeploymentType.Import)
                {
                    sMessage = string.Format("Error - settings file '{0}' contains export settings but you selected the RunWizardImport " +
                                             "command!", sSettingsFilePath);
                }

                if (settings is WizardImportSettings && deploymentType == DeploymentType.Export)
                {
                    sMessage = string.Format("Error - settings file '{0}' contains import settings but you selected the RunWizardExport " +
                                             "command!", sSettingsFilePath);
                }
            }

            return(sMessage);
        }