当前位置: 首页>>代码示例>>C#>>正文


C# Request.YieldPackageSource方法代码示例

本文整理汇总了C#中Request.YieldPackageSource方法的典型用法代码示例。如果您正苦于以下问题:C# Request.YieldPackageSource方法的具体用法?C# Request.YieldPackageSource怎么用?C# Request.YieldPackageSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request.YieldPackageSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResolvePackageSources

        /// <summary>
        /// Resolves and returns Package Sources to the client.
        /// 
        /// Specified sources are passed in via the request object (<c>request.GetSources()</c>). 
        /// 
        /// Sources are returned using <c>request.YieldPackageSource(...)</c>
        /// </summary>
        /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
        public void ResolvePackageSources(Request request)
        {
            // TODO: improve this debug message that tells us what's going on.
            request.Debug("Entering '{0}::ResolvePackageSources'", PackageProviderName);

            foreach (var source in GetSource(request.Sources.ToArray()))
            {
                request.YieldPackageSource(source.Id, source.Value, false, source.Authenticated, false);
            }
        }
开发者ID:eeevans,项目名称:ChocolateyProvider,代码行数:18,代码来源:ChocolateyPackageProvider.cs

示例2: RemovePackageSource

        public void RemovePackageSource(string name, Request request)
        {
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::RemovePackageSource' '{1}'", PackageProviderName, name);
            var pkgSource = packageSources.FirstOrDefault(each => each.name.EqualsIgnoreCase(name));
            if (pkgSource == null) {
                pkgSource = packageSources.FirstOrDefault(each => each.location.EqualsIgnoreCase(name));
            }
            if (pkgSource == null) {
                request.Error(ErrorCategory.ObjectNotFound, name, Constants.Messages.UnableToResolveSource, name);
                return;
            }
            // tell the user what we removed.
            request.YieldPackageSource(pkgSource.name, pkgSource.location, pkgSource.isTrusted, true, pkgSource.isValidated);

            //remove it from the list.
            packageSources = packageSources.Where(each => each != pkgSource).ToArray();
        }
开发者ID:notgerry,项目名称:oneget,代码行数:18,代码来源:Happy1.cs

示例3: ResolvePackageSources

        public void ResolvePackageSources(Request request)
        {
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::ResolvePackageSources'", PackageProviderName);

            // todo: resolve package sources
            if (request.PackageSources.Any()) {
                // the system is requesting sources that match the values passed.
                // if the value passed can be a legitimate source, but is not registered, return a package source marked unregistered.
                packageSources.SerialForEach((each) => {
                    if (request.PackageSources.Any(s => each.name.EqualsIgnoreCase(s) || each.location.EqualsIgnoreCase(s))) {
                        request.YieldPackageSource(each.name, each.location, each.isTrusted, true, each.isValidated);
                    }
                });
            } else {
                // the system is requesting all the registered sources
                packageSources.SerialForEach((each) => {request.YieldPackageSource(each.name, each.location, each.isTrusted, true, each.isValidated);});
            }
        }
开发者ID:notgerry,项目名称:oneget,代码行数:19,代码来源:Happy1.cs

示例4: AddPackageSource

        public void AddPackageSource(string name, string location, bool trusted, Request request)
        {
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::AddPackageSource' '{1}','{2}','{3}'", PackageProviderName, name, location, trusted);

            var pkgSource = packageSources.FirstOrDefault(each => each.name.EqualsIgnoreCase(name));
            if (pkgSource != null && !request.GetOptionValue(Constants.Parameters.IsUpdate).IsTrue()) {
                // pkgSource already exists.
                // this is an error.
                request.Error(ErrorCategory.ResourceExists, name, Constants.Messages.PackageSourceExists, name);
                return;
            }

            if (pkgSource != null) {
                //update
                pkgSource.location = location;
                pkgSource.isTrusted = trusted;
            } else {
                // add new
                pkgSource = new PkgSource {
                    name = name,
                    location = location,
                    isTrusted = trusted,
                    isValidated = true
                };
                // add to the array.
                packageSources = packageSources.ConcatSingleItem(pkgSource).ToArray();
            }

            request.YieldPackageSource(pkgSource.name, pkgSource.location, pkgSource.isTrusted, true, pkgSource.isValidated);
        }
开发者ID:notgerry,项目名称:oneget,代码行数:31,代码来源:Happy1.cs


注:本文中的Request.YieldPackageSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。