Browse Source

breaking: Change WriteSolutionFile to take a List<>

pull/3502/head
Peter Crabtree 2 weeks ago
parent
commit
7e1349583f
  1. 10
      ICSharpCode.Decompiler/Solution/SolutionCreator.cs
  2. 4
      ILSpy/SolutionWriter.cs

10
ICSharpCode.Decompiler/Solution/SolutionCreator.cs

@ -41,7 +41,7 @@ namespace ICSharpCode.Decompiler.Solution @@ -41,7 +41,7 @@ namespace ICSharpCode.Decompiler.Solution
/// <exception cref="ArgumentException">Thrown when <paramref name="targetFile"/> is null or empty.</exception>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="projects"/> is null.</exception>
/// <exception cref="InvalidOperationException">Thrown when <paramref name="projects"/> contains no items.</exception>
public static void WriteSolutionFile(string targetFile, IEnumerable<ProjectItem> projects)
public static void WriteSolutionFile(string targetFile, List<ProjectItem> projects)
{
if (string.IsNullOrWhiteSpace(targetFile))
{
@ -53,19 +53,17 @@ namespace ICSharpCode.Decompiler.Solution @@ -53,19 +53,17 @@ namespace ICSharpCode.Decompiler.Solution
throw new ArgumentNullException(nameof(projects));
}
var projectList = projects.ToList();
if (!projectList.Any())
if (!projects.Any())
{
throw new InvalidOperationException("At least one project is expected.");
}
using (var writer = new StreamWriter(targetFile))
{
WriteSolutionFile(writer, projectList, targetFile);
WriteSolutionFile(writer, projects, targetFile);
}
FixProjectReferences(projectList);
FixProjectReferences(projects);
}
static void WriteSolutionFile(TextWriter writer, List<ProjectItem> projects, string solutionFilePath)

4
ILSpy/SolutionWriter.cs

@ -153,8 +153,8 @@ namespace ICSharpCode.ILSpy @@ -153,8 +153,8 @@ namespace ICSharpCode.ILSpy
}
else
{
await Task.Run(() => SolutionCreator.WriteSolutionFile(solutionFilePath, projects))
.ConfigureAwait(false);
await Task.Run(() => SolutionCreator.WriteSolutionFile(solutionFilePath, projects.ToList()))
.ConfigureAwait(false);
}
}
catch (AggregateException ae)

Loading…
Cancel
Save