//把工程信息保存到文件 private void SaveProjectToFile() { OperFile.SaveProjectInfoConfig(listProjects); }
//读取账户信息 和 工程配置信息 private void ReadUserInfo() { #region 加载用户信息 if (listUsers == null) { listUsers = OperFile.GetUserInfoByFile(); if (listUsers == null) { return; } foreach (UserInfoConfig ufi in listUsers) { cboxSelectAccount.Items.Add(ufi.username); } } #endregion #region 加载工程配置信息 List <ProjectStrategy> tmpPS = null; tmpPS = OperFile.GetProjectInfoByFile(); if (tmpPS == null || tmpPS.Count == 0) { return; } listProjects = tmpPS; bool IsChange = false; //检查是否存在失效信息 for (int i = 0; i < listProjects.Count; i++) { ProjectStrategy pic = listProjects[i]; bool IsIn = false; foreach (UserInfoConfig ufi in listUsers) { if (pic.username == ufi.username) { Transmit(ref pic, ufi); IsIn = true; break; } } if (IsIn == false) { IsChange = true; listProjects.RemoveAt(i); } } if (IsChange == true) { OperFile.SaveProjectInfoConfig(listProjects); } #endregion #region 显示信息 foreach (ProjectStrategy ps in listProjects) { ListViewItem lvi = new ListViewItem(); lvi.Text = ps.username; lvi.SubItems.Add(ps.projectName); lvi.SubItems.Add(EnumRunState.未运行.ToString()); lvi.SubItems.Add(System.IO.Path.GetFileName(ps.fileName)); lvi.SubItems.Add(ps.strategyName); lvi.SubItems.Add(". . ."); listStrategy.Items.Add(lvi); } #endregion }