Esempio n. 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);
        }
Esempio n. 2
0
        public IEnumerable <string> TryGetSourcePaths(string sourcePath)
        {
            if (!File.Exists(sourcePath))
            {
                return(null);
            }

            var isProject = ProjectFileUtility.IsPathProject(sourcePath);

            return(isProject ? new[] { sourcePath } : null);
        }
Esempio n. 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}");
                }
            }
        }
        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));
            }
        }
Esempio n. 5
0
 public string GetTargetFramework(string projectFilePath)
 {
     return(ProjectFileUtility.GetTargetFramework(projectFilePath));
 }