private static ResolvedFile CreateResolvedFile( string packageId, string version, string filePath, string destinationSubDirectory, bool preserveStoreLayout, AssetType assetType) { string packageRoot; string packageDirectory = new MockPackageResolver() .GetPackageDirectory(packageId, NuGetVersion.Parse(version), out packageRoot); assetType.Should().NotBe(AssetType.None); string sourcepath = Path.Combine(packageDirectory, filePath); string sourcedir = Path.GetDirectoryName(sourcepath); string destinationSubDirPath = preserveStoreLayout ? sourcedir.Substring(packageRoot.Length) : destinationSubDirectory; if (!String.IsNullOrEmpty(destinationSubDirPath) && !destinationSubDirPath.EndsWith(Path.DirectorySeparatorChar)) { destinationSubDirPath += Path.DirectorySeparatorChar; } return(new ResolvedFile( sourcepath, destinationSubDirPath, new PackageIdentity(packageId, NuGetVersion.Parse(version)), assetType)); }
private static ResolvedFile CreateResolvedFile( string packageId, string version, string filePath, string destinationSubDirectory, bool preserveCacheLayout, AssetType assetType) { string packageRoot; string packageDirectory = new MockPackageResolver() .GetPackageDirectory(packageId, NuGetVersion.Parse(version), out packageRoot); assetType.Should().NotBe(AssetType.None); string sourcepath = Path.Combine(packageDirectory, filePath); string sourcedir = Path.GetDirectoryName(sourcepath); string destinationSubDirPath = preserveCacheLayout ? sourcedir.Substring(packageRoot.Length): destinationSubDirectory; return(new ResolvedFile( sourcepath, destinationSubDirPath, assetType)); }