此功能不起作用,因为另一个进程正在使用它。
该函数必须读取文件,对其数据进行处理并将结果写入该文件。
private void changeToolStripMenuItem_Click(object sender, EventArgs e)
{
LB2.Visible = true;
TB2.Visible = true;
SaveFileDialog save = new SaveFileDialog();
if (save.ShowDialog() == DialogResult.OK)
{
double maxlen;
BinaryReader read = new BinaryReader(new FileStream(save.FileName, FileMode.Open));
BinaryWriter w = new BinaryWriter(new FileStream(save.FileName, FileMode.Create));
Find(read, out maxlen);
while (read.BaseStream.Position < read.BaseStream.Length)
{
double A = read.ReadDouble();
if (A > 0)
{
read.BaseStream.Seek(-8, SeekOrigin.Current);
w.Write(Find(read, out maxlen));
}
else
w.Write(A);
}
read.BaseStream.Close();
w.BaseStream.Close();
}
}