/// <summary>
 /// Tool that allows to choose type of upload based on specified path
 /// </summary>
 /// <param name="path"> Path to file(s) or folder </param>
 /// <returns>New instance of <see cref="IQuatrixUpload"/> </returns>
 public static IQuatrixUpload GetUploader( string path )
 {
     IQuatrixUpload upl;
     if (IsDirectory( path )) {
         FolderUpload dirUpl = new FolderUpload( path );
         dirUpl.Recursive = true;
         upl = dirUpl;
     }
     else {
         upl = new FileUpload( path );
     }
     return upl;
 }
 private void Uploading( Metadata parent, DirectoryInfo dirInfo, string dirName )
 {
     if (CurrentStatus == UploadStatus.Canceled) {
         return;
     }
     //Begin work
     Metadata mtd = parent.MakeDir( dirName );
     if (this.Result == null) {
         this.Result = mtd;
     }
     FileInfo[] fs = dirInfo.GetFiles();
     //Upload files from currunt directory
     foreach (var f in fs) {
         using (curUpl = new FileUpload( f.FullName )) {
             curUpl.UploadStatusChanged += curUpl_UploadStatusChanged;
             curUpl.UploadProgressChanged += curUpl_UploadProgressChanged;
             mtd.Upload( curUpl );
         }
     }
     //Check if allowed recursive uploading
     if (this.Recursive) {
         DirectoryInfo[] ds = dirInfo.GetDirectories();
         foreach (var d in ds) {
             //Skip all empty dirs
             if (CalculateDirSize( d ) > 0) {
                 Uploading( mtd, d, d.Name );
             }
         }
     }
 }