refactor checkIfFileWasDeleted

This commit is contained in:
AustrianToast 2023-06-28 00:54:30 +02:00
parent 2b4019d7cf
commit 7d7e9bac6c
No known key found for this signature in database
GPG Key ID: 5CD422268E489EB4

View File

@ -203,19 +203,20 @@ public class ChksumUtils {
while (reader.Read()) {
pathToFile = reader.GetString(0);
if (!File.Exists(pathToFile)) {
var deleteCommand = connection.CreateCommand();
deleteCommand.CommandText =
@"
DELETE FROM file
WHERE pathtofile = $pathtofile
";
deleteCommand.Parameters.AddWithValue("$pathtofile", pathToFile);
deleteCommand.ExecuteNonQuery();
Console.WriteLine("File deleted:");
Console.WriteLine($"\t{pathToFile}\n");
if (File.Exists(pathToFile)) {
continue;
}
var deleteCommand = connection.CreateCommand();
deleteCommand.CommandText =
@"
DELETE FROM file
WHERE pathtofile = $pathtofile
";
deleteCommand.Parameters.AddWithValue("$pathtofile", pathToFile);
deleteCommand.ExecuteNonQuery();
Console.WriteLine("File deleted:");
Console.WriteLine($"\t{pathToFile}\n");
}
}
}