public async Task CopyTo(string destinationPath) { await Task.Run(async() => { try { IO.Directory.CreateDirectory(destinationPath); } catch { } foreach (var item in _items) { await item.CopyTo(IO.Path.Combine(destinationPath, item.Name)); } CopiedFromToEvent?.Invoke(_itemFactory.CreateDirectory(destinationPath, ExcludedExtensions), destinationPath); }).ConfigureAwait(false); }
/// <summary> /// Копировать элемент в указанный путь с заменой. /// </summary> /// <param name="destinationPath">Путь куда копировать.</param> public async Task CopyTo(string destinationPath) { await Task.Run(() => { try { IO.File.Copy(FullPath, destinationPath, true); } catch (Exception exc) { SyncErrorEvent?.Invoke(exc.Message); } File destinationFile = null; try { destinationFile = new File(destinationPath); } catch { } CopiedFromToEvent?.Invoke(destinationFile, destinationPath); }).ConfigureAwait(false); }
private void CopiedFromTo(IItem newItem, string destinationPath) { CopiedFromToEvent?.Invoke(this, newItem); }