public void loadConfigFile() { try { StreamReader reader = File.OpenText(Environment.SystemDirectory + @"\Sitioparser.queues.txt"); string str = reader.ReadLine(); while (str != null) { str = reader.ReadLine(); string str2 = reader.ReadLine(); if ((str != null) && (str2 != null)) { sqlitem sqlitem = new sqlitem(); sqlitem.sqlname = str; sqlitem.sqlstring = str2; this.itemlist.Add(sqlitem); this.listsqls.Items.Add(sqlitem.sqlname); } } reader.Close(); } catch (FileNotFoundException) { MessageBox.Show("没有找到查询语句纪录文件,将重建一个\n将会关闭程序,请重新启动", "未找到查询语句纪录文件"); StreamWriter writer = File.CreateText(Environment.SystemDirectory + @"\Sitioparser.queues.txt"); writer.WriteLine("<SQL>"); writer.Close(); Application.Exit(); } }
private void frmSQLEdit_Load(object sender, EventArgs e) { this.saveditem = new sqlitem(); }