-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit warning for projects detected in multiple drives
- Loading branch information
1 parent
86a42be
commit f28434f
Showing
5 changed files
with
125 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Microsoft.VisualStudio.SlnGen.UnitTests/StringBuilderTextWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// | ||
// Licensed under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace Microsoft.VisualStudio.SlnGen.UnitTests | ||
{ | ||
/// <summary> | ||
/// Extends <see cref="TextWriter" /> for unit tests to capture writing text. | ||
/// </summary> | ||
public class StringBuilderTextWriter : TextWriter | ||
{ | ||
private readonly List<string> _lines; | ||
private readonly StringBuilder _lineStringBuilder = new StringBuilder(); | ||
private readonly StringBuilder _stringBuilder; | ||
|
||
public StringBuilderTextWriter(StringBuilder stringBuilder, List<string> lines) | ||
{ | ||
_stringBuilder = stringBuilder; | ||
_lines = lines; | ||
} | ||
|
||
public override Encoding Encoding => Encoding.Unicode; | ||
|
||
public override void Write(char value) | ||
{ | ||
_lineStringBuilder.Append(value); | ||
|
||
_stringBuilder.Append(value); | ||
|
||
if (value == '\n') | ||
{ | ||
_lines.Add(_lineStringBuilder.ToString()); | ||
|
||
_lineStringBuilder.Clear(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters