IDeploymentConfigurationStorageActivity IDeploymentConfigurationFileActivity.WithPackageConfigDirectory(string directoryName)
{
int cspkgCount = 0, cscfgCount = 0;
Manager.DeploymentFolder = directoryName;
if (!Directory.Exists(directoryName))
throw new ApplicationException(String.Format("Directory {0} does not exist", directoryName));
foreach (string fileName in Directory.EnumerateFiles(directoryName))
{
if (Path.GetExtension(fileName) == Constants.CspkgExtension)
{
if (cspkgCount > 1)
throw new ApplicationException("Only a single .cspkg file can be present in the deployment folder");
Manager.LocalPackagePathName = fileName;
cspkgCount++;
}
if (Path.GetExtension(fileName) == Constants.CscfgExtension)
{
if (cscfgCount > 1)
throw new ApplicationException("Only a single .cscfg file can be present in the deployment folder");
Manager.CscfgFileInstance = CscfgFile.GetInstance(fileName);
cscfgCount++;
}
}
return Manager;
}