Пример #1
0
        void ClearAllCaches(FileUpdateEventArgs args)
        {
            foreach (var dir in args.GroupByDirectory())
            {
                if (dir.Count() > 3 || dir.Any(f => f.IsDirectory))
                {
                    ClearDirCache(dir.Key.CanonicalPath);
                    continue;
                }
                else
                {
                    // All files, clear the cached version info for each file, if exists
                    foreach (FileUpdateEventInfo uinfo in dir)
                    {
                        FilePath path = uinfo.FilePath.ParentDirectory;
                        if (path.IsNullOrEmpty)
                        {
                            continue;
                        }

                        DirData dd;
                        if (filePaths.TryGetValue(path.CanonicalPath, out dd) && dd.FileData != null)
                        {
                            dd.FileData.Remove(uinfo.FilePath.CanonicalPath);
                        }
                    }
                }
            }
        }
Пример #2
0
 void UpdateAll(FileUpdateEventArgs args)
 {
     foreach (var dir in args.GroupByDirectory())
     {
         if (dir.Count() > 3 || dir.Any(f => f.IsDirectory))
         {
             UpdatePath(dir.Key.CanonicalPath);
             continue;
         }
         else
         {
             foreach (FileUpdateEventInfo uinfo in dir)
             {
                 UpdatePath(uinfo.FilePath.CanonicalPath);
             }
         }
     }
 }
 void Monitor(object sender, FileUpdateEventArgs args)
 {
     foreach (var dir in args.GroupByDirectory())
     {
         if (dir.Count() > 3 || dir.Any(f => f.IsDirectory))
         {
             FilePath path = dir.Key.CanonicalPath;
             DirData  dd;
             if (filePaths.TryGetValue(path, out dd))
             {
                 dd.FileData = null;                         // Clear the status cache
                 ITreeBuilder builder = Context.GetTreeBuilder(dd.Object);
                 if (builder != null)
                 {
                     builder.UpdateAll();
                 }
             }
             continue;
         }
         else
         {
             // All files, clear the cached version info for each file, if exists
             foreach (FileUpdateEventInfo uinfo in dir)
             {
                 FilePath path = uinfo.FilePath.ParentDirectory;
                 DirData  dd;
                 if (filePaths.TryGetValue(path.CanonicalPath, out dd) && dd.FileData != null)
                 {
                     dd.FileData.Remove(uinfo.FilePath.CanonicalPath);
                 }
                 if (filePaths.TryGetValue(uinfo.FilePath.CanonicalPath, out dd))
                 {
                     ITreeBuilder builder = Context.GetTreeBuilder(dd.Object);
                     if (builder != null)
                     {
                         builder.UpdateAll();
                     }
                 }
             }
         }
     }
 }
		void Monitor (object sender, FileUpdateEventArgs args)
		{
			foreach (var dir in args.GroupByDirectory ()) {
				if (dir.Count () > 3 || dir.Any (f => f.IsDirectory)) {
					FilePath path = dir.Key.CanonicalPath;
					DirData dd;
					if (filePaths.TryGetValue (path, out dd)) {
						dd.FileData = null; // Clear the status cache
						ITreeBuilder builder = Context.GetTreeBuilder (dd.Object);
						if (builder != null)
							builder.UpdateAll();
					}
					continue;
				}
				else {
					// All files, clear the cached version info for each file, if exists
					foreach (FileUpdateEventInfo uinfo in dir) {
						FilePath path = uinfo.FilePath.ParentDirectory;
						DirData dd;
						if (filePaths.TryGetValue (path.CanonicalPath, out dd) && dd.FileData != null) {
							dd.FileData.Remove (uinfo.FilePath.CanonicalPath);
						}
						if (filePaths.TryGetValue (uinfo.FilePath.CanonicalPath, out dd)) {
							ITreeBuilder builder = Context.GetTreeBuilder (dd.Object);
							if (builder != null)
								builder.UpdateAll();
						}
					}
				}
			}
		}
		void UpdateAll (FileUpdateEventArgs args)
		{
			foreach (var dir in args.GroupByDirectory ()) {
				if (dir.Count () > 3 || dir.Any (f => f.IsDirectory)) {
					UpdatePath (dir.Key.CanonicalPath);
					continue;
				}
				else
					foreach (FileUpdateEventInfo uinfo in dir)
						UpdatePath (uinfo.FilePath.CanonicalPath);
			}
		}
		void ClearAllCaches (FileUpdateEventArgs args)
		{
			foreach (var dir in args.GroupByDirectory ()) {
				if (dir.Count () > 3 || dir.Any (f => f.IsDirectory)) {
					ClearDirCache (dir.Key.CanonicalPath);
					continue;
				} else {
					// All files, clear the cached version info for each file, if exists
					foreach (FileUpdateEventInfo uinfo in dir) {
						FilePath path = uinfo.FilePath.ParentDirectory;
						if (path.IsNullOrEmpty)
							continue;
							
						DirData dd;
						if (filePaths.TryGetValue (path.CanonicalPath, out dd) && dd.FileData != null)
							dd.FileData.Remove (uinfo.FilePath.CanonicalPath);
					}
				}
			}
		}