-
Notifications
You must be signed in to change notification settings - Fork 569
Expand file tree
/
Copy pathAndroidError.cs
More file actions
42 lines (37 loc) · 1.03 KB
/
AndroidError.cs
File metadata and controls
42 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#nullable enable
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Android.Build.Tasks;
namespace Xamarin.Android.Tasks
{
/// <summary>
/// Provides a localizable way to log an error from an MSBuild target.
/// </summary>
public class AndroidError : Task
{
/// <summary>
/// Error code
/// </summary>
[Required]
public string Code { get; set; } = "";
/// <summary>
/// The name of the resource from Properties\Resources.resx that contains the message
/// </summary>
[Required]
public string ResourceName { get; set; } = "";
/// <summary>
/// The string format arguments to use for any numbered format items in the resource provided by ResourceName
/// </summary>
public string []? FormatArguments { get; set; }
public override bool Execute ()
{
Log.LogCodedError (
Code,
Properties.Resources.ResourceManager.GetString (ResourceName, Properties.Resources.Culture)
?? $"(Missing resource: {ResourceName})",
FormatArguments ?? []
);
return false;
}
}
}