示例#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;
			}
		}
示例#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;
				});
		}
示例#3
0
		public static void CopyFileEx(String source, String destination)
		{
			CopyFileExWrapper.CopyFile(new FileInfo(source), new FileInfo(destination));
		}