Beispiel #1
0
        public static async Task Init()
        {
            var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(
                AppLocalFolderLibrary.musicFolderName,
                CreationCollisionOption.OpenIfExists);

            instance = new AppLocalFolderFileUtils(folder);
        }
        /// <summary>
        /// Resolves and returns the relative music path of the track the given file
        /// points to. The path is returned with Unix-style path separators.
        /// </summary>
        /// <param name="file"></param>
        /// <returns>the relative music path of the file with Unix-style path separators</returns>
        public static string MusicPath(IStorageFile file)
        {
            // music\Iron Maiden\...
            var path = AppLocalFolderFileUtils.LocalPath(file);

            // Iron Maiden/...
            return(FileUtilsBase.UnixSeparators(path.Substring(musicFolderName.Length + 1)));
        }
Beispiel #3
0
        public override async Task Delete(List <string> songs)
        {
            foreach (var relativePath in songs)
            {
                var filePath = AppLocalFolderFileUtils.WindowsSeparators(relativePath);
                var file     = await RootFolder.GetFileAsync(filePath);

                await file.DeleteAsync(StorageDeleteOption.PermanentDelete);
            }
            await DeleteEmptyFolders();
        }
Beispiel #4
0
        public static async Task UpdateLiveTiles(TileUtil util)
        {
            await EnsureCoverFolderExists();

            var fileUtils = new AppLocalFolderFileUtils();
            var images    = (await fileUtils.ListFilesAsUris(CoverArtFolderPath))
                            .OrderBy(uri => Guid.NewGuid()) // randomizes
                            .Take(5)                        // at most 5 images are needed
                            .ToList();

            util.UpdateLiveTiles(images);
        }