using (var sr = new StreamReader(Misc.tempFile))
{
using (var sw = new StreamWriter(Misc.path + "test.dat"))
{
while ((line = sr.ReadLine()) != null)
{
for (int i = 0; i < detailViewer.SelectedIndices.Count; i++)
lineToDelete[i] = Encryption.encrypt(detailViewer.SelectedItems[i].SubItems[0].Text) +
"," + Encryption.encrypt(detailViewer.SelectedItems[i].SubItems[1].Text) + ","
+ Encryption.encrypt(detailViewer.SelectedItems[i].SubItems[2].Text);
if (line != lineToDelete[detailViewer.SelectedIndices.Count - 1] && !line.StartsWith("/"))
sw.WriteLine(line);
}
}
}
It works fine but it doesn't delete all the lines that need to be deleted, I've tried using a loop on the line check, but all that does it duplicate the lines. Please help me.
Sorry about the conventions, for some reason they mess up when I paste code snippets here.
Thanks.