示例#1
0
        public override bool Execute()
        {
            Log.LogMessage($"Retargeting UWP assets to {TargetPlatform}.");

            Func <ResourceCandidate, string> resourceToTargetPath;
            Func <string, string>            pathEncoder;

            switch (TargetPlatform)
            {
            case "ios":
                resourceToTargetPath = resource => iOSResourceConverter.Convert(resource, DefaultLanguage);
                pathEncoder          = p => p;
                break;

            case "android":
                resourceToTargetPath = resource => AndroidResourceConverter.Convert(resource, DefaultLanguage);
                pathEncoder          = AndroidResourceNameEncoder.EncodeFileSystemPath;
                break;

            default:
                Log.LogMessage($"Skipping unknown platform {TargetPlatform}");
                return(true);
            }

            Assets           = ContentItems.ToArray();
            RetargetedAssets = Assets
                               .Select((Func <ITaskItem, TaskItem>)(asset => ProcessContentItem(asset, resourceToTargetPath, pathEncoder)))
                               .Where(a => a != null)
                               .ToArray();

            return(true);
        }
示例#2
0
        public override bool Execute()
        {
            LogExtensionPoint.AmbientLoggerFactory.AddProvider(new TaskLoggerProvider(Log));

            this.Log().Info($"Retargeting UWP assets to {TargetPlatform}.");

            Func <ResourceCandidate, string> resourceToTargetPath;
            Func <string, string>            pathEncoder;

            switch (TargetPlatform)
            {
            case "ios":
                resourceToTargetPath = resource => iOSResourceConverter.Convert(resource, DefaultLanguage);
                pathEncoder          = p => p;
                break;

            case "android":
                resourceToTargetPath = resource => AndroidResourceConverter.Convert(resource, DefaultLanguage);
                pathEncoder          = AndroidResourceNameEncoder.EncodeFileSystemPath;
                break;

            default:
                this.Log().Info($"Skipping unknown platform {TargetPlatform}");
                return(true);
            }

            Assets           = ContentItems.ToArray();
            RetargetedAssets = Assets
                               .Select((Func <ITaskItem, TaskItem>)(asset => ProcessContentItem(asset, resourceToTargetPath, pathEncoder)))
                               .Trim()
                               .ToArray();

            return(true);
        }