Example #1
0
 /// <summary>
 /// Compare file.
 /// </summary>
 /// <param name="obj">object</param>
 /// <returns>result</returns>
 public override bool Equals(object obj)
 {
     if (!(obj is FileUnit fileUnit))
     {
         return(false);
     }
     return(FileRelativePath.Equals(fileUnit.FileRelativePath));
 }
Example #2
0
        /// <summary>
        /// 파일의 절대 경로를 반환한다.
        /// </summary>
        public string GetFileAbsolutePath(string basePath)
        {
            basePath.ThrowIfNull(nameof(basePath));

            string filePath         = basePath.TrimEnd(Path.DirectorySeparatorChar);
            string fileRelativePath = FileRelativePath?.TrimStart(Path.DirectorySeparatorChar);

            filePath = $"{filePath}\\{fileRelativePath}";

            return(filePath);
        }
        private static void ProcessListSolutionProjectReferencesOutput(object sender, DataReceivedEventArgs e, SolutionFilePath solutionFilePath, List <ProjectFilePath> projectFilePaths)
        {
            var dataString = e.Data ?? String.Empty;

            using (var reader = new StringReader(dataString))
            {
                while (!reader.ReadLineIsEnd(out string line))
                {
                    if (String.IsNullOrWhiteSpace(line) || line == "Project(s)" || line == "----------")
                    {
                        continue;
                    }

                    var projectFileRelativePath = new FileRelativePath(line);
                    var projectFilePath         = PathUtilitiesExtra.GetFilePath(solutionFilePath, projectFileRelativePath).AsProjectFilePath();

                    projectFilePaths.Add(projectFilePath);
                }
            }
        }
        private static void ProcessListProjectProjectReferencesOutput(object sender, DataReceivedEventArgs e, ProjectFilePath projectFilePath, List <ProjectFilePath> projectFilePaths)
        {
            var projectDirectoryPath = PathUtilities.GetDirectoryPath(projectFilePath);

            var dataString = e.Data ?? String.Empty;

            using (var reader = new StringReader(dataString))
            {
                while (!reader.ReadLineIsEnd(out string line))
                {
                    if (String.IsNullOrWhiteSpace(line) || line == "Project reference(s)" || line == "--------------------" || line.BeginsWith("There are no Project to Project references in project"))
                    {
                        continue;
                    }

                    var referencedProjectFileRelativePath = new FileRelativePath(line);
                    // Project file relative paths are relative to the project directory path.
                    var referenedProjectFilePath = PathUtilitiesExtra.GetFilePath(projectDirectoryPath, referencedProjectFileRelativePath).AsProjectFilePath();

                    projectFilePaths.Add(referenedProjectFilePath);
                }
            }
        }
Example #5
0
 /// <summary>
 /// Get hash code of file,
 /// </summary>
 /// <returns>result</returns>
 public override int GetHashCode()
 {
     return(FileRelativePath.GetHashCode());
 }
Example #6
0
 /// <summary>
 /// Compare file.
 /// </summary>
 /// <param name="fileUnit">file unit</param>
 /// <returns>result</returns>
 public int CompareTo(FileUnit fileUnit)
 {
     return(FileRelativePath.CompareTo(fileUnit.FileRelativePath));
 }
Example #7
0
        public static FileRelativePath AsFileRelativePath(this string value)
        {
            var fileRelativePath = new FileRelativePath(value);

            return(fileRelativePath);
        }