Пример #1
0
        public static Task <bool> IsKnownFolderFileExistsAsync(
            KnownFolderId knownFolderId,
            string fileName)
        {
            StorageFolder workingFolder = StorageFileHelper.GetFolderFromKnownFolderId(knownFolderId);

            return(workingFolder.IsFileExistsAsync(fileName));
        }
        /// <summary>
        /// Gets a stream to a specified file from the application local cache folder.
        /// </summary>
        /// <param name="knownFolderId">The well known folder ID to use</param>
        /// <param name="fileName">Relative name of the file to open. Can contains subfolders.</param>
        /// <param name="accessMode">File access mode. Default is read.</param>
        /// <returns>The file stream</returns>
        public static Task <IRandomAccessStream> GetKnowFoldersFileStreamAsync(
            KnownFolderId knownFolderId,
            string fileName,
            FileAccessMode accessMode = FileAccessMode.Read)
        {
            StorageFolder workingFolder = StorageFileHelper.GetFolderFromKnownFolderId(knownFolderId);

            return(GetFileStreamAsync(fileName, accessMode, workingFolder));
        }