Exemple #1
0
    // TODO in the NuGetUtils.MSBuild.Exec.Inspect, check the type of the array. If it is
    // string -> use ItemSpec
    // other primitive -> use Convert.ChangeType( ItemSpec)
    // non-primitve -> use new JObject() { properties built from task item metadata ... }
    internal static JToken GetInputPropertyValue(this TaskProxy.TaskPropertyHolder propertyHolder)
    {
        var val = propertyHolder.Value;

        return(propertyHolder.IsTaskItemArray ?
               (JToken) new JArray(((ITaskItem[])val).Select(v => v.GetJTokenFromTaskItem(propertyHolder.PropertyTypeName)).ToArray()) :
               new JValue(val));
    }
Exemple #2
0
 internal static Object GetOutputPropertyValue(this TaskProxy.TaskPropertyHolder propertyHolder, JToken token)
 {
     return(propertyHolder.IsTaskItemArray ?
            (Object)((token as JArray)?.Select(j => j.GetTaskItemFromJToken())?.Where(t => t != null)?.ToArray() ?? Empty <ITaskItem> .Array) :
            (token as JValue)?.Value?.ToString());
 }