public static int yesFailedTimes = 0; // 失败N次数后改为手动输入验证码 #endregion Fields #region Methods public static void AddUser(String acc, String pwd, int status, String name) { if(status == 1){ ArrayList userArray = new ArrayList(userTable.Keys); foreach (String uacc in userArray) { ((User)userTable[uacc]).Status = 0; } } if(userTable.ContainsKey(acc)){ ((User)userTable[acc]).Status = 1; } else { User user = new User(); user.Acc = acc; user.Pwd = pwd; user.Status = status; user.Name = name; userTable.Add(acc, user); } }
public static void loadConfig() { Program.mainForm.ShowMessage("加载系统配置...", false); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); //查找<users> XmlNode root = xmlDoc.SelectSingleNode("config"); //获取到所有<users>的子节点 XmlNodeList nodeList = root.ChildNodes; //遍历所有子节点 XmlElement xe = null, ce = null; Libaray lib = null; XmlNodeList xnl = null; foreach (XmlNode xn in nodeList) { xe = (XmlElement)xn; if (xe.Name.Equals("library")) { xnl = xe.ChildNodes; foreach (XmlNode cn in xnl) { ce = (XmlElement)cn; lib = new Libaray(); lib.status = Convert.ToInt32(ce.GetAttribute("status")); lib.id = ce.GetAttribute("id"); if(lib.status != 999){ lib.name = ce.InnerText; libarays.Add(lib); } else { try { CommonUtil.DeleteDir(ConfigStore.appDir + "\\data\\" + lib.id); } catch {} } } } else if (xe.Name.Equals("users")) { User user = null; xnl = xe.ChildNodes; foreach (XmlNode cn in xnl) { ce = (XmlElement)cn; user = new User(); user.Acc = ce.GetAttribute("acc"); user.Pwd = MyEncrypt.DecryptB(ce.GetAttribute("pwd")); user.Status = Convert.ToInt32(ce.GetAttribute("status")); user.Name = ce.InnerText; userTable.Add(user.Acc, user); } } else if (xe.Name.Equals("skin")) { skin = xe.InnerText; } else if (xe.Name.Equals("start")) { startType = xe.InnerText; } else if (xe.Name.Equals("update")) { updateType = xe.InnerText; } else if (xe.Name.Equals("algorithm")) { algorithm = xe.InnerText; } else if (xe.Name.Equals("islocalhost")) { islocalhost = Convert.ToBoolean(xe.InnerText); } else if (xe.Name.Equals("isAutoBaojing")) { isAutoBaojing = Convert.ToBoolean(xe.InnerText); } else if (xe.Name.Equals("isAutoWriterVerify")) { isAutoWriterVerify = Convert.ToBoolean(xe.InnerText); } else if (xe.Name.Equals("failedTimes")) { failedTimes = Convert.ToInt32(xe.InnerText); } else if (xe.Name.Equals("fromCity")) { fromCity = xe.InnerText; } else if (xe.Name.Equals("toCity")) { toCity = xe.InnerText; } else if (xe.Name.Equals("bbsUser")) { bbsUser = xe.InnerText; } else if (xe.Name.Equals("bbsPwd")) { bbsPwd = MyEncrypt.DecryptB(xe.InnerText); } } Program.mainForm.ShowMessage("完成"); SaveConfig(); }