using System; using System.Net; namespace AppLimit.CloudComputing.SharpBox.StorageProvider.WebDav { /// /// This class implements all BoxNet specific configurations /// public class WebDavConfiguration : ICloudStorageConfiguration { private bool _trustUnsecureSslConnections = true; /// /// The url of webserver which has to be used for access to a specific /// webdav share. /// private Uri WebServer { get; set; } /// /// ctor of the Box.Net configuration /// public WebDavConfiguration(Uri uriWebDavServer) { WebServer = uriWebDavServer; UploadDataStreambuffered = false; } /// /// Specifies if we allow not secure ssl connections /// public bool TrustUnsecureSSLConnections { get { return _trustUnsecureSslConnections; } set { _trustUnsecureSslConnections = value; } } /// /// Specifies if the webdavclient should upload the data /// stream buffered. Detailed is fales to reduce the /// memory foodprint! /// public bool UploadDataStreambuffered { get; set; } /// /// This method returns a standard configuration for 1and1 /// /// public static WebDavConfiguration Get1and1Configuration() { // set the right url var config = new WebDavConfiguration(new Uri("https://sd2dav.1und1.de")) { Limits = new CloudStorageLimits { MaxDownloadFileSize = 500*1024*1024, MaxUploadFileSize = 500*1024*1024 }, // 1and1 does not support a valid ssl TrustUnsecureSSLConnections = true, }; // go ahead return config; } /// /// This method returns a standard cofiguration for StoreGate /// /// /// public static WebDavConfiguration GetStoreGateConfiguration(NetworkCredential credentials) { // set the right url var config = new WebDavConfiguration(new Uri("https://webdav1.storegate.com/" + credentials.UserName + "/home/" + credentials.UserName)) { Limits = new CloudStorageLimits { MaxDownloadFileSize = -1, MaxUploadFileSize = -1 }, // box.net does not support a valid ssl TrustUnsecureSSLConnections = false }; // go ahead return config; } /// /// This method returns a standard cofiguration for CloudMe /// /// /// public static WebDavConfiguration GetCloudMeConfiguration(NetworkCredential credentials) { // set the right url var config = new WebDavConfiguration(new Uri("http://webdav.cloudme.com/" + credentials.UserName + "/xios")) { Limits = new CloudStorageLimits { MaxDownloadFileSize = -1, MaxUploadFileSize = -1 }, // box.net does not support a valid ssl TrustUnsecureSSLConnections = false, // set streambuffered transfer UploadDataStreambuffered = true }; // go ahead return config; } /// /// This method returns a standard configuration for Strato HiDrive /// /// public static WebDavConfiguration GetHiDriveConfiguration() { // set the right url var config = new WebDavConfiguration(new Uri("https://webdav.hidrive.strato.com")) { Limits = new CloudStorageLimits { MaxDownloadFileSize = -1, MaxUploadFileSize = -1 }, // box.net does not support a valid ssl TrustUnsecureSSLConnections = false }; // go ahead return config; } public const string YaUrl = "https://webdav.yandex.ru"; public static WebDavConfiguration GetYandexConfiguration() { var config = new WebDavConfiguration(new Uri(YaUrl)) { TrustUnsecureSSLConnections = false }; return config; } #region ICloudStorageConfiguration Members private CloudStorageLimits _limits = new CloudStorageLimits { MaxDownloadFileSize = -1, MaxUploadFileSize = -1 }; /// /// Sets or gets the limits of a webdav configuration /// public CloudStorageLimits Limits { get { return _limits; } set { _limits = value; } } /// /// Gets the webdav service url /// public Uri ServiceLocator { get { return WebServer; } set { WebServer = value; } } #endregion } }