public static RunCmd ( string dir, string cmd, string args, Action |
||
dir | string | |
cmd | string | |
args | string | |
output | Action |
|
error | Action |
|
input | string | |
cancel | CancellationToken | |
Résultat | int |
private void CallPatch(string patchFile, string srcFile) { var output = new StringBuilder(); var error = new StringBuilder(); var log = new StringBuilder(); Program.RunCmd(Program.toolsDir, Path.Combine(Program.toolsDir, "applydiff.exe"), string.Format("-u -N -p0 -d {0} -i {1} {2}", Program.baseDir, patchFile, srcFile), s => { output.Append(s); log.Append(s); }, s => { error.Append(s); log.Append(s); } ); Log(log.ToString()); if (error.Length > 0) { throw new Exception(error.ToString()); } foreach (var line in output.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.None)) { if (line.StartsWith("Hunk")) { if (line.Contains("FAILED")) { failures++; } else if (line.Contains("fuzz")) { warnings++; } } } }
public override void Run() { taskInterface.SetStatus("Copying References"); var modCompile = Path.Combine(SteamDir, "ModCompile"); var references = new[] { "FNA.dll", "Microsoft.CodeAnalysis.dll", "Microsoft.CodeAnalysis.CSharp.dll", "System.Reflection.Metadata.dll", "Mono.Cecil.Pdb.dll" }; foreach (var dll in references) { Copy(Path.Combine(Program.baseDir, "references/" + dll), Path.Combine(modCompile, dll)); } Copy(Path.Combine(Program.baseDir, "RoslynWrapper/bin/Release/RoslynWrapper.dll"), Path.Combine(modCompile, "RoslynWrapper.dll")); taskInterface.SetStatus("Generating Debug Configuration"); File.WriteAllText(Path.Combine(Program.baseDir, "src/tModLoader/Terraria.csproj.user"), DebugConfig); taskInterface.SetStatus("Compiling tModLoaderMac.exe"); compileFailed = Program.RunCmd(Path.Combine(Program.baseDir, "solutions"), "msbuild", "tModLoader.sln /p:Configuration=MacRelease /p:Platform=\"x86\"", null, null, null, taskInterface.CancellationToken() ) != 0; }
private string CallDiff(string baseFile, string srcFile, string baseName, string srcName) { var output = new StringBuilder(); Program.RunCmd(Program.toolsDir, Path.Combine(Program.toolsDir, "py.exe"), $"diff.py {baseFile} {srcFile} {baseName} {srcName}", s => output.Append(s)); return(output.ToString()); }
private string CallDiff(string baseFile, string srcFile, string baseName, string srcName) { var output = new StringBuilder(); Program.RunCmd(Program.toolsDir, Path.Combine(Program.toolsDir, "py.exe"), string.Format("diff.py {0} {1} {2} {3}", baseFile, srcFile, baseName, srcName), s => output.Append(s), _ => { }); return(output.ToString()); }