Skip to content

Commit

Permalink
Update main.csx
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas authored Aug 7, 2022
1 parent 7d62f6d commit 033f889
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions source-diff/main.csx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ static async Task DecompileFile(string filter, string binPath, string referenceP
.WithStandardErrorPipe(PipeTarget.ToStream(stdErr))
.WithValidation(CommandResultValidation.None)
.ExecuteAsync();

foreach (var csproj in Directory.GetFiles(outputPath, "*.csproj"))
{
File.Delete(csproj);
}

foreach (var cs in Directory.GetFiles(outputPath, "*.cs"))
{
var content = File.ReadAllText(cs);
var idx = content.IndexOf("namespace", StringComparison.Ordinal);
if (idx == -1) continue;
File.WriteAllText(cs, content.Substring(idx));
}
}
}
static async Task DiffDirectories(string oldSrc, string newSrc, string outputPath)
Expand All @@ -141,8 +154,12 @@ static async Task DiffDirectories(string oldSrc, string newSrc, string outputPat
.WithArguments($"-ur {oldPath} {newPath}")
.WithValidation(CommandResultValidation.None)
|
Cli.Wrap("sed")
.WithArguments(@"-e 's/a\/old\///g' -e 's/a\/new\///g' -e 's/b\/old\///g' -e 's/b\/new\///g'")
.WithValidation(CommandResultValidation.None)
|
Cli.Wrap("diff2html")
.WithArguments($"-s side -i stdin -F {Path.Combine(outputPath, $"{directoryName}.html")}")
.WithArguments($"--no-index -u --relative -M30% -i stdin -F {Path.Combine(outputPath, $"{directoryName}.html")}")
.WithValidation(CommandResultValidation.None);
await cmd.ExecuteAsync();
}
Expand All @@ -164,9 +181,13 @@ static async Task DiffDirectories(string oldSrc, string newSrc, string outputPat
.WithArguments($"-ur {oldPath} {newPath}")
.WithValidation(CommandResultValidation.None)
|
Cli.Wrap("sed")
.WithArguments(@"-e 's/a\/old\///g' -e 's/a\/new\///g' -e 's/b\/old\///g' -e 's/b\/new\///g'")
.WithValidation(CommandResultValidation.None)
|
Cli.Wrap("diff2html")
.WithArguments($"-s side -i stdin -F {Path.Combine(outputPath, $"{directoryName}.html")}")
.WithArguments($"--no-index -u --relative -M30% -i stdin -F {Path.Combine(outputPath, $"{directoryName}.html")}")
.WithValidation(CommandResultValidation.None);
await cmd.ExecuteAsync();
}
}
}

0 comments on commit 033f889

Please sign in to comment.