Skip to content

Commit

Permalink
should be fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
marona42 committed Jun 18, 2022
1 parent 31812c6 commit f03911d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions SCTools/SCTool_Redesigned/Utils/LauchTokenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void BeginWatch()

_watcher.NotifyFilter = NotifyFilters.LastWrite
| NotifyFilters.CreationTime
| NotifyFilters.LastAccess;
| NotifyFilters.FileName;
_watcher.EnableRaisingEvents = true;
_watcher.Filter = _tokenName;

Expand All @@ -52,8 +52,12 @@ public void BeginWatch()
}
private void UpdateToken(object sender, FileSystemEventArgs e)
{
if ( File.GetLastWriteTime(_srcpath + "\\" + _tokenName).Subtract(_lastevent).Minutes < 1)
NLog.LogManager.GetCurrentClassLogger().Info("Watcher awake");
if (File.GetLastWriteTime(_srcpath + "\\" + _tokenName).Subtract(_lastevent).Seconds < 2)
{
NLog.LogManager.GetCurrentClassLogger().Info("but fall by "+ File.GetLastWriteTime(_srcpath + "\\" + _tokenName).Subtract(_lastevent).Seconds.ToString());
return; //discard duplicated events
}

File.Copy(_srcpath + "\\" + _tokenName, _dstpath + _tokenName, true);
NLog.LogManager.GetCurrentClassLogger().Info("Token Copied");
Expand Down

0 comments on commit f03911d

Please sign in to comment.