本文整理汇总了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);
}
示例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);
}
示例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));
}
示例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
}
示例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
}
示例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);
}