Example #1
0
        private void OnDeleted(object sender, FileSystemEventArgs e)
        {
            string message = string.Format("Delete file: '{0}'", e.FullPath);

            MyLogger.LogChanges(message, pathToLogFiles);
            changeCounter--;

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(message);
            Console.ResetColor();

            if (changeCounter == 0)
            {
                MyArchiver.SaveChanges(pathToDirectory, pathToArchive, pathToLogFiles);
                changeCounter = saveFrequency;
            }
        }
Example #2
0
        private void OnRenamed(object sender, RenamedEventArgs e)
        {
            string message = string.Format("Rename file: from '{0}' to '{1}'", e.OldFullPath, e.FullPath);

            MyLogger.LogChanges(message, pathToLogFiles);
            changeCounter--;

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(message);
            Console.ResetColor();

            if (changeCounter == 0)
            {
                MyArchiver.SaveChanges(pathToDirectory, pathToArchive, pathToLogFiles);
                changeCounter = saveFrequency;
            }
        }