summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Build.Tasks/FixedCreateCSharpManifestResourceName.cs
blob: 34ee1f555f72943ad7a43ec612c92dbe5d833957 (plain)
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
´╗┐using Microsoft.Build.Framework;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;

namespace Xamarin.Forms.Build.Tasks
{
	public class FixedCreateCSharpManifestResourceName : CreateCSharpManifestResourceName
	{
		[Output]
#pragma warning disable 0108
		public ITaskItem[] ResourceFilesWithManifestResourceNames { get; set; }
#pragma warning restore 0108

		public override bool Execute()
		{
			var ret = base.Execute();

			ResourceFilesWithManifestResourceNames = new TaskItem[ResourceFiles.Length];

			for (var i = 0; i < ResourceFiles.Length; i++)
			{
				var copy = new TaskItem(ResourceFiles[i]);
				copy.SetMetadata("ManifestResourceName", ManifestResourceNames[i].ItemSpec);
				ResourceFilesWithManifestResourceNames[i] = copy;
			}
			return ret;
		}
	}
}