static void ConvertAtStartup(string filePath) { foreach (var lessfile in Directory.GetFiles(filePath, "*.less")) { Console.WriteLine(LessParser.ParseMessage, FilterFileName(lessfile)); if (LessParser.Convert(lessfile)) { Console.WriteLine(LessParser.MsgSuccess); } } }
static void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) { try { ((FileSystemWatcher)sender).EnableRaisingEvents = false; Console.WriteLine(LessParser.FileChangeDetect, FilterFileName(e.FullPath)); if (LessParser.Convert(e.FullPath)) { Console.WriteLine(LessParser.MsgSuccess); } else { Console.WriteLine(LessParser.MsgFailure, FilterFileName(e.FullPath)); } } finally { ((FileSystemWatcher)sender).EnableRaisingEvents = true; } }