Exemplo n.º 1
0
        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();
                }
            });
        }
Exemplo n.º 2
0
        private void HTTPFileCallback(HTTPResponse pictureURLRequestResponse)
        {
            downloadedResourcesCount++;
            if (pictureURLRequestResponse.dataLength != 0)
            {
                System.IO.File.WriteAllBytes(ad.getLocalImageURL(imageOrientations[pictureURLRequestResponse.url], imageTypes[pictureURLRequestResponse.url]), 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);
			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 removeLocalResources(PictureAd ad)
 {
     if (!ad.adIsValid())
     {
         return;
     }
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Landscape, ImageType.Close));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Landscape, ImageType.Frame));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Landscape, ImageType.Base));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Portrait, ImageType.Close));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Portrait, ImageType.Base));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Portrait, ImageType.Frame));
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 void removeLocalResources(PictureAd ad)
 {
     if (!ad.adIsValid()) return;
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Landscape, ImageType.Close));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Landscape, ImageType.Frame));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Landscape, ImageType.Base));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Portrait, ImageType.Close));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Portrait, ImageType.Base));
     System.IO.File.Delete(ad.getLocalImageURL(ImageOrientation.Portrait, ImageType.Frame));
 }
 void initTexture(ImageOrientation imageOrientation, ImageType imageType, PictureAd ad) {
   textures[imageOrientation][imageType] = textureFromBytes(textureBytesForFrame(ad.getLocalImageURL(imageOrientation, imageType)));
 }
 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);
 }
Exemplo n.º 9
0
 void initTexture(ImageOrientation imageOrientation, ImageType imageType, PictureAd ad)
 {
     textures[imageOrientation][imageType] = textureFromBytes(textureBytesForFrame(ad.getLocalImageURL(imageOrientation, imageType)));
 }