コード例 #1
0
        /// <summary>
        /// Replaces the specified file with a copy of the current file.
        /// </summary>
        /// <param name="fileToReplace"></param>
        /// <returns></returns>
        public Task CopyAndReplaceAsync(IStorageFile fileToReplace)
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            return(_file.CopyAndReplaceAsync((Windows.Storage.StorageFile)((StorageFile)fileToReplace)).AsTask());
#elif __ANDROID__ || __UNIFIED__ || WIN32
            return(Task.Run(() =>
            {
                File.Replace(Path, fileToReplace.Path, null);
            }));
#elif TIZEN
            return(Task.Run(() =>
            {
                File.Delete(fileToReplace.Path);
                File.Copy(Path, fileToReplace.Path);
            }));
#else
            throw new PlatformNotSupportedException();
#endif
        }