Exemple #1
0
        static void Main(string[] args)
        {
            var id = 0;

            if (args.Length > 0)
            {
                id = Convert.ToInt32(args[0]);
            }
            var monitor = new FolderMonitor(Utils.DashboardPath, new Dashboards(id));

            monitor.Start();
            Console.ReadKey();
        }
Exemple #2
0
 public void OnChanged(object source, FileSystemEventArgs e)
 {
     if (FolderMonitor.IsFileLocked(new FileInfo(e.FullPath)))
     {
         return;
     }
     using (Reader = new StreamReader(e.FullPath))
     {
         var content = Reader.ReadToEnd();
         var column  = getDbColumnByFileName(e.Name);
         var id      = this.Id != 0 ? this.Id : getDashboardIdByFolderName(e.Name);
         new Db().Execute(new Sql($"update dashboards_panels set {column} = ? where id = ? ", content, id));
         Console.WriteLine($"Updated {e.FullPath} at {DateTime.Now}");
     }
 }