コード例 #1
0
        public static Task <bool> IsKnownFolderFileExistsAsync(
            KnownFolderId knownFolderId,
            string fileName)
        {
            StorageFolder workingFolder = StorageFileHelper.GetFolderFromKnownFolderId(knownFolderId);

            return(workingFolder.IsFileExistsAsync(fileName));
        }
コード例 #2
0
        /// <summary>
        /// Return 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>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));
        }