Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Commit

Permalink
Fix reload twice (#18)
Browse files Browse the repository at this point in the history
* Fix reload twice

* Fix reload twice
  • Loading branch information
KedamaOvO authored and Deliay committed Feb 22, 2018
1 parent 7a64020 commit 6a18c3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sync/Tools/ConfigurationIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Sync.Tools
{
Expand Down Expand Up @@ -33,6 +35,15 @@ static ConfigurationIO()
watcher.Changed += (s, e) => {
if (PluginConfigurationManager.InSaving) return;
if (!e.Name.StartsWith("config.ini")) return;

watcher.EnableRaisingEvents = false;
Task.Run(()=> {
Thread.Sleep(500);
watcher.EnableRaisingEvents = true;
});

Thread.Sleep(100);

foreach (var item in PluginConfigurationManager.ConfigurationSet)
{
item.ReloadAll();
Expand Down

0 comments on commit 6a18c3b

Please sign in to comment.