Beispiel #1
0
        private static void CaptureEventsUsingFilter(string path)
        {
            var filter = new EventWatcher();


            filter.Connect();
            filter.AggregateEvents = true;
            filter.NotWatchProcess(EventWatcher.GetCurrentProcessId());

            filter.WatchPath(path + "*");

            filter.OnChange += (name, process) =>
            {
                Console.WriteLine("Changed: " + name);
            };
            filter.OnCreate += (name, process) =>
            {
                Console.WriteLine("Created: " + name);
            };
            filter.OnDelete += (name, process) =>
            {
                Console.WriteLine("Deleted: " + name);
            };
            filter.OnRenameOrMove += (name, oldName, process) =>
            {
                Console.WriteLine("Moved: " + oldName + " -> " + name);
            };
        }