コード例 #1
0
 /// <summary>
 /// Simply calls <see cref="ArtifactType.PushAsync(IEnumerable{ArtifactPush})"/> on each <see cref="ArtifactTypes"/>
 /// with their correct typed artifacts.
 /// </summary>
 public Task PushArtifactsAsync(IEnumerable <ArtifactPush>?pushes = null)
 {
     if (pushes == null)
     {
         pushes = GetArtifactPushList();
     }
     return(Task.WhenAll(ArtifactTypes.Select(t => t.PushAsync(pushes.Where(a => a.Feed.ArtifactType == t)))));
 }
コード例 #2
0
 /// <summary>
 /// Simply calls <see cref="ArtifactType.PushAsync(IEnumerable{ArtifactPush})"/> on each <see cref="ArtifactTypes"/>
 /// with their correct typed artifacts.
 /// </summary>
 public void PushArtifacts(IEnumerable <ArtifactPush> pushes = null)
 {
     if (pushes == null)
     {
         pushes = GetArtifactPushList();
     }
     Task[] tasks = ArtifactTypes.Select(t => t.PushAsync(pushes.Where(a => a.Feed.ArtifactType == t))).ToArray();
     Task.WaitAll(tasks);
 }
 /// <summary>
 /// Gets a read only list of all the pushes of artifacts for all <see cref="ArtifactType"/>.
 /// </summary>
 /// <param name="reset">
 /// True to recompute the list from all <see cref="ArtifactType.GetPushListAsync(bool)"/>
 /// (without reseting them).
 /// </param>
 /// <returns>The set of pushes.</returns>
 public IReadOnlyList <ArtifactPush> GetArtifactPushList(bool reset = false)
 {
     if (_artifactPushes == null || reset)
     {
         _artifactPushes = new List <ArtifactPush>();
         var tasks = ArtifactTypes.Select(f => f.GetPushListAsync()).ToArray();
         Task.WaitAll(tasks);
         foreach (var p in tasks.Select(t => t.Result))
         {
             _artifactPushes.AddRange(p);
         }
     }
     return(_artifactPushes);
 }