private static void MakeCopiesOfAssemblies(IFolder publishFolder, IFileSystemService fileSystemService) { DeleteUnusedFileCopies(publishFolder, fileSystemService); var files = fileSystemService.ListFilesInDirectory(publishFolder, "*.dll", SearchOption.AllDirectories).ToList(); files.AddRange(fileSystemService.ListFilesInDirectory(publishFolder, "*.exe", SearchOption.AllDirectories).ToList()); foreach (var fileName in files.Where(f => !f.Contains(@"\%"))) { var i = 0; string freshNameOne, freshNameTwo; do { freshNameOne = RenamedFile(fileName, i); freshNameTwo = RenamedFile(fileName, i + 1); i += 1; } while (files.Contains(freshNameOne) || files.Contains(freshNameTwo)); fileSystemService.CopyFile(fileName, freshNameTwo); fileSystemService.MoveFile(fileName, freshNameOne); fileSystemService.MoveFile(freshNameTwo, fileName); } DeleteUnusedFileCopies(publishFolder, fileSystemService); }
public bool StartProcess(string executable, string gameFolder, ServerInformation args) { if (string.IsNullOrWhiteSpace(executable)) { throw new ArgumentNullException(nameof(executable)); } if (args == null) { throw new ArgumentNullException(nameof(args)); } var destination = _fileSystemService.GetFullPath(gameFolder, "mods", "modlist.txt"); _fileSystemService.CopyFile(args.ModList, destination); using var proc = new Process { StartInfo = new ProcessStartInfo { FileName = executable, Arguments = args.ToArgs(), CreateNoWindow = true, UseShellExecute = false } }; return(proc.Start()); }
private BuildRunResults optimisticBuild(string[] changedProjects, RunInfo[] projectList, RunReport runReport) { var projectWithIssues = new List <string>(); projectWithIssues.AddRange(_runCache .Errors .GroupBy(x => x.Key) .Select(x => x.Key)); var builtProjects = new List <RunInfo>(); var indirectlyBuilt = new List <string>(); foreach (var file in projectList) { if (changedProjects.Contains(file.Project.Key) || projectWithIssues.Contains(file.Project.Key)) { Debug.WriteDebug("Optimistic build for project {0}", file.Project.Key); var original = file.Assembly + ".original" + Path.GetExtension(file.Assembly); _fs.CopyFile(file.Assembly, original); var report = build(file, runReport); var optimisticAdviced = _buildConfig.OptimisticBuildStrategy(file.Assembly, original); _fs.DeleteFile(original); if (!optimisticAdviced) { throw new Exception("Optimistic build is not adviced for this scenario"); } if (report != null) { return(report); } builtProjects.Add(file); } else { Debug.WriteDebug("Not set to optimisticly build project {0}", file.Project.Key); indirectlyBuilt.Add(file.Project.Key); } } builtProjects.ForEach(x => copyAssembly(x.Project.Key, x.Assembly)); foreach (var project in indirectlyBuilt) { runReport.AddBuild(project, new TimeSpan(0), true); } return(null); }
public async Task SaveLocalFile() { using (_busyProvider.DoWork()) { await _fileSystemService.CopyFile(Url, _path); IsClosed = true; _imageSelectionViewModel.IsClosed = true; } }
public async void CopyFile(string source, string destination) { _filesystem.CopyFile(source, destination); await _hub.Clients.All.SendAsync("CopyDirectoryCompleted"); }