Esempio n. 1
0
            public override void Reload(IEnumerable <string> paths)
            {
                if (paths == null)
                {
                    throw new ArgumentNullException("paths");
                }

                StopMonitor(); // Make sure we have no further locks while reloading!

                HybridCollection <string> changed = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);

                changed.AddRange(paths);

                IProjectFileMapper mapper = _tracker.GetService <IProjectFileMapper>();

                if (!string.IsNullOrEmpty(mapper.SolutionFilename) && changed.Contains(mapper.SolutionFilename))
                {
                    // Ok; we are going to reload the solution itself
                    _tracker.SaveAllDocumentsExcept(changed); // Make sure everything that is dirty is saved

                    // let's remove all documents that are in the solution from the changed list
                    foreach (string file in mapper.GetAllFilesOfAllProjects())
                    {
                        changed.Remove(file);
                    }

                    // The solution was just removed; add it back
                    changed.Add(mapper.SolutionFilename);
                }

                for (int i = 0; i < changed.Count; i++)
                {
                    string          ch = changed[i];
                    SccDocumentData dd;
                    if (_tracker._docMap.TryGetValue(ch, out dd))
                    {
                        if (!dd.Reload(true))
                        {
                            string parentDocument = _tracker.GetParentDocument(dd);

                            if (string.IsNullOrEmpty(parentDocument))
                            {
                                parentDocument = mapper.SolutionFilename;
                            }

                            if (!string.IsNullOrEmpty(parentDocument) && !changed.Contains(parentDocument))
                            {
                                if (!_locked.Contains(parentDocument))
                                {
                                    // The parent is not on our changed or locked list.. so make sure it is saved
                                    _tracker.SaveDocument(parentDocument);
                                }

                                changed.Add(parentDocument);
                            }
                        }
                    }
                }
            }
Esempio n. 2
0
        public bool SccRemoveExcluded(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            return(_sccExcluded.Remove(path));
        }
Esempio n. 3
0
        public bool IsPropertyValid(string propertyName)
        {
            //Remove the validation errors before validation
            _validationErrors.Remove(propertyName);
            PropertyValidators validators = GetValidators(_target.GetType());


            RunValidators(validators[propertyName]);

            return(!_validationErrors.Contains(propertyName));
        }
            public override void Reload(IEnumerable<string> paths)
            {
                if (paths == null)
                    throw new ArgumentNullException("paths");

                StopMonitor(); // Make sure we have no further locks while reloading!

                HybridCollection<string> changed = new HybridCollection<string>(StringComparer.OrdinalIgnoreCase);
                changed.AddRange(paths);

                IProjectFileMapper mapper = _tracker.GetService<IProjectFileMapper>();

                if (!string.IsNullOrEmpty(mapper.SolutionFilename) && changed.Contains(mapper.SolutionFilename))
                {
                    // Ok; we are going to reload the solution itself
                    _tracker.SaveAllDocumentsExcept(changed); // Make sure everything that is dirty is saved

                    // let's remove all documents that are in the solution from the changed list
                    foreach (string file in mapper.GetAllFilesOfAllProjects())
                    {
                        changed.Remove(file);
                    }

                    // The solution was just removed; add it back
                    changed.Add(mapper.SolutionFilename);
                }

                for (int i = 0; i < changed.Count; i++)
                {
                    string ch = changed[i];
                    SccDocumentData dd;
                    if (_tracker._docMap.TryGetValue(ch, out dd))
                    {
                        if (!dd.Reload(true, false))
                        {
                            string parentDocument = _tracker.GetParentDocument(dd);

                            if (string.IsNullOrEmpty(parentDocument))
                                parentDocument = mapper.SolutionFilename;

                            if (!string.IsNullOrEmpty(parentDocument) && !changed.Contains(parentDocument))
                            {
                                if (!_locked.Contains(parentDocument))
                                {
                                    // The parent is not on our changed or locked list.. so make sure it is saved
                                    _tracker.SaveDocument(parentDocument);
                                }

                                changed.Add(parentDocument);
                            }
                        }
                    }
                }
            }
        void InnerRefresh()
        {
            using (BatchStartedEventArgs br = BatchRefresh())
            {
                HybridCollection <string> mapped = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);

                ISvnStatusCache cache = Cache;

                foreach (string file in Mapper.GetAllFilesOfAllProjects())
                {
                    br.Tick();
                    _extraFiles.Remove(file); // If we find it here; it is no longer 'extra'!

                    SvnItem item = cache[file];

                    if (item == null)
                    {
                        continue;
                    }

                    PendingChange pc = UpdatePendingChange(item);

                    if (pc != null)
                    {
                        mapped.Add(pc.FullPath);
                    }
                }

                foreach (string file in new List <string>(_extraFiles))
                {
                    br.Tick();
                    SvnItem item = cache[file];

                    if (item == null)
                    {
                        _extraFiles.Remove(file);
                        continue;
                    }

                    PendingChange pc = UpdatePendingChange(item);

                    if (pc != null)
                    {
                        mapped.Add(pc.FullPath);
                    }
                    else
                    {
                        _extraFiles.Remove(file);
                    }
                }

                for (int i = 0; i < _pendingChanges.Count; i++)
                {
                    br.Tick();
                    PendingChange pc = _pendingChanges[i];

                    if (mapped.Contains(pc.FullPath))
                    {
                        continue;
                    }

                    _pendingChanges.RemoveAt(i--);
                }
            }
        }