コード例 #1
0
        public void EnumerablePackageLibrary()
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../..", "TestData", "Utilities",
                                       "ProjectUtility", "EnumerablePackageLibrary", "packages.config");
            var packages = ProjectFileUtility.EnumerablePackageLibrary(path).ToList();

            Assert.AreEqual(packages.Count, 4);
        }
コード例 #2
0
        public IEnumerable <string> TryGetSourcePaths(string sourcePath)
        {
            if (!File.Exists(sourcePath))
            {
                return(null);
            }

            var isProject = ProjectFileUtility.IsPathProject(sourcePath);

            return(isProject ? new[] { sourcePath } : null);
        }
コード例 #3
0
        /// <summary>
        /// 使用ライブラリ情報を列挙します
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private IEnumerable <string> EnumerableUsingLibrary(string path)
        {
            yield return(ProjectFileUtility.GetTargetFramework(path));

            var fileInfo = new FileInfo(path);

            if (fileInfo.Directory?.Exists == true)
            {
                string packagePath = Path.Combine(fileInfo.Directory.FullName, "packages.config");
                foreach (var package in ProjectFileUtility.EnumerablePackageLibrary(packagePath))
                {
                    yield return($"{package.Name} {package.Version}");
                }
            }
        }
コード例 #4
0
        public IEnumerable <string> GetProjectCleanupPaths(PathInfo sourcePath)
        {
            var directoryPath = sourcePath.IsFile
                ? Path.GetDirectoryName(sourcePath.Value)
                : sourcePath.Value;

            var projectPaths =
                ProjectFileUtility.IsPathProject(sourcePath.Value)
                    ? ProjectFileParser.GetProjectFilePaths(sourcePath.Value)
                    : Enumerable.Empty <string>();

            foreach (var projectPath in projectPaths)
            {
                yield return(Path.Combine(directoryPath, projectPath));
            }

            foreach (var cleanPath in _context.CleanPaths)
            {
                yield return(Path.Combine(directoryPath, cleanPath));
            }
        }
コード例 #5
0
 public string GetTargetFramework(string projectFilePath)
 {
     return(ProjectFileUtility.GetTargetFramework(projectFilePath));
 }