/// <summary>
        /// Initializes a new instance of the <see cref="PullRequestFileNode"/> class.
        /// </summary>
        /// <param name="repositoryPath">The absolute path to the repository.</param>
        /// <param name="relativePath">The path to the file, relative to the repository.</param>
        /// <param name="sha">The SHA of the file.</param>
        /// <param name="status">The way the file was changed.</param>
        /// <param name="statusDisplay">The string to display in the [message] box next to the filename.</param>
        /// <param name="oldPath">
        /// The old path of a moved/renamed file, relative to the repository. Should be null if the
        /// file was not moved/renamed.
        /// </param>
        public PullRequestFileNode(
            string repositoryPath,
            string relativePath,
            string sha,
            PullRequestFileStatus status,
            string oldPath)
        {
            Guard.ArgumentNotEmptyString(repositoryPath, nameof(repositoryPath));
            Guard.ArgumentNotEmptyString(relativePath, nameof(relativePath));
            Guard.ArgumentNotEmptyString(sha, nameof(sha));

            FileName     = Path.GetFileName(relativePath);
            RelativePath = relativePath.Replace("/", "\\");
            Sha          = sha;
            Status       = status;
            OldPath      = oldPath;

            if (status == PullRequestFileStatus.Added)
            {
                StatusDisplay = Resources.AddedFileStatus;
            }
            else if (status == PullRequestFileStatus.Renamed)
            {
                if (oldPath != null)
                {
                    StatusDisplay = Path.GetDirectoryName(oldPath) == Path.GetDirectoryName(relativePath) ?
                                    Path.GetFileName(oldPath) : oldPath;
                }
                else
                {
                    StatusDisplay = Resources.RenamedFileStatus;
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PullRequestFileNode"/> class.
 /// </summary>
 /// <param name="repositoryPath">The absolute path to the repository.</param>
 /// <param name="path">The path to the file, relative to the repository.</param>
 /// <param name="changeType">The way the file was changed.</param>
 public PullRequestFileNode(string repositoryPath, string path, PullRequestFileStatus status)
 {
     FileName      = Path.GetFileName(path);
     DirectoryPath = Path.GetDirectoryName(path);
     DisplayPath   = Path.Combine(Path.GetFileName(repositoryPath), DirectoryPath);
     Status        = status;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PullRequestFileNode"/> class.
 /// </summary>
 /// <param name="repositoryPath">The absolute path to the repository.</param>
 /// <param name="path">The path to the file, relative to the repository.</param>
 /// <param name="sha">The SHA of the file.</param>
 /// <param name="status">The way the file was changed.</param>
 /// <param name="statusDisplay">The string to display in the [message] box next to the filename.</param>
 public PullRequestFileNode(string repositoryPath, string path, string sha, PullRequestFileStatus status, [AllowNull] string statusDisplay)
 {
     FileName      = Path.GetFileName(path);
     DirectoryPath = Path.GetDirectoryName(path);
     DisplayPath   = Path.Combine(Path.GetFileName(repositoryPath), DirectoryPath);
     Sha           = sha;
     Status        = status;
     StatusDisplay = statusDisplay;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PullRequestFileNode"/> class.
 /// </summary>
 /// <param name="repositoryPath">The absolute path to the repository.</param>
 /// <param name="path">The path to the file, relative to the repository.</param>
 /// <param name="sha">The SHA of the file.</param>
 /// <param name="status">The way the file was changed.</param>
 /// <param name="statusDisplay">The string to display in the [message] box next to the filename.</param>
 public PullRequestFileNode(string repositoryPath, string path, string sha, PullRequestFileStatus status, [AllowNull] string statusDisplay)
 {
     FileName = Path.GetFileName(path);
     DirectoryPath = Path.GetDirectoryName(path);
     DisplayPath = Path.Combine(Path.GetFileName(repositoryPath), DirectoryPath);
     Sha = sha;
     Status = status;
     StatusDisplay = statusDisplay;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PullRequestFileNode"/> class.
        /// </summary>
        /// <param name="repositoryPath">The absolute path to the repository.</param>
        /// <param name="path">The path to the file, relative to the repository.</param>
        /// <param name="sha">The SHA of the file.</param>
        /// <param name="status">The way the file was changed.</param>
        /// <param name="statusDisplay">The string to display in the [message] box next to the filename.</param>
        public PullRequestFileNode(
            string repositoryPath,
            string path,
            string sha,
            PullRequestFileStatus status,
            string statusDisplay)
        {
            Guard.ArgumentNotEmptyString(repositoryPath, nameof(repositoryPath));
            Guard.ArgumentNotEmptyString(path, nameof(path));
            Guard.ArgumentNotEmptyString(sha, nameof(sha));

            FileName      = Path.GetFileName(path);
            DirectoryPath = Path.GetDirectoryName(path);
            DisplayPath   = Path.Combine(Path.GetFileName(repositoryPath), DirectoryPath);
            Sha           = sha;
            Status        = status;
            StatusDisplay = statusDisplay;
        }
Exemple #6
0
 public PullRequestFileModel(string fileName, PullRequestFileStatus status)
 {
     FileName = fileName;
     Status   = status;
 }
 public PullRequestFileNode(string fullPath, PullRequestFileStatus status)
 {
     FileName = System.IO.Path.GetFileName(fullPath);
     Path     = System.IO.Path.GetDirectoryName(fullPath);
     Status   = status;
 }
 public PullRequestFileModel(string fileName, string sha, PullRequestFileStatus status)
 {
     FileName = fileName;
     Sha = sha;
     Status = status;
 }