internal void RemoveCommit(TreeCommit commit) { if (_commits.Remove(commit)) { commit.Parent = null; OnCommitDeleted(commit); } }
private void OnCommitDeleted(TreeCommit commit) { var handler = CommitDeleted; if (handler != null) { handler(this, new TreeCommitEventArgs(commit)); } }
private void SetContent(IList <TreeContentData> tree) { Root.Files.Clear(); Root.Directories.Clear(); var trees = new Dictionary <string, TreeDirectory>(); foreach (var item in tree) { int slashPos = item.Name.IndexOf('/'); string name = (slashPos == -1)?(item.Name):GetName(item.Name); var parent = _root; while (slashPos != -1) { string parentPath = item.Name.Substring(0, slashPos); TreeDirectory p; if (!trees.TryGetValue(parentPath, out p)) { p = new TreeDirectory(Repository, parentPath, parent, GetName(parentPath)); parent.AddDirectory(p); trees.Add(parentPath, p); } parent = p; slashPos = item.Name.IndexOf('/', slashPos + 1); } switch (item.Type) { case TreeContentType.Tree: { var dir = new TreeDirectory(Repository, item.Name, parent, name); trees.Add(item.Name, dir); parent.AddDirectory(dir); } break; case TreeContentType.Blob: { var blob = new TreeFile(Repository, item.Name, parent, FileStatus.Cached, name, ((BlobData)item).Size); parent.AddFile(blob); } break; case TreeContentType.Commit: { var commit = new TreeCommit(Repository, item.Name, parent, FileStatus.Cached, name); parent.AddCommit(commit); } break; } } }
private void OnCommitDeleted(TreeCommit commit) { var handler = CommitDeleted; if(handler != null) handler(this, new TreeCommitEventArgs(commit)); }
internal void RemoveCommit(TreeCommit commit) { if(_commits.Remove(commit)) { commit.Parent = null; OnCommitDeleted(commit); } }
internal void AddCommit(TreeCommit commit) { commit.Parent = this; _commits.Add(commit); OnCommitAdded(commit); }
private void OnCommitDeleted(TreeCommit commit) { CommitDeleted?.Invoke(this, new TreeCommitEventArgs(commit)); }
private void SetContent(IList<TreeContentData> tree) { Root.Files.Clear(); Root.Directories.Clear(); var trees = new Dictionary<string, TreeDirectory>(); foreach(var item in tree) { int slashPos = item.Name.IndexOf('/'); string name = (slashPos == -1)?(item.Name):GetName(item.Name); var parent = _root; while(slashPos != -1) { string parentPath = item.Name.Substring(0, slashPos); TreeDirectory p; if(!trees.TryGetValue(parentPath, out p)) { p = new TreeDirectory(Repository, parentPath, parent, GetName(parentPath)); parent.AddDirectory(p); trees.Add(parentPath, p); } parent = p; slashPos = item.Name.IndexOf('/', slashPos + 1); } switch(item.Type) { case TreeContentType.Tree: { var dir = new TreeDirectory(Repository, item.Name, parent, name); trees.Add(item.Name, dir); parent.AddDirectory(dir); } break; case TreeContentType.Blob: { var blob = new TreeFile(Repository, item.Name, parent, FileStatus.Cached, name, ((BlobData)item).Size); parent.AddFile(blob); } break; case TreeContentType.Commit: { var commit = new TreeCommit(Repository, item.Name, parent, FileStatus.Cached, name); parent.AddCommit(commit); } break; } } }