private void CopyFiles(string sourceFolder, string destinationFolder) { var files = FilesManager.GetFiles(sourceFolder); foreach (var file in files) { var newFile = file.Replace(sourceFolder, destinationFolder); FilesManager.Copy(file, newFile); _context.ReportProgress(string.Format(_context.LocalizedMessages.BuildFileProcessed, PathsManager.GetFilename(file))); } }
private void HandleAddedFile(PatchDefinitionEntry entry) { FilesManager.Copy( PathsManager.Combine(_context.Settings.GetGameFolderPath(_context.VersionTo), entry.RelativePath), PathsManager.Combine(_context.Settings.GetPatchesTempFolderPath(), entry.RelativePath) ); var path = PathsManager.Combine(_context.Settings.GetGameFolderPath(_context.VersionTo), entry.RelativePath); var info = FilesManager.GetFileInfo(path); entry.Attributes = info.Attributes; entry.LastWriting = info.LastWriting; }
private void HandleAddedFile(UpdaterDefinitionEntry entry) { var filePath = PathsManager.Combine(_context.Settings.RootPath, entry.RelativePath); var difference = FileValidityDifference.None; var alreadyExisting = FilesManager.Exists(filePath); if (alreadyExisting && IsValid(entry, out difference)) { return; } if (difference.HasFlag(FileValidityDifference.Size)) { if (FilesManager.IsFileLocked(filePath)) { var newFilePath = FilesManager.GetTemporaryDeletingFileName(filePath); FilesManager.Rename(filePath, newFilePath); } else { FilesManager.Delete(filePath); } Downloader.Download(_context.Settings.GetRemoteUpdaterFileUrl(entry.RelativePath), PathsManager.GetDirectoryPath(filePath)); EnsureDefinition(entry); _context.SetDirtyFlag(entry.RelativePath); } else { if (!alreadyExisting) { Downloader.Download(_context.Settings.GetRemoteUpdaterFileUrl(entry.RelativePath), PathsManager.GetDirectoryPath(filePath)); } if (FilesManager.IsFileLocked(filePath)) { var newFilePath = FilesManager.GetTemporaryDeletingFileName(filePath); FilesManager.Rename(filePath, newFilePath); FilesManager.Copy(newFilePath, filePath); } EnsureDefinition(entry); } }
private void HandleChangedAttributesFile(UpdaterDefinitionEntry entry) { var filePath = PathsManager.Combine(_context.Settings.RootPath, entry.RelativePath); if (!FilesManager.Exists(filePath)) { Downloader.Download(_context.Settings.GetRemoteUpdaterFileUrl(entry.RelativePath), PathsManager.GetDirectoryPath(filePath)); } else { if (FilesManager.IsFileLocked(filePath)) { var newFilePath = FilesManager.GetTemporaryDeletingFileName(filePath); FilesManager.Rename(filePath, newFilePath); FilesManager.Copy(newFilePath, filePath); } } EnsureDefinition(entry); }