示例#1
0
        private static void OnFileRenamed(string oldPath, string newPath)
        {
            bool isDirectory = false;

            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(newPath);
                if (directoryInfo.Attributes == FileAttributes.Directory)
                {
                    isDirectory = true;
                }
            }
            catch (UnauthorizedAccessException)
            {
                return;
            }
            string pathName;
            string oldFileName;

            FileWatcher.SplitePathAndFile(oldPath, out pathName, out oldFileName);
            string newFileName;

            FileWatcher.SplitePathAndFile(newPath, out pathName, out newFileName);
            FileDistributor.OnFileRenamed(pathName, oldFileName, newFileName, isDirectory);
        }
示例#2
0
        private static void OnFileChanged(string fullPath, WatcherChangeTypes changeType)
        {
            bool isDirectory = false;

            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(fullPath);
                if (directoryInfo.Attributes == FileAttributes.Directory)
                {
                    isDirectory = true;
                }
            }
            catch (UnauthorizedAccessException)
            {
                return;
            }
            string pathName;
            string fileName;

            FileWatcher.SplitePathAndFile(fullPath, out pathName, out fileName);
            FileDistributor.OnFileChanged(pathName, fileName, isDirectory, changeType);
        }