From f03911db2725746465fa7bc76f23305d458699ec Mon Sep 17 00:00:00 2001 From: marona Date: Sat, 18 Jun 2022 16:49:07 +0900 Subject: [PATCH] should be fixed --- SCTools/SCTool_Redesigned/Utils/LauchTokenManager.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SCTools/SCTool_Redesigned/Utils/LauchTokenManager.cs b/SCTools/SCTool_Redesigned/Utils/LauchTokenManager.cs index e13ef7b..ff2c4b9 100644 --- a/SCTools/SCTool_Redesigned/Utils/LauchTokenManager.cs +++ b/SCTools/SCTool_Redesigned/Utils/LauchTokenManager.cs @@ -42,7 +42,7 @@ public void BeginWatch() _watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime - | NotifyFilters.LastAccess; + | NotifyFilters.FileName; _watcher.EnableRaisingEvents = true; _watcher.Filter = _tokenName; @@ -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");