internal CommitFileItemViewModel(string username, string repository, string parentNode, string parentCommit, ChangesetFile file)
        {
            Username      = username;
            Repository    = repository;
            Node          = parentNode;
            ChangesetFile = file;
            ParentNode    = parentCommit;

            var fullPath            = file.File;
            var lastDirectoryMarker = fullPath.LastIndexOf('/');

            Name = fullPath.Substring(lastDirectoryMarker + 1);

            if (file.Type == "added")
            {
                Type = CommitFileType.Added;
            }
            else if (file.Type == "removed")
            {
                Type = CommitFileType.Removed;
            }
            else
            {
                Type = CommitFileType.Modified;
            }

            var baseMarker = lastDirectoryMarker < 0 ? 0 : lastDirectoryMarker;

            Parent = "/" + fullPath.Substring(0, baseMarker);
        }
示例#2
0
 public ChangesetDiffViewModel(
     string username, string repository, string branch, ChangesetFile model)
     : this(username, repository, branch, model.File)
 {
     _commitFileModel = model;
     ChangeType       = model.Type.ToString();
 }
 public ChangesetDiffViewController(string username, string repository, string branch, ChangesetFile model)
     : this()
 {
     ViewModel = new ChangesetDiffViewModel(username, repository, branch, model);
 }