private void btn_jiemi_Click(object sender, EventArgs e) { SiuStreamReader m_StreamReader = new SiuStreamReader(openfile); // string t; try { //StreamWriter writer = new StreamWriter(@"C:\work\2016-04-07\smkj\MD\Assets\s1.txt"); // SiuStreamWriter writer1 = new SiuStreamWriter(@"C:\work\2016-04-07\smkj\MD\Assets\s.txt"); FileInfo f = new FileInfo(savefile); StreamWriter w = f.CreateText(); // string line = m_StreamReader.ReadLine();//为什么就是不能往里写数据呢??? string line; while (null != (line = m_StreamReader.ReadLine())) { //writer1.WriteLine(line); // writer.Write(line); w.WriteLine(line); //label1.Text = line; } w.Close(); m_StreamReader.Close(); //writer1.Close(); //writer.Close(); } catch (Exception ex) { return; } m_StreamReader.Close(); MessageBox.Show("解密完成", "提示", MessageBoxButtons.OK); System.Diagnostics.Process.Start(savefile); }
//查询订单记录 private void historyCheack() { if (!File.Exists(System.Windows.Forms.Application.StartupPath + @"\cookie.txt")) { FileInfo f = new FileInfo(System.Windows.Forms.Application.StartupPath + @"\cookie.txt"); StreamWriter w = f.CreateText(); w.Close(); } SiuStreamReader m_StreamReader = new SiuStreamReader(System.Windows.Forms.Application.StartupPath + @"\cookie.txt"); string line = cBx_ShipperCode.Text + ";" + cBx_DanHao.Text; string tmp; while ((tmp = m_StreamReader.ReadLine()) != null) { if (tmp == line) { m_StreamReader.Close(); return; } } m_StreamReader.Close(); try { //FileInfo f = new FileInfo(System.Windows.Forms.Application.StartupPath + @"\cookie.txt"); //StreamWriter w = f.CreateText(); StreamWriter w = new StreamWriter(System.Windows.Forms.Application.StartupPath + @"\cookie.txt", true); // string line = m_StreamReader.ReadLine();//为什么就是不能往里写数据呢??? w.WriteLine(line); //label1.Text = line; w.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return; } }
private void cBx_DanHao_MouseClick(object sender, MouseEventArgs e) { SiuStreamReader m_StreamReader = new SiuStreamReader(System.Windows.Forms.Application.StartupPath + @"\cookie.txt"); string tmpReader; foreach (var tmp in cBx_DanHao.Items) { if (tmp.ToString() == lasttmpReader) { m_StreamReader.Close(); return; } } while ((tmpReader = m_StreamReader.ReadLine()) != null) { tmpKD = tmpReader.Split(';'); DicDanHao.Add(tmpKD[1], tmpKD[0]); cBx_DanHao.Items.Add(tmpKD[1]); lasttmpReader = tmpKD[1]; //cBx_ShipperCode.Text = tmpKD[0]; //cBx_DanHao.Text = tmpKD[1]; } m_StreamReader.Close(); }