Geowigo.Models.CartridgeTag.ImportOrMakeCache C# (CSharp) Method

ImportOrMakeCache() public method

Imports or create the cache for this CartridgeTag.
public ImportOrMakeCache ( ) : void
return void
		public void ImportOrMakeCache()
		{            
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
			{				
				// Ensures the cache folder exists.
				isf.CreateDirectory(PathToCache);
                isf.CreateDirectory(PathToSavegames);

				// Thumbnail
				string thumbCachePath = GetCachePathCore(ThumbCacheFilename);
				if (isf.FileExists(thumbCachePath))
				{
					Thumbnail = ImageUtils.GetBitmapSource(thumbCachePath, isf);
				}
				else
				{
					Thumbnail = ImageUtils.SaveThumbnail(new ImageUtils.ThumbnailOptions(isf, thumbCachePath, Cartridge.Icon, Cartridge.Poster, BigThumbnailMinWidth));
				}

                // Icon
                string iconCachePath = GetCachePathCore(IconCacheFilename);
                if (isf.FileExists(iconCachePath))
                {
                    Icon = ImageUtils.GetBitmapSource(iconCachePath, isf);
                }
                else
                {
                    Icon = ImageUtils.SaveThumbnail(new ImageUtils.ThumbnailOptions(isf, iconCachePath, Cartridge.Icon, Cartridge.Poster, SmallThumbnailMinWidth));
                }

                // Poster
                string posterCachePath = GetCachePathCore(PosterCacheFilename);
                if (isf.FileExists(posterCachePath))
                {
                    Poster = ImageUtils.GetBitmapSource(posterCachePath, isf);
                }
                else
                {
                    Poster = ImageUtils.SaveThumbnail(new ImageUtils.ThumbnailOptions(isf, posterCachePath, Cartridge.Poster, null, PosterMinWidth, true));
                }

                // Panorama
                string panoramaCachePath = GetCachePathCore(PanoramaCacheFilename);
                if (isf.FileExists(panoramaCachePath))
                {
                    Panorama = ImageUtils.GetBitmapSource(panoramaCachePath, isf);
                }
                else
                {
                    Panorama = ImageUtils.SaveThumbnail(new ImageUtils.ThumbnailOptions(isf, panoramaCachePath, Cartridge.Poster, null, PanoramaMinWidth, true, PanoramaCropHeight));
                }

				// Sounds
				ImportOrMakeSoundsCache(isf);

                // Savegames
                ImportSavegamesCache(isf);
			}
		}