Пример #1
0
        public void ClearCachedVersionInfo(FilePath rootPath)
        {
            FileUpdateEventArgs args = null;
            var canonicalPath        = rootPath.CanonicalPath;

            foreach (var p in fileStatus.Where(e => e.Key.IsChildPathOf(rootPath) || e.Key == canonicalPath))
            {
                p.Value.RequiresRefresh = true;

                var a = new FileUpdateEventArgs(repo, p.Value.LocalPath, p.Value.IsDirectory);
                if (args == null)
                {
                    args = a;
                }
                else
                {
                    args.MergeWith(a);
                }
            }

            foreach (var p in directoryStatus.Where(e => e.Key.IsChildPathOf(rootPath) || e.Key == canonicalPath))
            {
                p.Value.RequiresRefresh = true;
            }

            if (args != null)
            {
                //	Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Пример #2
0
        public void SetStatus(IEnumerable <VersionInfo> versionInfos)
        {
            FileUpdateEventArgs args = null;

            lock (fileStatus) {
                foreach (var versionInfo in versionInfos)
                {
                    VersionInfo vi;
                    if (fileStatus.TryGetValue(versionInfo.LocalPath, out vi) && vi.Equals(versionInfo))
                    {
                        vi.RequiresRefresh = false;
                        continue;
                    }
                    versionInfo.Init(repo);
                    fileStatus [versionInfo.LocalPath] = versionInfo;
                    var a = new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory);
                    if (args == null)
                    {
                        args = a;
                    }
                    else
                    {
                        args.MergeWith(a);
                    }
                }
            }
            if (args != null)
            {
                //	Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Пример #3
0
        public async Task SetStatusAsync(IEnumerable <VersionInfo> versionInfos, CancellationToken cancellationToken = default)
        {
            FileUpdateEventArgs args = null;

            foreach (var versionInfo in versionInfos)
            {
                if (!versionInfo.IsInitialized)
                {
                    await versionInfo.InitAsync(repo, cancellationToken);
                }

                if (fileStatus.TryGetValue(versionInfo.LocalPath, out var vi) && vi.Equals(versionInfo))
                {
                    vi.RequiresRefresh = false;
                    continue;
                }

                fileStatus [versionInfo.LocalPath] = versionInfo;

                var a = new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory);
                if (args == null)
                {
                    args = a;
                }
                else
                {
                    args.MergeWith(a);
                }
            }

            if (args != null)
            {
                //	Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }