This commit is contained in:
Manuel Kamper 2022-10-24 12:52:13 +02:00
parent b7d73cfba8
commit ec09da5a84

View File

@ -12,7 +12,7 @@ namespace Mk0.Software.Bildduplikate
public partial class Form1 : Form
{
static readonly string[] suffixes = { "Bytes", "KB", "MB", "GB", "TB", "PB" };
private int line = 0, total = 0;
private int line = 0, total = 0, offset = 0;
private string file;
private List<Duplicate> duplicates = new List<Duplicate>();
@ -42,6 +42,7 @@ namespace Mk0.Software.Bildduplikate
line = 0;
total = 0;
file = fileName;
offset = 0;
duplicates.Clear();
using (StreamReader reader = new StreamReader(fileName))
@ -159,7 +160,8 @@ namespace Mk0.Software.Bildduplikate
private void File_DeleteLine(int lineFile)
{
lineFile++;
int linetodelete = lineFile + 1 - offset;
offset++;
StringBuilder sb = new StringBuilder();
using (StreamReader sr = new StreamReader(file))
{
@ -167,7 +169,7 @@ namespace Mk0.Software.Bildduplikate
while (!sr.EndOfStream)
{
Countup++;
if (Countup != lineFile)
if (Countup != linetodelete)
{
using (StringWriter sw = new StringWriter(sb))
{
@ -184,7 +186,7 @@ namespace Mk0.Software.Bildduplikate
{
sw.Write(sb.ToString());
}
Debug.Print("lösche Zeile " + lineFile);
Debug.Print("lösche Zeile " + linetodelete);
}
}
}