本文整理汇总了C#中IPackage.GetLibFiles方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.GetLibFiles方法的具体用法?C# IPackage.GetLibFiles怎么用?C# IPackage.GetLibFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.GetLibFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
public IEnumerable<PackageVerifierIssue> Validate(IPackageRepository packageRepo, IPackage package, IPackageVerifierLogger logger)
{
if (!package.IsSatellitePackage())
{
IEnumerable<string> allXmlFiles =
from file in package.GetLibFiles()
select file.Path into path
where path.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)
select path;
foreach (IPackageFile current in package.GetLibFiles())
{
string assemblyPath = current.Path;
// TODO: Does this need to check for just managed code?
if (assemblyPath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
{
string docFilePath = Path.ChangeExtension(assemblyPath, ".xml");
if (!allXmlFiles.Contains(docFilePath, StringComparer.OrdinalIgnoreCase))
{
yield return PackageIssueFactory.AssemblyHasNoDocFile(assemblyPath);
}
}
}
}
yield break;
}
示例2: GetPackageDefinition
public IEnumerable<string> GetPackageDefinition(IPackage package, bool includePreRelease)
{
_nugetFactory.GetPackageManager().InstallPackage(package, true, includePreRelease);
var packageDir = _nugetFactory.GetPackageManager().PathResolver.GetPackageDirectory(package);
var dllFiles = package.GetLibFiles().Select(f => Path.Combine(_arguments.GetInstallationDirectory(), packageDir, f.Path));
var result = _packageReader.ReadPackage(dllFiles);
return result;
}
示例3: GetFiles
private static IEnumerable<Tuple<IPackageFile, string>> GetFiles(IPackage package)
{
if (package.GetLibFiles().IsEmpty() && package.GetContentFiles().IsEmpty()) {
foreach (var packageFile in package.GetFiles()) {
yield return new Tuple<IPackageFile, string>(packageFile, packageFile.Path);
}
} else {
// TODO: net40 is hard-coded. Some day more frameworks should be supported
foreach (var packageFile in package.GetLibFiles()) {
yield return new Tuple<IPackageFile, string>(packageFile, packageFile.Path.Substring(@"lib\net40\".Length));
}
foreach (var packageFile in package.GetContentFiles()) {
yield return new Tuple<IPackageFile, string>(packageFile, packageFile.Path.Substring(@"content\".Length));
}
}
}
示例4: ProcessSymbolsAsync
public async Task ProcessSymbolsAsync(IPackage package, string symbolSourceUri)
{
var files = package.GetLibFiles().Where(f => f.Path.EndsWith("pdb", StringComparison.InvariantCultureIgnoreCase));
using (var tempFolder = CreateTempFolderForPackage(package))
{
foreach (var file in files)
{
var filePath = Path.Combine(tempFolder.Path, file.Path);
var fileDir = Path.GetDirectoryName(filePath);
if (fileDir != null && !Directory.Exists(fileDir))
{
Directory.CreateDirectory(fileDir);
}
using (var writeStream = File.Open(filePath, FileMode.Create, FileAccess.Write))
{
using (var readStream = file.GetStream())
{
await readStream.CopyToAsync(writeStream);
}
}
await ProcessSymbolFileAsync(package, filePath, symbolSourceUri);
}
}
}
示例5: UnpackPackage
private void UnpackPackage(string folder, IPackage package)
{
var framework = new FrameworkName(".NETFramework,Version=v4.0");
var libFiles = package.GetLibFiles();
foreach (var file in libFiles)
{
if (file.TargetFramework.Version != framework.Version || file.TargetFramework.Identifier != framework.Identifier)
continue;
string fileOut = Path.Combine(folder, file.EffectivePath);
if (Path.GetExtension(fileOut) == ".dll")
UnpackFile(fileOut, file);
}
}