/// <summary> /// Return Current docker images /// </summary> /// <param name="dockerQuery"></param> /// <returns></returns> private static List <DockerImageInfo> GetCurrentDockerImageInfos(string dockerQuery) { List <DockerImageInfo> result = new List <DockerImageInfo>(); try { List <string> queryList = dockerQuery.Split("\n").ToList(); int foundStartIdx = queryList.FindIndex(i => i.StartsWith("REPOSITORY")); foundStartIdx++; // Iterate all query result for (int i = foundStartIdx; i < queryList.Count; i++) { if (string.IsNullOrWhiteSpace(queryList[i])) { break; } // Get word strings without empty string List <string> words = queryList[i].Split(' ').Where(v => !string.IsNullOrWhiteSpace(v)).ToList(); DockerImageInfo info = new DockerImageInfo() { Name = words[0], Tag = words[1], Id = words[2] }; result.Add(info); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(result); }
public ImageDataGridItemModel(ImagesTabModel imagesTabModel, DockerCommandService dockerCommandService, DockerImageInfo imageInfo) { this.imagesTabModel = imagesTabModel; this.dockerCommandService = dockerCommandService; ID = imageInfo.ID; Repository = imageInfo.Repository; Tag = imageInfo.Tag; Created = imageInfo.Created; Size = imageInfo.Size; }