Пример #1
0
        public void InsertStaticItem(List <string> path, ChangesInfo info, bool staged)
        {
            string first = path.First();

            path.RemoveAt(0);
            if (path.Any())
            {
                InsertDirectoryItem(first, path, info, staged);
            }
            else
            {
                InsertStaticFileItem(first, info, staged);
            }
        }
Пример #2
0
        ChangesTreeFileItem InsertFileItem(string name, ChangesInfo info, bool staged)
        {
            ChangesTreeFileItem it = new ChangesTreeFileItem()
            {
                Name = name
            };

            it.Unchecked += SubItemUnchecked;
            it.Checked   += SubItemChecked;
            it.Info       = info;
            it.IsChecked  = staged;
            Items.Add(it);
            return(it);
        }
Пример #3
0
        void InsertDirectoryItem(string dirName, List <string> restPath, ChangesInfo info, bool staged)
        {
            ChangesTreeDirectoryItem d = Dirs.ToList().Find(dir => dir.Name == dirName);

            if (d == null)
            {
                Items.Add(d = new ChangesTreeDirectoryItem()
                {
                    Name = dirName
                });
            }
            d.Checked               += SubItemChecked;
            d.Unchecked             += SubItemUnchecked;
            d.SubItemCheckedChanged += NotifyChange;
            d.InsertItem(restPath, info, staged);
        }
Пример #4
0
        override protected void RefreshItems()
        {
            Items = new List <ChangesTreeItem>()
            {
            };
            ChangesTreeDirectoryItem root    = GetRootItem();
            HashSet <string>         changed = new HashSet <string>();
            var untracked = Model.RepositoryStatus.Untracked;

            untracked.ToList().ForEach(statusEntry => root.InsertItem(statusEntry.FilePath, ChangesInfo.Untracked(statusEntry.FilePath), true));
            var added = Model.RepositoryStatus.Added;

            added.ToList().ForEach(statusEntry => root.InsertItem(statusEntry.FilePath, ChangesInfo.Untracked(statusEntry.FilePath), true));
            var modified   = Model.RepositoryChanges.Modified;
            var deleted    = Model.RepositoryChanges.Deleted;
            var renamed    = Model.RepositoryChanges.Renamed;
            var conflicted = Model.RepositoryChanges.Conflicted;

            modified.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Modified(change.Path), true); changed.Add(change.Path); });
            deleted.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Deleted(change.Path), true); changed.Add(change.Path); });
            renamed.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Renamed(change.OldPath, change.Path), true); changed.Add(change.Path); });
            conflicted.ToList().ForEach(change => { root.InsertStaticItem(change.Path, ChangesInfo.Conflict(change.Path), true); changed.Add(change.Path); });
            var removed = Model.RepositoryStatus.Removed;

            removed.Where(sc => !changed.Contains(sc.FilePath)).ToList().ForEach(sc => { root.InsertItem(sc.FilePath, ChangesInfo.Deleted(sc.FilePath), true); });
            var modified2 = Model.RepositoryStatus.Modified;

            modified2.Where(sc => !changed.Contains(sc.FilePath)).ToList().ForEach(sc => { root.InsertItem(sc.FilePath, ChangesInfo.Modified(sc.FilePath), true); });
            var renamed2 = Model.RepositoryStatus.RenamedInIndex;

            renamed2.Where(sc => !changed.Contains(sc.FilePath)).ToList().ForEach(sc => { root.InsertItem(sc.FilePath, ChangesInfo.Renamed(sc.HeadToIndexRenameDetails.OldFilePath, sc.FilePath), true); });
            if (root.Items.Any())
            {
                Items.Add(root);
            }
            NotifyRefresh();
        }
Пример #5
0
 public void InsertStaticItem(string path, ChangesInfo info, bool staged)
 {
     InsertStaticItem(path.Split(new char[] { Path.DirectorySeparatorChar, '/' }).ToList(), info, staged);
 }
Пример #6
0
 void InsertStaticFileItem(string name, ChangesInfo info, bool staged)
 {
     InsertFileItem(name, info, staged).IsActive = false;
 }