зеркало из https://github.com/dotnet/msbuild.git
Move EncodingUtilities to Framework (#8620)
This will single-instance it for improved performance.
This commit is contained in:
Родитель
7dd2fa9d5a
Коммит
1241b599d3
|
@ -35,9 +35,6 @@
|
|||
<Compile Include="..\Shared\EncodingStringWriter.cs">
|
||||
<Link>EncodingStringWriter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\EncodingUtilities.cs">
|
||||
<Link>EncodingUtilities.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\UnitTests\ObjectModelHelpers.cs">
|
||||
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
|
|
|
@ -56,9 +56,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Shared\EncodingUtilities.cs">
|
||||
<Link>SharedUtilities\EncodingUtilities.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\EnvironmentUtilities.cs">
|
||||
<Link>SharedUtilities\EnvironmentUtilities.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -7,6 +7,8 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.Build.Shared
|
||||
|
@ -48,17 +50,17 @@ namespace Microsoft.Build.Shared
|
|||
|
||||
try
|
||||
{
|
||||
if (NativeMethodsShared.IsWindows)
|
||||
if (NativeMethods.IsWindows)
|
||||
{
|
||||
#if RUNTIME_TYPE_NETCORE
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
#endif
|
||||
// get the current OEM code page
|
||||
s_currentOemEncoding = Encoding.GetEncoding(NativeMethodsShared.GetOEMCP());
|
||||
s_currentOemEncoding = Encoding.GetEncoding(NativeMethods.GetOEMCP());
|
||||
}
|
||||
}
|
||||
// theoretically, GetEncoding may throw an ArgumentException or a NotSupportedException. This should never
|
||||
// really happen, since the code page we pass in has just been returned from the "underlying platform",
|
||||
// really happen, since the code page we pass in has just been returned from the "underlying platform",
|
||||
// so it really should support it. If it ever happens, we'll just fall back to the default encoding.
|
||||
// No point in showing any errors to the users, since they most likely wouldn't be actionable.
|
||||
catch (ArgumentException ex)
|
||||
|
@ -214,7 +216,7 @@ namespace Microsoft.Build.Shared
|
|||
/// </remarks>
|
||||
internal static Encoding BatchFileEncoding(string contents, string encodingSpecification)
|
||||
{
|
||||
if (!NativeMethodsShared.IsWindows)
|
||||
if (!NativeMethods.IsWindows)
|
||||
{
|
||||
return EncodingUtilities.Utf8WithoutBom;
|
||||
}
|
|
@ -150,9 +150,6 @@
|
|||
<Compile Include="..\Shared\AssemblyNameExtension.cs">
|
||||
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\EncodingUtilities.cs">
|
||||
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\ErrorUtilities.cs">
|
||||
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
|
|
|
@ -72,9 +72,6 @@
|
|||
<Compile Include="..\Shared\CopyOnWriteDictionary.cs">
|
||||
<Link>Shared\CopyOnWriteDictionary.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\EncodingUtilities.cs">
|
||||
<Link>Shared\EncodingUtilities.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\ErrorUtilities.cs">
|
||||
<Link>Shared\ErrorUtilities.cs</Link>
|
||||
</Compile>
|
||||
|
|
Загрузка…
Ссылка в новой задаче