本文整理汇总了C#中IPackageRepository.Feature方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageRepository.Feature方法的具体用法?C# IPackageRepository.Feature怎么用?C# IPackageRepository.Feature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackageRepository
的用法示例。
在下文中一共展示了IPackageRepository.Feature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Lock
public static IPackageDescriptor Lock(this IPackageDescriptor descriptor, IPackageRepository repository, string scope = null)
{
scope = scope ?? string.Empty;
var lockedRepo = repository.Feature<ISupportLocking>();
if (lockedRepo == null)
return descriptor;
var lockedDescriptor = new PackageDescriptor(descriptor);
var lockedPackages = lockedRepo.LockedPackages[scope];
return Lock(lockedDescriptor, lockedPackages);
}
示例2: ValidateInputs
IEnumerable<ICommandOutput> ValidateInputs()
{
// TODO: HACK HACK HACK
var namedRepository = Remotes.PublishRepositories(Remote).SelectMany(_ => _).FirstOrDefault();
if (namedRepository == null)
{
yield return new UnknownRemoteName(Remote);
foreach (var _ in HintRemoteRepositories()) yield return _;
yield break;
}
if ((Username != null && Password == null) || (Username == null && Password != null))
{
yield return new IncompleteCredentials();
yield break;
}
bool hasAuth = Username != null && Password != null;
if (hasAuth) _credentials = new NetworkCredential(Username, Password);
_authenticationSupport = namedRepository.Feature<ISupportAuthentication>();
if (hasAuth && _authenticationSupport == null)
{
yield return new RemoteAuthenticatioNotSupported(namedRepository);
yield break;
}
_authenticationSupport = _authenticationSupport ?? new NullAuthentication();
//_repositories = namedRepository.
_remoteRepository = namedRepository;
var publishingRepo = _remoteRepository.Feature<ISupportPublishing>();
if (publishingRepo == null)
{
yield return new Error("Repository '{0}' doesn't support publishing.", namedRepository.Name);
yield break;
}
if (Path != null)
{
var packageFile = FileSystem.GetFile(Path);
if (!packageFile.Exists)
{
yield return new FileNotFound(Path);
yield break;
}
_packageStream = packageFile.OpenRead;
_packageFileName = packageFile.Name;
// TODO: This looks iffy at best
var package = new ZipFilePackage(packageFile);
_packageName = package.Name;
_packageVersion = package.SemanticVersion;
}
else if (Name != null)
{
// get latest version of the Named package
if (!HostEnvironment.CurrentDirectoryRepository.PackagesByName.Contains(Name))
{
yield return new Error("No package named '{0}' was found.", Name);
yield break;
}
var packageToCopy = HostEnvironment.CurrentDirectoryRepository.PackagesByName[Name].OrderByDescending(x => x.SemanticVersion).First();
_packageStream = () => packageToCopy.Load().OpenStream();
_packageFileName = packageToCopy.FullName + ".wrap";
_packageName = packageToCopy.Name;
_packageVersion = packageToCopy.SemanticVersion;
}
else
{
yield return new Error("Please specify either a file path using the -Path input, or a name using -Name.");
}
}
示例3: ToPublishEndpoints
ICollection<RemoteRepositoryEndpoint> ToPublishEndpoints(IPackageRepository repo)
{
if (repo == null || repo.Feature<ISupportPublishing>() == null) return new List<RemoteRepositoryEndpoint>(0);
return new List<RemoteRepositoryEndpoint>
{
new RemoteRepositoryEndpoint
{
Token = repo.Token,
Username = Username,
Password = Password
}
};
}