Example #1
0
        public FileWatcher()
        {
            var modPaths = PluginManager.instance.GetPluginsInfo().Select(
                obj => obj.modPath);
            String myPath = null;

            foreach (var path in modPaths)
            {
                var testPath = Path.Combine(path, "wwwroot");
                if (Directory.Exists(testPath))
                {
                    myPath = path;
                    break;
                }
            }

            if (myPath == null)
            {
                WebServer.Log("FileWatcher: no wwwroot found!");
                return;
            }
            WebServer.Log($"Watching filesystem path: '{myPath}");
            watcher = new FileSystemWatcher {
                Path         = myPath,
                NotifyFilter = NotifyFilters.LastWrite,
                Filter       = "*.dll",
            };
            watcher.Changed            += OnChanged;
            watcher.Created            += OnCreated;
            watcher.EnableRaisingEvents = true;             //start watching
        }
Example #2
0
 private static void OnCreated(object source, FileSystemEventArgs e)
 {
     WebServer.Log("File created!");
     ThreadPool.QueueUserWorkItem(o => {
         Thread.Sleep(1000);
         //PluginManager.instance.ForcePluginsChanged();
     });
 }
Example #3
0
 private static void OnChanged(object source, FileSystemEventArgs e)
 {
     WebServer.Log("File changed!");
     //PluginManager.instance.ForcePluginsChanged();
 }
 public void Log(String message)
 {
     WebServer.Log(message);
 }
Example #5
0
 protected void Log(string msg)
 {
     WebServer.Log($"{Name}: {msg}");
 }