Datei: NDOEnhancer/NDOEnhancer/Enhancer/Generator/ProviderPathFinder.cs

Last Commit (7d77e26)
1 using NDO.ProviderFactory;
2 using System;
3 using System.Collections.Generic;
4 using System.IO;
5 using System.Linq;
6
7 namespace NDOEnhancer
8 {
9 ····class ProviderPathFinder : IProviderPathFinder
10 ····{
11 ········ProjectDescription projectDescription;
12
13 ········public ProviderPathFinder(ProjectDescription projectDescription)
14 ········{
15 ············this.projectDescription = projectDescription;
16 ········}
17
18 ········public IEnumerable<string> GetPaths()
19 ········{
20 ············List<string>paths = new List<string>();
21
22 ············var nugetFolder = new NugetProps(this.projectDescription).DefaultNugetPackageFolder;
23 var assetPaths = new ProjectAssets( this. projectDescription) . GetPackageDirectories( @"ndo\. . +")
24 . Where( p=>p. IndexOf( "/ndo. dll/", StringComparison. OrdinalIgnoreCase) == -1) .
25 Select( p=>Path. GetDirectoryName( Path. Combine( nugetFolder, p) ) ) ;
 
 
 
 
26
27 ············foreach (var assetPath in assetPaths)
28 ············{
29 ················paths.Add( assetPath );
30 ············}
31
32 ············if (projectDescription.ConfigurationOptions.VerboseMode)
33 ············{
34 ················Console.WriteLine( "Provider probing paths: " );
35 ················foreach (var path in paths)
36 ················{
37 ····················Console.WriteLine( "··" + path );
38 ················}
39 ················if (paths.Count == 0)
40 ····················Console.WriteLine( "··None found" );
41 ············}
42
43 ············return paths;
44 ········}
45
46
47 ····}
48 }
49
New Commit (4bf6f30)
1 using NDO.ProviderFactory;
2 using System;
3 using System.Collections.Generic;
4 using System.IO;
5 using System.Linq;
6
7 namespace NDOEnhancer
8 {
9 ····class ProviderPathFinder : IProviderPathFinder
10 ····{
11 ········ProjectDescription projectDescription;
12
13 ········public ProviderPathFinder(ProjectDescription projectDescription)
14 ········{
15 ············this.projectDescription = projectDescription;
16 ········}
17
18 ········public IEnumerable<string> GetPaths()
19 ········{
20 ············List<string>paths = new List<string>();
21
22 ············var nugetFolder = new NugetProps(this.projectDescription).DefaultNugetPackageFolder;
23 if ( nugetFolder == null)
24 return paths;
25
26 ············// The NDO package itself is no provider. ProjectAssets handles the
27 ············// directory separators and the lower case package folders of NuGet.
28 ············var assetPaths = new ProjectAssets(this.projectDescription).GetPackageDirectories(@"ndo\..+", "ndo.dll")
29 ················.Select(p=>Path.GetDirectoryName(Path.Combine(nugetFolder, p)));
30
31 ············foreach (var assetPath in assetPaths)
32 ············{
33 ················paths.Add( assetPath );
34 ············}
35
36 ············if (projectDescription.ConfigurationOptions.VerboseMode)
37 ············{
38 ················Console.WriteLine( "Provider probing paths: " );
39 ················foreach (var path in paths)
40 ················{
41 ····················Console.WriteLine( "··" + path );
42 ················}
43 ················if (paths.Count == 0)
44 ····················Console.WriteLine( "··None found" );
45 ············}
46
47 ············return paths;
48 ········}
49
50
51 ····}
52 }
53