private void FindAllKind() { String path = "conf\\User"; String re; if (!Directory.Exists(path)) { return; } else { String[] k = Directory.GetFiles(path, "*.YSK"); if (k.Length == 0) { return; } foreach (String s in k) { StreamReader sr = new StreamReader(s, System.Text.Encoding.Default, false); re = sr.ReadLine(); Now = new YaSeKind(); String[] r = re.Split('*'); Now.NameID = r[0]; Now.ID = r[1]; Now.PW = r[2]; Now.area = Convert.ToInt32(r[3]); Com.Items.Add(Now.NameID); All.Add(Now); sr.Close(); sr.Dispose(); } } }
private void Com_SelectedIndexChanged(object sender, EventArgs e) { if (Com.SelectedIndex == -1) { return; } Now = new YaSeKind(); Now.NameID = Com.SelectedItem.ToString(); foreach (YaSeKind f in All) { if (f.NameID == Now.NameID) { Now.ID = f.ID; Now.ID = f.PW; if (Now.LoginToSD()) { return; } else { MessageBox.Show("账号信息已改或登陆失败,请重试"); Com.SelectedIndex = -1; return; } } } MessageBox.Show("没有找到该账号信息,请检查"); }