未验证 提交 d344e72a 编写于 作者: A Adeel Mujahid 提交者: GitHub

Use u8 string in CultureNames (#71417)

* Use u8 in CultureNames

* Update compiler version for u8 bug fix

* Update compiler toolset to 4.4.0-1.22358.14
Co-authored-by: NStephen Toub <stoub@microsoft.com>
上级 58f75168
......@@ -49,7 +49,7 @@
<!--
TODO: Remove pinned version once arcade supplies a compiler that enables the repo to compile.
-->
<MicrosoftNetCompilersToolsetVersion>4.4.0-1.22356.12</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>4.4.0-1.22358.14</MicrosoftNetCompilersToolsetVersion>
<!-- SDK dependencies -->
<MicrosoftDotNetCompatibilityVersion>2.0.0-preview.4.22252.4</MicrosoftDotNetCompatibilityVersion>
<!-- Arcade dependencies -->
......
......@@ -1226,12 +1226,10 @@ static void GenerateData(string[] cultures, (string lcid, string culture)[] lcid
continue;
}
Console.WriteLine("private static ReadOnlySpan<byte> CultureNames => new byte[]");
Console.WriteLine("{");
Console.WriteLine("private static ReadOnlySpan<byte> CultureNames =>");
var indexes = new List<(int position, int length, string cultureName)>();
int pos = 0;
var isFirst = true;
for (int i = 0; i < list.Count; ++i)
{
var row = list[i];
......@@ -1242,23 +1240,10 @@ static void GenerateData(string[] cultures, (string lcid, string culture)[] lcid
indexes.Add((pos, value.Length, value));
}
foreach (var ch in row.culture)
{
if (isFirst)
{
isFirst = false;
Console.Write(" ");
}
Console.Write($"(byte)'{ch}', ");
}
Console.WriteLine($" // {string.Join(", ", row.cultures)}");
isFirst = true;
Console.WriteLine($@" ""{row.culture}""u8{(i == list.Count - 1 ? ';' : " +")} // {string.Join(", ", row.cultures)}");
pos += row.culture.Length;
}
Console.WriteLine("};");
Console.WriteLine();
Console.WriteLine($"private const int CulturesCount = {indexes.Count};");
Console.WriteLine();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册