Beispiel #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;
         }
     }
 }
Beispiel #2
0
 public string GetSpaceUsage()
 {
     return(SFUCommon.GetCommonSize(upYun.getBucketUsage()));
 }