public static void Load()
 {
     configFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SFUSetting.config");
     if (!File.Exists(configFilePath))
     {
         string msg = string.Format("Configuration file does not exist. configFilePath=[{0}]", configFilePath);
         SFULogger.DEFAULT.Error(msg);
         string configXmlStr = "<?xml version=\"1.0\" encoding=\"utf-8\"?><SFUConfigInfo xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><operatorInfo><bucketName></bucketName><operatorName></operatorName><operatorPwd></operatorPwd><bindDomain></bindDomain><netSelection></netSelection></operatorInfo><loginInfo><rememberPwd>false</rememberPwd><autoLogin>false</autoLogin></loginInfo></SFUConfigInfo>";
         File.WriteAllText(configFilePath, configXmlStr, Encoding.UTF8);
     }
     sfuConfigInfo = XmlUtil.XmlDeserializeFromFile <SFUConfigInfo>(configFilePath, Encoding.UTF8);
 }
示例#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;
     }
 }