Exemplo n.º 1
0
        private static UploaderConfiguration CreateConfiguration()
        {
            if (string.IsNullOrEmpty(_username) || string.IsNullOrEmpty(_password))
                throw new ArgumentException("Username or Password cannot be empty.");
            if (string.IsNullOrEmpty (_categoryName))
                _categoryName = "Other";
            if (string.IsNullOrEmpty (_subCategoryName))
                _subCategoryName = string.Empty;
            if (string.IsNullOrEmpty (_albumName)) {
                _albumName = Path.GetDirectoryName (_directory);
            }
            if (Directory.Exists (_directory) == false) {
                throw new DirectoryNotFoundException(string.Format("Cannot find folder {0}.", _directory));
            }
            else
            {
                _directory = Path.GetFullPath(_directory);
            }

            var configuration = new UploaderConfiguration
            {
                Username = _username,
                Password = _password,

                CategoryName = _categoryName,
                SubCategoryName = _subCategoryName,
                AlbumName = _albumName,

                Directory = _directory,

            };

            return configuration;
        }
Exemplo n.º 2
0
 public void ConfigureUploader(UploaderConfiguration configuration)
 {
     _configuration = configuration;
 }