Exemplo n.º 1
0
        internal static Uri GetAzureUrl(LazyUri url)
        {
            var container = GetAzureContainer(url);
            var name      = GetFileCachePath(url);

            return(AzureApi.GetUrlForBlob(container, name));
        }
Exemplo n.º 2
0
        internal static async Task <HttpResponseMessage> GetAzureResponseAsync(string container, string name, long startPosition, Shaman.Types.WebFile file)
        {
            var options = new WebRequestOptions()
            {
                Timeout = 30000, TimeoutSecondRetrialAfterError = 10000, TimeoutStartSecondRetrial = null
            };

            if (startPosition != 0)
            {
                options.AddHeader("Range", "bytes=" + startPosition + "-");
            }
            var response = (await ExtensionMethods.SendAsync(new LazyUri(AzureApi.GetUrlForBlob(container, name)), options, null)).Response;
            IEnumerable <string> errs;

            if (response.Headers.TryGetValues("x-ms-meta-err", out errs))
            {
                throw MediaStream.ExceptionFromCachedResponse(errs.First());
            }

            return(response);
        }