本文整理匯總了C#中NuGet.OptimizedZipPackage.GetLibFiles方法的典型用法代碼示例。如果您正苦於以下問題:C# OptimizedZipPackage.GetLibFiles方法的具體用法?C# OptimizedZipPackage.GetLibFiles怎麽用?C# OptimizedZipPackage.GetLibFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NuGet.OptimizedZipPackage
的用法示例。
在下文中一共展示了OptimizedZipPackage.GetLibFiles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: installPackageToAppDir
async Task<string> installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release)
{
string tmpDir = default(string);
bool shouldDeleteTmpDir = findShortTemporaryDir(out tmpDir);
var fs = new PhysicalFileSystem(tmpDir);
var pkg = new OptimizedZipPackage(fs, Path.Combine(updateInfo.PackageDirectory, release.Filename));
var target = getDirectoryForRelease(release.Version);
// NB: This might happen if we got killed partially through applying the release
if (target.Exists) {
this.Log().Warn("Found partially applied release folder, killing it: " + target.FullName);
await Utility.DeleteDirectory(target.FullName);
}
target.Create();
// Copy all of the files out of the lib/ dirs in the NuGet package
// into our target App directory.
//
// NB: We sort this list in order to guarantee that if a Net20
// and a Net40 version of a DLL get shipped, we always end up
// with the 4.0 version.
this.Log().Info("Writing files to app directory: {0}", target.FullName);
var toWrite = pkg.GetLibFiles().Where(x => pathIsInFrameworkProfile(x, appFrameworkVersion))
.OrderBy(x => x.Path)
.ToList();
// NB: Because of the above NB, we cannot use ForEachAsync here, we
// have to copy these files in-order. Once we fix assembly resolution,
// we can kill both of these NBs.
await Task.Run(() => toWrite.ForEach(x => copyFileToLocation(target, x)));
await pkg.GetContentFiles().ForEachAsync(x => copyFileToLocation(target, x));
if (shouldDeleteTmpDir) {
await Utility.DeleteDirectory(tmpDir);
}
return target.FullName;
}