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


C# IRequest.Error方法代码示例

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


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

示例1: RemovePackageSource

        internal static void RemovePackageSource(string name, IRequest request)
        {
            IDictionary<string, PackageSource> packageSources = GetPackageSources(request);

            if (!packageSources.ContainsKey(name))
            {
                request.Error(ErrorCategory.ResourceUnavailable, name, Strings.PackageSourceNotFound, name);
                return;
            }

            packageSources.Remove(name);
            SavePackageSources(packageSources, request);
        }
开发者ID:PowerShell,项目名称:SmartPackageProvider,代码行数:13,代码来源:ProviderStorage.cs

示例2: AddPackageSource

        internal static void AddPackageSource(string name, string location, bool trusted, IRequest request)
        {
            IDictionary<string, PackageSource> packageSources = GetPackageSources(request);

            if (packageSources.ContainsKey(name))
            {
                request.Error(ErrorCategory.ResourceExists, name, Strings.PackageSourceExists, name);
                return;
            }

            packageSources.Add(name, new PackageSource() { Name = name, Location = location, Trusted = trusted, IsRegistered = true, IsValidated = true });
            SavePackageSources(packageSources, request);
        }
开发者ID:PowerShell,项目名称:SmartPackageProvider,代码行数:13,代码来源:ProviderStorage.cs

示例3: Error

 public bool Error(IRequest request, ErrorCategory category, string targetObjectValue, string messageText, params object[] args) {
     return request.Error(messageText, category.ToString(), targetObjectValue, request.FormatMessageString(messageText, args));
 }
开发者ID:40a,项目名称:PowerShell,代码行数:3,代码来源:ProviderServicesImpl.cs

示例4: DownloadPackage

        /// <summary>
        /// Downloads a remote package file to a local location.
        /// </summary>
        /// <param name="fastPackageReference"></param>
        /// <param name="location"></param>
        /// <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 DownloadPackage(string fastPackageReference, string location, IRequest request)
        {
            request.Debug("Calling '{0}::DownloadPackage' '{1}','{2}'", PackageProviderName, fastPackageReference, location);

            string source;
            string id;
            string version;
            if (!fastPackageReference.TryParseFastPath(out source, out id, out version))
            {
                request.Error(ErrorCategory.InvalidArgument, fastPackageReference, Strings.InvalidFastPath);
            }

            // TODO: download
        }
开发者ID:PowerShell,项目名称:SmartPackageProvider,代码行数:20,代码来源:SmartProvider.cs

示例5: UninstallPackage

        /// <summary>
        /// Uninstalls a package 
        /// </summary>
        /// <param name="fastPackageReference"></param>
        /// <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 UninstallPackage(string fastPackageReference, IRequest request)
        {
            request.Debug("Calling '{0}::UninstallPackage' '{1}'", PackageProviderName, fastPackageReference);

            string source;
            string id;
            string version;
            if (!fastPackageReference.TryParseFastPath(out source, out id, out version))
            {
                request.Error(ErrorCategory.InvalidArgument, fastPackageReference, Strings.InvalidFastPath, fastPackageReference);
            }

            // TODO: uninstall
        }
开发者ID:PowerShell,项目名称:SmartPackageProvider,代码行数:19,代码来源:SmartProvider.cs

示例6: InstallPackage

        /// <summary>
        /// Installs a given package.
        /// </summary>
        /// <param name="fastPackageReference">A provider supplied identifier that specifies an exact package</param>
        /// <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 InstallPackage(string fastPackageReference, IRequest request)
        {
            request.Debug("Calling '{0}::InstallPackage' '{1}'", PackageProviderName, fastPackageReference);

            string source;
            string id;
            string version;
            if (!fastPackageReference.TryParseFastPath(out source, out id, out version))
            {
                request.Error(ErrorCategory.InvalidArgument, fastPackageReference, Strings.InvalidFastPath, fastPackageReference);
            }

            Uri uri = new Uri(id);
            string filename = Path.GetFileName(uri.LocalPath);
            var tempLocation = Path.GetTempPath() + filename;

            request.ProviderServices.DownloadFile(uri, tempLocation, request);

            request.ProviderServices.Install(tempLocation, null, request);
        }
开发者ID:PowerShell,项目名称:SmartPackageProvider,代码行数:25,代码来源:SmartProvider.cs


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