本文整理汇总了C#中IPackage.GetSupportedFrameworks方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.GetSupportedFrameworks方法的具体用法?C# IPackage.GetSupportedFrameworks怎么用?C# IPackage.GetSupportedFrameworks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.GetSupportedFrameworks方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deploy
public bool Deploy(string taskId, IPackage package, CancellationTokenSource cancellationToken, Action<ProgressReport> reportProgress)
{
var unpackFolder = Path.Combine(AgentSettings.AgentProgramDataPath, _agentSettingsManager.Settings.UnpackingLocation);
var workingFolder = Path.Combine(unpackFolder, package.GetFullName());
var targetInstallationFolder = Path.Combine(_agentSettingsManager.Settings.BaseInstallationPath, package.Id);
using (var deploymentContext = new DeploymentContext(package, _agentSettingsManager, workingFolder, targetInstallationFolder, taskId))
{
var logger = deploymentContext.GetLoggerFor(this);
var frameworks = package.GetSupportedFrameworks();
foreach (var framework in frameworks)
{
logger.DebugFormat("package supports {0}", framework.FullName);
}
try
{
reportProgress(ProgressReport.Info(deploymentContext, this, package.Id,
package.Version.Version.ToString(), taskId,
"Extracting package to temp folder..."));
new NuGetPackageExtractor(Logger).Extract(package, workingFolder);
}
catch (Exception ex)
{
logger.Fatal("Could not extract package", ex);
}
try
{
BeforeDeploy(deploymentContext, reportProgress);
PerformDeploy(deploymentContext, reportProgress);
AfterDeploy(deploymentContext, reportProgress);
reportProgress(ProgressReport.Info(deploymentContext, this, package.Id,
package.Version.Version.ToString(), taskId,
"Deployment complete"));
return true;
}
catch (Exception ex)
{
logger.Error("An error occurred", ex);
reportProgress(ProgressReport.Error(deploymentContext, this, package.Id,
package.Version.Version.ToString(), taskId,
"Deployment failed", ex));
return false;
}
finally
{
deploymentContext.RemoveAppender();
}
}
}
示例2: CalculateDerivedData
protected virtual void CalculateDerivedData(IPackage sourcePackage, LucenePackage package, string path, Func<Stream> openStream)
{
var fastPackage = sourcePackage as FastZipPackage;
if (fastPackage == null)
{
CalculateDerivedDataFromStream(package, openStream);
}
else
{
package.PackageSize = fastPackage.Size;
package.PackageHash = System.Convert.ToBase64String(fastPackage.Hash);
package.Created = fastPackage.Created;
}
package.PackageHashAlgorithm = HashAlgorithmName;
package.LastUpdated = GetLastModified(package, path);
package.Published = package.LastUpdated;
package.Path = path;
package.SupportedFrameworks = sourcePackage.GetSupportedFrameworks().Select(VersionUtility.GetShortFrameworkName);
var files = IgnorePackageFiles
? Enumerable.Empty<string>()
: sourcePackage.GetFiles().Select(f => f.Path).ToArray();
package.Files = files;
}
示例3: GetSupportedFrameworks
public virtual IEnumerable<FrameworkName> GetSupportedFrameworks(IPackage package)
{
return package.GetSupportedFrameworks();
}
示例4: ServerPackage
public ServerPackage(IPackage package, PackageDerivedData packageDerivedData)
{
Id = package.Id;
Version = package.Version;
Title = package.Title;
Authors = package.Authors;
Owners = package.Owners;
IconUrl = package.IconUrl;
LicenseUrl = package.LicenseUrl;
ProjectUrl = package.ProjectUrl;
RequireLicenseAcceptance = package.RequireLicenseAcceptance;
DevelopmentDependency = package.DevelopmentDependency;
Description = package.Description;
Summary = package.Summary;
ReleaseNotes = package.ReleaseNotes;
Language = package.Language;
Tags = package.Tags;
Copyright = package.Copyright;
MinClientVersion = package.MinClientVersion;
ReportAbuseUrl = package.ReportAbuseUrl;
DownloadCount = package.DownloadCount;
IsAbsoluteLatestVersion = package.IsAbsoluteLatestVersion;
IsLatestVersion = package.IsLatestVersion;
Listed = package.Listed;
Published = package.Published;
_dependencySets = package.DependencySets.ToList();
Dependencies = DependencySetsAsString(package.DependencySets);
_supportedFrameworks = package.GetSupportedFrameworks().ToList();
SupportedFrameworks = string.Join("|", package.GetSupportedFrameworks().Select(VersionUtility.GetFrameworkString));
PackageSize = packageDerivedData.PackageSize;
PackageHash = packageDerivedData.PackageHash;
PackageHashAlgorithm = packageDerivedData.PackageHashAlgorithm;
LastUpdated = packageDerivedData.LastUpdated;
Created = packageDerivedData.Created;
Path = packageDerivedData.Path;
FullPath = packageDerivedData.FullPath;
}
示例5: GetNewestSupportedFramework
private static FrameworkName GetNewestSupportedFramework(IPackage packageMetadata)
{
return packageMetadata.GetSupportedFrameworks()
.Where(x => x.Identifier == DotNetFramework)
.OrderByDescending(x => x.Version)
.FirstOrDefault();
}
示例6: GetSupportedFrameworks
private static IEnumerable<string> GetSupportedFrameworks(IPackage nugetPackage)
{
var supportedFrameworks = nugetPackage.GetSupportedFrameworks().Select(fn => fn.ToShortNameOrNull()).ToArray();
if (!supportedFrameworks.AnySafe(sf => sf == null))
return new string[]{};
return supportedFrameworks;
}
示例7: SupportsTargetFrameworks
private static bool SupportsTargetFrameworks(IEnumerable<FrameworkName> targetFramework, IPackage package)
{
return targetFramework.IsEmpty() || targetFramework.Any(t => VersionUtility.IsCompatible(t, package.GetSupportedFrameworks()));
}
示例8: GetSupportedFrameworks
private static IEnumerable<string> GetSupportedFrameworks(IPackage nugetPackage)
{
return nugetPackage.GetSupportedFrameworks().Select(fn =>
fn == null ? null : VersionUtility.GetShortFrameworkName(fn)).ToArray();
}
示例9: CalculateDerivedData
protected virtual void CalculateDerivedData(IPackage sourcePackage, LucenePackage package, string path, Func<Stream> openStream)
{
var fastPackage = sourcePackage as FastZipPackage;
if (fastPackage == null)
{
CalculateDerivedDataSlowlyConsumingLotsOfMemory(package, openStream);
}
else
{
package.PackageSize = fastPackage.Size;
package.PackageHash = System.Convert.ToBase64String(fastPackage.Hash);
package.Created = fastPackage.Created;
}
package.PackageHashAlgorithm = HashAlgorithm;
package.LastUpdated = GetLastModified(package, path);
package.Published = package.LastUpdated;
package.Path = path;
package.SupportedFrameworks = sourcePackage.GetSupportedFrameworks().Select(VersionUtility.GetShortFrameworkName);
var localPackage = sourcePackage as LocalPackage;
if (localPackage != null)
{
package.Files = localPackage.GetFiles().Select(f => f.Path);
}
}
示例10: ShowProjectSelectorWindow
public IEnumerable<Project> ShowProjectSelectorWindow(
string instructionText,
IPackage package,
Predicate<Project> checkedStateSelector,
Predicate<Project> enabledStateSelector)
{
if (!_uiDispatcher.CheckAccess())
{
// Use Invoke() here to block the worker thread
object result = _uiDispatcher.Invoke(
new Func<string, IPackage, Predicate<Project>, Predicate<Project>, IEnumerable<Project>>(ShowProjectSelectorWindow),
instructionText,
package,
checkedStateSelector,
enabledStateSelector);
return (IEnumerable<Project>)result;
}
var viewModel = new SolutionExplorerViewModel(
ServiceLocator.GetInstance<DTE>().Solution,
package,
checkedStateSelector,
enabledStateSelector);
// only show the solution explorer window if there is at least one compatible project
if (viewModel.HasProjects)
{
var window = new SolutionExplorer()
{
DataContext = viewModel
};
window.InstructionText.Text = instructionText;
bool? dialogResult = null;
using (NuGetEventTrigger.Instance.TriggerEventBeginEnd(
NuGetEvent.SelectProjectDialogBegin,
NuGetEvent.SelectProjectDialogEnd))
{
dialogResult = window.ShowModal();
}
if (dialogResult ?? false)
{
return viewModel.GetSelectedProjects();
}
else
{
return null;
}
}
else
{
IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks()
.Where(name => name != null && name != VersionUtility.UnsupportedFrameworkName);
string errorMessage = supportedFrameworks.Any() ?
String.Format(
CultureInfo.CurrentCulture,
Resources.Dialog_NoCompatibleProject,
package.Id,
Environment.NewLine + String.Join(Environment.NewLine, supportedFrameworks)) :
String.Format(
CultureInfo.CurrentCulture,
Resources.Dialog_NoCompatibleProjectNoFrameworkNames,
package.Id);
// if there is no project compatible with the selected package, show an error message and return
MessageHelper.ShowWarningMessage(errorMessage, title: null);
return null;
}
}
示例11: CalculateDerivedData
protected virtual void CalculateDerivedData(IPackage sourcePackage, LucenePackage package, string path, Stream stream)
{
byte[] fileBytes;
using (stream)
{
fileBytes = stream.ReadAllBytes();
}
package.PackageSize = fileBytes.Length;
package.PackageHash = System.Convert.ToBase64String(HashProvider.CalculateHash(fileBytes));
package.PackageHashAlgorithm = HashAlgorithm;
package.LastUpdated = FileSystem.GetLastModified(path);
package.Published = package.LastUpdated;
package.Created = GetZipArchiveCreateDate(new MemoryStream(fileBytes));
package.Path = path;
package.SupportedFrameworks = sourcePackage.GetSupportedFrameworks().Select(VersionUtility.GetShortFrameworkName);
var localPackage = sourcePackage as LocalPackage;
if (localPackage != null)
{
package.Files = localPackage.GetFiles().Select(f => f.Path);
}
}
示例12: AddPackageToCache
private void AddPackageToCache(ConcurrentDictionary<IPackage, DerivedPackageData> packages, ConcurrentDictionary<string, Tuple<IPackage, DerivedPackageData>> absoluteLatest, ConcurrentDictionary<string, Tuple<IPackage, DerivedPackageData>> latest, bool checkFrameworks, HttpContext context, string path, IPackage zip)
{
string packageHash = null;
long packageSize = 0;
string persistedHashFile = EnablePersistNupkgHash ? GetHashFile(path, false) : null;
bool hashComputeNeeded = true;
ReadHashFile(context, path, persistedHashFile, ref packageSize, ref packageHash, ref hashComputeNeeded);
if (hashComputeNeeded)
{
using (var stream = _fileSystem.OpenFile(path))
{
packageSize = stream.Length;
packageHash = Convert.ToBase64String(HashProvider.CalculateHash(stream));
}
WriteHashFile(context, path, persistedHashFile, packageSize, packageHash);
}
var data = new DerivedPackageData
{
PackageSize = packageSize,
PackageHash = packageHash,
LastUpdated = _fileSystem.GetLastModified(path),
Created = _fileSystem.GetCreated(path),
Path = path,
FullPath = _fileSystem.GetFullPath(path),
// default to false, these will be set later
IsAbsoluteLatestVersion = false,
IsLatestVersion = false
};
if (checkFrameworks)
{
data.SupportedFrameworks = zip.GetSupportedFrameworks();
}
var entry = new Tuple<IPackage, DerivedPackageData>(zip, data);
// find the latest versions
string id = zip.Id.ToLowerInvariant();
// update with the highest version
absoluteLatest.AddOrUpdate(id, entry, (oldId, oldEntry) => oldEntry.Item1.Version < entry.Item1.Version ? entry : oldEntry);
// update latest for release versions
if (zip.IsReleaseVersion())
{
latest.AddOrUpdate(id, entry, (oldId, oldEntry) => oldEntry.Item1.Version < entry.Item1.Version ? entry : oldEntry);
}
// add the package to the cache, it should not exist already
Debug.Assert(packages.ContainsKey(zip) == false, "duplicate package added");
packages.AddOrUpdate(zip, entry.Item2, (oldPkg, oldData) => oldData);
}
示例13: GetSupportedFrameworks
private static IEnumerable<string> GetSupportedFrameworks(IPackage nugetPackage)
{
return nugetPackage.GetSupportedFrameworks().Select(fn => fn.ToShortNameOrNull()).ToArray();
}
示例14: FindSupportedTargetFrameworksForPackage
private List<FrameworkName> FindSupportedTargetFrameworksForPackage(IPackage package)
{
List<FrameworkName> frameworks = new List<FrameworkName>();
try
{
frameworks = package.GetSupportedFrameworks().ToList();
}
catch (Exception)
{
}
return frameworks;
}