public override void AbstractReplace(AbstractFolder inDirectory) { // нет упрощенного перемещения для архивных файлов, оставляем только обобщенный код var abstractFile = inDirectory.AbstractCreateFile(AbstractName); AbstractCopy(abstractFile); AbstractRemove(); }
public IEnumerable<ProgressInfo> AbstractCopy(AbstractFolder nodeElement) { var count = h_countFiles(this); var progressInfo = new ProgressInfo { All = count }; Directory.CreateDirectory(nodeElement.AbstractPath); foreach (var item in FilesList) { var destination = nodeElement.AbstractCreateFile(item.AbstractName); item.AbstractCopy(destination); progressInfo.Current++; yield return progressInfo; } foreach (var item in DirectoriesList) { var createdFolder = nodeElement.AbstractCreateFolder(item.AbstractName); foreach (var innerItem in item.AbstractCopy(createdFolder)) { yield return innerItem; } progressInfo.Current++; yield return progressInfo; } }
public override void AbstractReplace(AbstractFolder inDirectory) { if (inDirectory is Folder) System.IO.File.Move(AbstractPath, Path.Combine(inDirectory.AbstractPath, AbstractName)); else { var abstractFile = inDirectory.AbstractCreateFile(AbstractName); AbstractCopy(abstractFile); AbstractRemove(); } }