示例#1
0
        private void NotifySubscriptions(FileChangeEventArgs args)
		{
            var filePath = PathInfo.GetSubPath(_basePath, args.FileInfo.FilePath.ToString());

            foreach (var subscription in _directorySubscriptions.ToList())
			{
			    if (!subscription.IsMatch(filePath))
					continue;

				subscription.Notify(args);
			}
		}
示例#2
0
			internal void Notify(FileChangeEventArgs files)
			{
				_handler(files);
			}
示例#3
0
        private static void HandleChange(FileChangeEventArgs a, Project project, string kindObj, IFileSystem fileSystem)
        {
            if (a.ChangeType == FileChangeType.Created)
            {
                var item = new FileProjectItem(kindObj, a.FileInfo, fileSystem);
                if (!project.Contains(item.Identifier))
                    project.AddItem(item);
            }
            else
            {
                var changedItem = project.GetItems()
                    .OfType<FileProjectItem>()
                    .FirstOrDefault(f => f.FileInfo.FilePath.Equals(a.FileInfo.FilePath));

                if (changedItem != null)
                {
                    if (a.ChangeType == FileChangeType.Changed)
                        project.Touch(changedItem);
                    else if (a.ChangeType == FileChangeType.Deleted)
                        project.RemoveItem(changedItem);
                }
            }
        }