Exemple #1
0
		public static void CopyFileEx(String source, String destination, CancellationToken token, CopyFileProgressCallback progressCallback)
		{
			try
			{
				CopyFileExWrapper.CopyFile(
					new FileInfo(source),
					new FileInfo(destination),
					CopyFileOptions.None,
					(src, dest, state, fileSize, bytesTransferred) =>
					{
						if (token.IsCancellationRequested)
						{
							return CopyFileCallbackAction.Cancel;
						}
						else
						{
							progressCallback(src.FullName, dest.FullName, fileSize, bytesTransferred);

							return CopyFileCallbackAction.Continue;
						}
					});
			}
			catch (Exception ex)
			{
				//Converiosn to the OperationCancelledException;
				token.ThrowIfCancellationRequested();

				throw;
			}
		}
Exemple #2
0
		public static void CopyFileEx(String source, String destination, CopyFileProgressCallback progressCallback)
		{
			CopyFileExWrapper.CopyFile(
				new FileInfo(source),
				new FileInfo(destination),
				CopyFileOptions.None,
				(src, dest, state, fileSize, bytesTransferred) =>
				{
					progressCallback(src.FullName, dest.FullName, fileSize, bytesTransferred);

					return CopyFileCallbackAction.Continue;
				});
		}
Exemple #3
0
		public static void CopyFileEx(String source, String destination)
		{
			CopyFileExWrapper.CopyFile(new FileInfo(source), new FileInfo(destination));
		}