public FtpStorageService(ICmsConfiguration config)
{
try
{
var serviceSection = config.Storage;
var mode = serviceSection.GetValue("UsePassiveMode");
rootUrl = config.Storage.ContentRoot;
usePassiveMode = mode != null && bool.Parse(mode);
ftpRoot = serviceSection.GetValue("FtpRoot");
userName = serviceSection.GetValue("FtpUserName");
password = serviceSection.GetValue("FtpPassword");
if (string.IsNullOrEmpty(rootUrl))
{
throw new StorageException("ContentRoot is missing in a storage configuration.");
}
rootUrl = rootUrl.TrimEnd('/');
}
catch (Exception e)
{
throw new StorageException(string.Format("Failed to initialize storage service {0}.", GetType()), e);
}
}