示例#1
0
        public async Task AddReleaseIfExists(string branchName)
        {
            string remoteName = branchName;

            //Handle "special names"
            switch (branchName)
            {
            case "Nightly":
                remoteName = "master";
                break;

            default:
                break;
            }

            string fullpath = $"refs/heads/{remoteName}";

            /*BlobContainerClient client =
             *  new BlobContainerClient(new Uri($"https://jppcdnstorage.blob.core.windows.net/{ProductFamily}"));*/
            string path = $"https://jppcdnstorage.blob.core.windows.net/{ProductFamily}";

            BlobContainerClient client = new BlobContainerClient(new Uri(path));

            var result = client.GetBlobsAsync(prefix: $"{fullpath}/{HostVerison}");

            long          buildId = 0;
            ReleaseStream rs      = new ReleaseStream()
            {
                Name  = branchName,
                Class = ReleaseClass.Alpha
            };

            await foreach (BlobItem blob in result)
            {
                if (blob.Name.EndsWith(".zip") && !blob.Deleted)
                {
                    string blobId  = Path.GetFileNameWithoutExtension(blob.Name);
                    long   foundId = long.Parse(blobId);

                    if (foundId > buildId)
                    {
                        buildId      = foundId;
                        rs.BaseUrl   = new Uri(client.Uri.AbsoluteUri + "/" + blob.Name);
                        rs.ReleaseId = buildId;
                    }
                }
            }

            if (buildId > 0)
            {
                Streams.Add(rs);
            }
        }
示例#2
0
 public void AddReleaseStream(ReleaseStream stream)
 {
     Streams.Add(stream.Name, stream);
 }