From eb74414b165a29d28432586a463aaa1a432cd549 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sat, 20 Aug 2016 01:18:43 +0100 Subject: [PATCH] disable file watcher Filewatcher will only watch directory given by user, a bit useless. disable for now --- .../Wox.Plugin.Program/FileChangeWatcher.cs | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs index 025ed47c97..c3968f2df4 100644 --- a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs +++ b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs @@ -2,57 +2,57 @@ using System.IO; using System.Threading.Tasks; using Wox.Infrastructure.Logger; -using Wox.Plugin.Program.ProgramSources; +using Wox.Plugin.Program.Programs; namespace Wox.Plugin.Program { - internal static class FileChangeWatcher - { - private static readonly List WatchedPath = new List(); - // todo remove previous watcher events - public static void AddAll(List sources, string[] suffixes) - { - foreach (var s in sources) - { - if (Directory.Exists(s.Location)) - { - AddWatch(s.Location, suffixes); - } - } - } + //internal static class FileChangeWatcher + //{ + // private static readonly List WatchedPath = new List(); + // // todo remove previous watcher events + // public static void AddAll(List sources, string[] suffixes) + // { + // foreach (var s in sources) + // { + // if (Directory.Exists(s.Location)) + // { + // AddWatch(s.Location, suffixes); + // } + // } + // } - public static void AddWatch(string path, string[] programSuffixes, bool includingSubDirectory = true) - { - if (WatchedPath.Contains(path)) return; - if (!Directory.Exists(path)) - { - Log.Warn($"FileChangeWatcher: {path} doesn't exist"); - return; - } + // public static void AddWatch(string path, string[] programSuffixes, bool includingSubDirectory = true) + // { + // if (WatchedPath.Contains(path)) return; + // if (!Directory.Exists(path)) + // { + // Log.Warn($"FileChangeWatcher: {path} doesn't exist"); + // return; + // } - WatchedPath.Add(path); - foreach (string fileType in programSuffixes) - { - FileSystemWatcher watcher = new FileSystemWatcher - { - Path = path, - IncludeSubdirectories = includingSubDirectory, - Filter = $"*.{fileType}", - EnableRaisingEvents = true - }; - watcher.Changed += FileChanged; - watcher.Created += FileChanged; - watcher.Deleted += FileChanged; - watcher.Renamed += FileChanged; - } - } + // WatchedPath.Add(path); + // foreach (string fileType in programSuffixes) + // { + // FileSystemWatcher watcher = new FileSystemWatcher + // { + // Path = path, + // IncludeSubdirectories = includingSubDirectory, + // Filter = $"*.{fileType}", + // EnableRaisingEvents = true + // }; + // watcher.Changed += FileChanged; + // watcher.Created += FileChanged; + // watcher.Deleted += FileChanged; + // watcher.Renamed += FileChanged; + // } + // } - private static void FileChanged(object source, FileSystemEventArgs e) - { - Task.Run(() => - { - Main.IndexPrograms(); - }); - } - } + // private static void FileChanged(object source, FileSystemEventArgs e) + // { + // Task.Run(() => + // { + // Main.IndexPrograms(); + // }); + // } + //} }