Example #1
0
 public void CheckLoginInfo(OperatorInfo optorInfo)
 {
     upYun = new UpYun(optorInfo.bucketName, optorInfo.operatorName, optorInfo.operatorPwd);
     upYun.setApiDomain(StrFormatUtil.FormatNetStr(optorInfo.netSelection));
     try
     {
         double useSpace = upYun.getBucketUsage();
         SFUSetting.Save();
         SFULogger.DEFAULT.InfoFormat("操作员[{0}]登录成功.BucketName=[{1}],APINet=[{2}],BucketUsage=[{3}]", optorInfo.operatorName, optorInfo.bucketName, optorInfo.netSelection, useSpace);
     }
     catch (Exception ex)
     {
         upYun = null;
         if (ex.Message.Contains("401"))
         {
             string         exceptionMsg   = String.Format("操作员[{0}]登录失败.原因:登录信息填写有误,BucketName=[{1}],APINet=[{2}],ExceptionMsg=[{3}]", optorInfo.operatorName, optorInfo.bucketName, optorInfo.netSelection, ex);
             LoginException loginException = new LoginException(401, exceptionMsg);
             SFULogger.DEFAULT.Error(loginException.Message);
             throw loginException;
         }
         else
         {
             string         exceptionMsg   = String.Format("操作员[{0}]登录失败.原因:未知,BucketName=[{1}],APINet=[{2}],ExceptionMsg=[{3}]", optorInfo.operatorName, optorInfo.bucketName, optorInfo.netSelection, ex);
             LoginException loginException = new LoginException(0, exceptionMsg);
             SFULogger.DEFAULT.Error(loginException.Message);
             throw loginException;
         }
     }
 }
Example #2
0
 public void InitStaticFileUploadMain()
 {
     // 默认设置网络选择为“自动选择”
     menuItemNetAuto.Checked = true;
     // 设置右键菜单状态
     menuItemTrans4Local.Enabled = false;
     menuItemPaste4Local.Enabled = false;
     // 设置操作员信息
     if (sfuConfigInfo != null)
     {
         try
         {
             remoteBrowserBusi.CheckLoginInfo(sfuConfigInfo.operatorInfo);
         }
         catch (LoginException ex)
         {
             MessageBox.Show(ex.Message);
             sfuConfigInfo = null;
             return;
         }
         statusLabelOperatorName.Text    = sfuConfigInfo.operatorInfo.operatorName;
         statusLabelUseSpaceValue.Text   = remoteBrowserBusi.GetSpaceUsage();
         toolStripStatusLabelStatus.Text = "登录成功!";
         menuItemTrans4Local.Enabled     = true;
     }
     else
     {
         SFUConfigInfo tempSFUConfigInfo = SFUSetting.GetInstance();
         if (tempSFUConfigInfo.loginInfo.autoLogin == true)
         {
             sfuConfigInfo = tempSFUConfigInfo;
             try
             {
                 remoteBrowserBusi.CheckLoginInfo(sfuConfigInfo.operatorInfo);
             }
             catch (LoginException ex)
             {
                 MessageBox.Show(ex.Message);
                 sfuConfigInfo = null;
                 return;
             }
             statusLabelOperatorName.Text    = sfuConfigInfo.operatorInfo.operatorName;
             statusLabelUseSpaceValue.Text   = remoteBrowserBusi.GetSpaceUsage();
             toolStripStatusLabelStatus.Text = "登录成功!";
             menuItemTrans4Local.Enabled     = true;
         }
     }
     // 添加 ListView 的数据
     LoadListViewByLocalPath();
     LoadListViewByRemotePath();
 }
 private void InitStaticFileUploadLogin()
 {
     tempSFUConfigInfo = SFUSetting.GetInstance();
     if (tempSFUConfigInfo.loginInfo.rememberPwd == true)
     {
         textBoxBucketName.Text      = tempSFUConfigInfo.operatorInfo.bucketName;
         textBoxOperatorName.Text    = tempSFUConfigInfo.operatorInfo.operatorName;
         textBoxOperatorPwd.Text     = tempSFUConfigInfo.operatorInfo.operatorPwd;
         textBoxDomain.Text          = tempSFUConfigInfo.operatorInfo.bindDomain;
         comboBoxInternet.Text       = tempSFUConfigInfo.operatorInfo.netSelection;
         checkBoxAutoLogin.Checked   = tempSFUConfigInfo.loginInfo.autoLogin;
         checkBoxRememberPwd.Checked = tempSFUConfigInfo.loginInfo.rememberPwd;
     }
     else
     {
         // 设置默认网络选择为“自动选择网络”
         comboBoxInternet.SelectedIndex = 0;
     }
 }