private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { GetText text = new GetText(); string path = AppDomain.CurrentDomain.BaseDirectory + "cookie.txt"; string data = ""; for (int i = 0; i < listView1.Items.Count; i++) { Console.WriteLine(listView1.Items[i].SubItems[1].Text); string openid = listView1.Items[i].SubItems[1].Text; string sign = listView1.Items[i].SubItems[2].Text; string SID = listView1.Items[i].SubItems[3].Text; data = data + openid + "----" + sign + "----" + SID + Environment.NewLine; } text.WriteOutText(path, data); MessageBox.Show("cookie小号已经保存到路径 " + path); } catch { MessageBox.Show("保存cookie小号失败,请检查是否有读写权限!"); } }