Ejemplo n.º 1
0
        public static async Task <LocalCacheManager> InitializeAsync(StorageFolderType secondaryFolderType, string currentFolderName = "")
        {
            var manager = new LocalCacheManager();

            manager.RootFolder          = StorageHelper.LocalCacheFolder;
            manager.SecondaryFolderType = secondaryFolderType;
            manager.SecondaryFolder     = await manager.GetOrCreateSecondaryFolderAsync() /*.ConfigureAwait(false)*/;

            manager.CurrentFolder = await manager.GetOrCreateCurrentFolderAsync(currentFolderName) /*.ConfigureAwait(false)*/;

            return(manager);
        }
        public static async Task <string> GetFullMappedPathAsync(string url, StorageFolderType folderType, string fileName = "", string subType = "")
        {
            var storageManager = await LocalCacheManager.InitializeAsync(folderType);

            var dir = storageManager.CurrentFolder?.Path;

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = GetDownloadedLocalFileName(url, subType);
            }

            return(System.IO.Path.Combine(dir, fileName));
        }