Nexus.Client.Util.FileUtil.Copy C# (CSharp) Метод

Copy() публичный статический Метод

Copies the source to the destination.
If the source is a directory, it is copied recursively.
public static Copy ( TxFileManager p_tfmFileManager, string p_strSource, string p_strDestination, bool>.Func p_fncCopyCallback ) : bool
p_tfmFileManager ChinhDo.Transactions.TxFileManager The transactional file manager to use to copy the files.
p_strSource string The path from which to copy.
p_strDestination string The path to which to copy.
p_fncCopyCallback bool>.Func A callback method that notifies the caller when a file has been copied, /// and provides the opportunity to cancel the copy operation.
Результат bool
		public static bool Copy(TxFileManager p_tfmFileManager, string p_strSource, string p_strDestination, Func<string, bool> p_fncCopyCallback)
		{
			if (File.Exists(p_strSource))
			{
				if (!Directory.Exists(Path.GetDirectoryName(p_strDestination)))
					p_tfmFileManager.CreateDirectory(Path.GetDirectoryName(p_strDestination));
				p_tfmFileManager.Copy(p_strSource, p_strDestination, true);
				if ((p_fncCopyCallback != null) && p_fncCopyCallback(p_strSource))
					return false;
			}
			else if (Directory.Exists(p_strSource))
			{
				if (!Directory.Exists(p_strDestination))
					p_tfmFileManager.CreateDirectory(p_strDestination);
				string[] strFiles = Directory.GetFiles(p_strSource);
				foreach (string strFile in strFiles)
				{
					p_tfmFileManager.Copy(strFile, Path.Combine(p_strDestination, Path.GetFileName(strFile)), true);
					if ((p_fncCopyCallback != null) && p_fncCopyCallback(strFile))
						return false;
				}
				string[] strDirectories = Directory.GetDirectories(p_strSource);
				foreach (string strDirectory in strDirectories)
					if (!Copy(strDirectory, Path.Combine(p_strDestination, Path.GetFileName(strDirectory)), p_fncCopyCallback))
						return false;
			}
			return true;
		}

Same methods

FileUtil::Copy ( string p_strSource, string p_strDestination, bool>.Func p_fncCopyCallback ) : bool