void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if (downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable(); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); pictureURLRequest.execute(pictureURLRequestResponse => { downloadedResourcesCount++; if (pictureURLRequestResponse.dataLength != 0) { System.IO.File.WriteAllBytes(ad.getLocalImageURL(imageOrientation, imageType), pictureURLRequestResponse.data); } if (downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable(); _operationCompleteDelegate(); } }); }
void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if (downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable(); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); imageTypes[url] = imageType; imageOrientations[url] = imageOrientation; HTTPManager.sendFileRequest(pictureURLRequest, HTTPFileCallback, retryDelays, 20 * 60); }
void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if(downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable (); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); pictureURLRequest.execute(pictureURLRequestResponse => { downloadedResourcesCount ++; if(pictureURLRequestResponse.dataLength != 0) System.IO.File.WriteAllBytes(ad.getLocalImageURL(imageOrientation, imageType), pictureURLRequestResponse.data); if(downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable (); _operationCompleteDelegate(); } }); }
void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if(downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable (); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); imageTypes[url] = imageType; imageOrientations[url] = imageOrientation; HTTPManager.sendFileRequest(pictureURLRequest, HTTPFileCallback, retryDelays, 20 * 60); }