Beispiel #1
0
 private void DownloadiFolder(iFolderHolder holder)
 {
     if (holder != null && holder.iFolder.IsSubscription)
        {
     string newPath = "";
         int rc = 0;
         do
         {
             iFolderAcceptDialog iad =
                     new iFolderAcceptDialog(holder.iFolder, Util.LastSetupPath);
             iad.TransientFor = this;
             rc = iad.Run();
             newPath = ParseAndReplaceTildeInPath(iad.Path);
             iad.Hide();
             iad.Destroy();
             if(rc != -5)
                 return;
             try
             {
                 ifdata.AcceptiFolderInvitation(
         holder.iFolder.ID,
         holder.iFolder.DomainID,
         newPath);
       iFoldersIconView.UnselectAll();
                 rc = 0;
                 Util.LastSetupPath = newPath;
             }
             catch(Exception e)
             {
                 DisplayCreateOrSetupException(e);
             }
         }
         while(rc == -5);
        }
 }
Beispiel #2
0
 private void DownloadiFolder(iFolderHolder holder, bool merge)
 {
     if( holder.iFolder.encryptionAlgorithm != null && holder.iFolder.encryptionAlgorithm != "")
        {
     if( IsPassPhraseAvailable(holder.iFolder.DomainID) == false)
     {
      return;
     }
        }
        if (holder != null && holder.iFolder.IsSubscription)
        {
     string newPath = "";
     int rc = 0;
      if( holder.iFolder.MigratediFolder > 0 )
      {
       if( MigrationDialog.CanBeMigrated(holder.iFolder.Name) )
       {
        iFolderMsgDialog dlg = new iFolderMsgDialog( null, iFolderMsgDialog.DialogType.Info, iFolderMsgDialog.ButtonSet.OkCancel,
                                                                                         Util.GS("Migration Alert"), Util.GS("The iFolder you have selected for downloading is a migrated iFolder.") , Util.GS("There are 2.x iFolders on your local machine. Do you want to merge this iFolder with any of the 2.x iFolders?") );
        int res = dlg.Run();
        dlg.Hide();
        dlg.Destroy();
        if( res == (int)ResponseType.Ok)
        {
     bool cancelled = false;
     do
     {
      bool result = MergeWithLocaliFolder( holder, out cancelled);
      if( result == true || cancelled == true)
       return;
     }while(cancelled == false);
        }
       }
      }
     do
     {
      iFolderAcceptDialog iad =
      new iFolderAcceptDialog(holder.iFolder, Util.LastSetupPath, merge);
      iad.TransientFor = this;
      rc = iad.Run();
      newPath = ParseAndReplaceTildeInPath(iad.Path);
      iad.Hide();
      iad.Destroy();
      if(rc != -5)
      return;
      try
      {
       if(merge == true)
       {
        String folderPath = newPath;
        if( System.IO.Path.GetFileName(folderPath) != holder.iFolder.Name)
        {
     throw new Exception("FolderDoesNotExist");
        }
        if( ifws.IsiFolder(folderPath))
        {
     throw new Exception("AtOrInsideCollectionPath");
        }
       }
       if( merge )
       {
        ifdata.AcceptiFolderInvitation(
        holder.iFolder.ID,
        holder.iFolder.DomainID,
        newPath,
        merge);
       }
       else
       {
        string downloadpath = newPath;
        System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(downloadpath);
                                   if(dir.Name == holder.iFolder.Name)
        {
                                           downloadpath = System.IO.Directory.GetParent(newPath).ToString();
     dir = new System.IO.DirectoryInfo(downloadpath);
        }
                                   if( System.IO.Directory.Exists( downloadpath+"/"+holder.iFolder.Name))
                                   {
                                           iFolderMsgDialog DownloadMergeDialog = new iFolderMsgDialog(
                                           null,
                                           iFolderMsgDialog.DialogType.Info,
                                           iFolderMsgDialog.ButtonSet.OkCancel,
                                           Util.GS("A folder with the same name already exists."),
                                           string.Format(Util.GS("Click Ok to merge the folder or Cancel to select a different location")),null);
                                           int rc1 = DownloadMergeDialog.Run();
                                           DownloadMergeDialog.Hide();
                                           DownloadMergeDialog.Destroy();
                                           if ((ResponseType)rc1 == ResponseType.Ok)
                                    {
                                                   ifdata.AcceptiFolderInvitation( holder.iFolder.ID, holder.iFolder.DomainID, System.IO.Path.Combine(downloadpath,holder.iFolder.Name),true);
                                           }
     else
      continue;
        }
        else
                                           ifdata.AcceptiFolderInvitation( holder.iFolder.ID, holder.iFolder.DomainID, downloadpath);
       }
       if( ifolderlistview.Visible )
                         GLib.Idle.Add(UpdateListViewItemsMainThread); else
        iFoldersIconView.UnselectAll();
       rc = 0;
       Util.LastSetupPath = newPath;
      }
      catch(Exception e)
      {
      DisplayCreateOrSetupException(e);
      }
     }while(rc == -5);
        }
 }