public async Task OnModifiedAsync(FileSystemEventArgs e)
{
if (e.FullPath.ToLower().EndsWith(extension_to_read))
{
string text = await CalculateSha256Async(e.FullPath);
if (file_hash != text)
{
file_hash = text;
Log.Information("File " + e.FullPath + " has been modified.");
Log.Information("Watching folder: " + folder);
await importer.DoImporterActionAsync(e.FullPath);
}
}
}
public async void OnModifiedAsyncHandler(object sender, FileSystemEventArgs e)
{
try
{
mutex.WaitOne();
await OnModifiedAsync(e);
}
finally
{
mutex.ReleaseMutex();
}
}
public async Task OnModifiedAsync(FileSystemEventArgs e)
{
if (e.FullPath.ToLower().EndsWith(extension_to_read))
{
string text = await CalculateSha256Async(e.FullPath);
if (file_hash != text)
{
file_hash = text;
Log.Information("File " + e.FullPath + " has been modified.");
Log.Information("Watching folder: " + folder);
await importer.DoImporterActionAsync(e.FullPath);
}
}
}
public async void OnModifiedAsyncHandler(object sender, FileSystemEventArgs e)
{
try
{
mutex.WaitOne();
await OnModifiedAsync(e);
}
finally
{
mutex.ReleaseMutex();
}
}