Ejemplo n.º 1
0
 private void connectToServer()
 {
     if ( this.domainInfo != null )
        {
     if ( password == null )
     {
      connectResult = authenticate();
     }
     else
     {
      connectResult = login();
     }
        }
        else
        {
     connectResult = initialConnect();
        }
     if (connectResult)
     {
         try
         {
             bool serverOld = false;
             bool res = FormsTrayApp.ClientUpdates(domainInfo.ID, out serverOld);
             if (res == false)
             {
                 try
                 {
                     simiasWebService.LeaveDomain(domainInfo.ID, false);
                 }
                 catch { }
                 if (serverOld == false)
                 {
                     if (!autoAccountEnabled)
                     {
                         MessageBox.Show(resourceManager.GetString("UpgradeNeededMsg"), resourceManager.GetString("DisableLoginMsg"), MessageBoxButtons.OK);
                     }
                     else
                     {
                         FormsTrayApp.log.Info(resourceManager.GetString("UpgradeNeededMsg"));
                     }
                     connectResult = false;
                 }
             }
         }
         catch (Exception ex)
         {
             FormsTrayApp.log.Info("Error in webservice {0}", ex.ToString());
             if (ex.Message.IndexOf("timed out") != -1)
                 if (FormsTrayApp.UpgradeProgress())
                     FormsTrayApp.ShutdownForms();
         }
     }
        if( connectResult)
        {
     bool passPhraseStatus = false;
     bool passphraseStatus = false;
     int policy =0;
     if( this.ifWebService != null )
     {
             try
             {
                 policy = this.ifWebService.GetSecurityPolicy(this.domainInfo.ID);
             }
             catch (Exception ex)
             {
                 FormsTrayApp.log.Debug(ex.Message, ex.StackTrace);
             }
     }
     if( policy %2==0 || this.ifWebService == null)
     {
      BeginInvoke( this.connectDoneDelegate );
      return;
     }
     try
     {
      passphraseStatus = this.simiasWebService.IsPassPhraseSet(this.domainInfo.ID);
     }
     catch(Exception ex)
     {
      MessageBox.Show( resourceManager.GetString("IsPassphraseSetException") + ex.Message);
      BeginInvoke( this.connectDoneDelegate );
      return;
     }
     if(passphraseStatus == true)
     {
      string passphrasecheck = null;
      if( this.simiasWebService.GetRememberOption(this.domainInfo.ID) == true )
      {
       passphrasecheck = this.simiasWebService.GetPassPhrase(this.domainInfo.ID);
      }
      if( passphrasecheck == null || passphrasecheck =="")
      {
       VerifyPassphraseDialog vpd = new VerifyPassphraseDialog(this.domainInfo.ID, this.simiasWebService);
       vpd.ShowDialog();
       passPhraseStatus = vpd.PassphraseStatus;
      }
      else
      {
       passPhraseStatus = true;
      }
     }
     else
     {
      EnterPassphraseDialog enterPassPhrase= new EnterPassphraseDialog(this.domainInfo.ID, this.simiasWebService, this.ifWebService);
      enterPassPhrase.ShowDialog();
      passPhraseStatus = enterPassPhrase.PassphraseStatus;
     }
     if( passPhraseStatus == false)
     {
     }
        }
        BeginInvoke( this.connectDoneDelegate );
 }
Ejemplo n.º 2
0
 private iFolderWeb CreateDefaultiFolder( bool shared)
 {
     try
        {
     DirectoryInfo di = new DirectoryInfo( this.LocationEntry.Text );
     di.Create();
        }
        catch( Exception ex)
        {
     DisplayErrorMesg(ex);
     return null;
        }
        if( shared)
        {
     iFolderWeb ifolder = null;
     try
     {
             ifolder = this.ifws.CreateiFolderInDomainEncr(this.LocationEntry.Text, domainInfo.ID, this.SecureSync.Checked,null,null);
     }
     catch( Exception ex)
     {
      DisplayErrorMesg(ex);
      return null;
     }
     return ifolder;
        }
        else
        {
     string algorithm = "BlowFish";
     bool passPhraseStatus = false;
     bool passphraseStatus = false;
     try
     {
      passphraseStatus = simws.IsPassPhraseSet(domainInfo.ID);
     }
     catch(Exception ex)
     {
      return null;
     }
     if(passphraseStatus == true)
     {
      string passphrasecheck = null;
      passphrasecheck = simws.GetPassPhrase(domainInfo.ID);
      if( passphrasecheck == null || passphrasecheck =="")
      {
       VerifyPassphraseDialog vpd = new VerifyPassphraseDialog(domainInfo.ID, this.simws);
       vpd.ShowDialog();
       passPhraseStatus = vpd.PassphraseStatus;
      }
      else
      {
       passPhraseStatus = true;
      }
     }
     else
     {
      EnterPassphraseDialog enterPassPhrase= new EnterPassphraseDialog(domainInfo.ID, this.simws,this.ifws);
      enterPassPhrase.ShowDialog();
      passPhraseStatus = enterPassPhrase.PassphraseStatus;
     }
     if( passPhraseStatus == true)
     {
      string Passphrase = simws.GetPassPhrase(domainInfo.ID);
      iFolderWeb ifolder = null;
      try
      {
       ifolder = this.ifws.CreateiFolderInDomainEncr(this.LocationEntry.Text, domainInfo.ID,this.SecureSync.Checked, algorithm, Passphrase);
      }
      catch( Exception ex)
      {
       DisplayErrorMesg(ex);
       return null;
      }
      return ifolder;
     }
        }
        return null;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create Default iFolder
 /// </summary>
 /// <param name="shared">true if shared else encryoted</param>
 private iFolderWeb CreateDefaultiFolder(bool shared)
 {
     try
     {
         DirectoryInfo di = new DirectoryInfo(this.LocationEntry.Text);
         di.Create();
     }
     catch (Exception ex)
     {
         // Unable to create the folder
         DisplayErrorMesg(ex);
         return(null);
     }
     if (shared)
     {
         iFolderWeb ifolder = null;
         try
         {
             //ifolder = this.ifws.CreateiFolderInDomain(this.LocationEntry.Text, this.domainInfo.ID);
             ifolder = this.ifws.CreateiFolderInDomainEncr(this.LocationEntry.Text, domainInfo.ID, this.SecureSync.Checked, null, null);
         }
         catch (Exception ex)
         {
             DisplayErrorMesg(ex);
             return(null);
         }
         return(ifolder);
     }
     else
     {
         string algorithm        = "BlowFish";
         bool   passPhraseStatus = false;
         bool   passphraseStatus = false;
         try
         {
             passphraseStatus = simws.IsPassPhraseSet(domainInfo.ID);
         }
         catch (Exception)
         {
             //	MessageBox.Show("Unable to contact the server.");
             return(null);
         }
         if (passphraseStatus == true)
         {
             // if passphrase not given during login
             string passphrasecheck = null;
             passphrasecheck = simws.GetPassPhrase(domainInfo.ID);
             if (passphrasecheck == null || passphrasecheck == "")
             {
                 VerifyPassphraseDialog vpd = new VerifyPassphraseDialog(domainInfo.ID, this.simws);
                 vpd.ShowDialog();
                 passPhraseStatus = vpd.PassphraseStatus;
             }
             else
             {
                 passPhraseStatus = true;
             }
         }
         else
         {
             // Passphrase not enterd at the time of login...
             EnterPassphraseDialog enterPassPhrase = new EnterPassphraseDialog(domainInfo.ID, this.simws, this.ifws);
             enterPassPhrase.ShowDialog();
             passPhraseStatus = enterPassPhrase.PassphraseStatus;
         }
         if (passPhraseStatus == true)
         {
             // check for passphrase existence and display corresponding dialogs.
             string     Passphrase = simws.GetPassPhrase(domainInfo.ID);
             iFolderWeb ifolder    = null;
             try
             {
                 ifolder = this.ifws.CreateiFolderInDomainEncr(this.LocationEntry.Text, domainInfo.ID, this.SecureSync.Checked, algorithm, Passphrase);
             }
             catch (Exception ex)
             {
                 DisplayErrorMesg(ex);
                 return(null);
             }
             return(ifolder);
         }
     }
     return(null);
 }