예제 #1
0
        private static void OnRenamed(object source, RenamedEventArgs e)
        {
            string fileOrDirectory;
            string fileID = FileID.getFileUniqueSystemID(e.FullPath);

            if (Directory.Exists(e.FullPath))
            {
                fileOrDirectory = "directory";
            }
            else
            {
                fileOrDirectory = "file";
            }

            Console.WriteLine("{0}|{1}|{2}|{3}|{4}", e.ChangeType, fileOrDirectory, fileID, e.OldFullPath, e.FullPath);

            return;
        }
예제 #2
0
        private static void OnChanged(object source, FileSystemEventArgs e)
        {
            string fileOrDirectory;
            string fileID = FileID.getFileUniqueSystemID(e.FullPath);

            if (e.ChangeType == WatcherChangeTypes.Deleted)
            {
                fileOrDirectory = "unknown";
            }
            else if (Directory.Exists(e.FullPath))
            {
                fileOrDirectory = "directory";
            }
            else
            {
                fileOrDirectory = "file";
            }

            Console.WriteLine("{0}|{1}|{2}|{3}", e.ChangeType, fileOrDirectory, fileID, e.FullPath);
            return;
        }