fix: Fixes ValueStringBuilder empty ctor issue (#1035)
This commit is contained in:
parent
fe225003c6
commit
3b7e3c2fb7
8 changed files with 16 additions and 14 deletions
|
|
@ -22,9 +22,11 @@ public ref struct ValueStringBuilder
|
|||
get => _mt ? ArrayPool<char>.Shared : STArrayPool<char>.Shared;
|
||||
}
|
||||
|
||||
public ValueStringBuilder(bool mt = false) : this(64, mt)
|
||||
{
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ValueStringBuilder Create(int capacity = 64, bool mt = false) => new(capacity, mt);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ValueStringBuilder CreateMT(int capacity = 64) => new(capacity, true);
|
||||
|
||||
// If this ctor is used, you cannot pass in stackalloc ROS for append/replace.
|
||||
public ValueStringBuilder(ReadOnlySpan<char> initialString, bool mt = false) : this(initialString.Length, mt)
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ namespace Server
|
|||
Interlocked.Increment(ref _mobileCount);
|
||||
}
|
||||
|
||||
ValueStringBuilder errors = new ValueStringBuilder(true);
|
||||
using var errors = ValueStringBuilder.CreateMT();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ namespace Server.Commands
|
|||
return $"{p.Name} = {toString}";
|
||||
}
|
||||
|
||||
using var builder = new ValueStringBuilder();
|
||||
using var builder = ValueStringBuilder.Create();
|
||||
for (var i = 0; i < chain.Length; i++)
|
||||
{
|
||||
builder.Append(chain[i].Name);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ namespace Server.Compression
|
|||
|
||||
new FileInfo(destinationArchiveFileName).EnsureDirectory();
|
||||
|
||||
using var builder = new ValueStringBuilder();
|
||||
using var builder = ValueStringBuilder.Create();
|
||||
var i = 0;
|
||||
foreach (var path in paths)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Ethics.Evil
|
|||
++enemyCount;
|
||||
}
|
||||
|
||||
using var sb = new ValueStringBuilder();
|
||||
using var sb = ValueStringBuilder.Create();
|
||||
|
||||
sb.Append("You sense ");
|
||||
sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Ethics.Hero
|
|||
++enemyCount;
|
||||
}
|
||||
|
||||
using var sb = new ValueStringBuilder();
|
||||
using var sb = ValueStringBuilder.Create();
|
||||
|
||||
sb.Append("You sense ");
|
||||
sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.Information_Perf:
|
||||
{
|
||||
using var sb = new ValueStringBuilder();
|
||||
using var sb = ValueStringBuilder.Create();
|
||||
|
||||
ThreadPool.GetAvailableThreads(out var curUser, out var curIOCP);
|
||||
ThreadPool.GetMaxThreads(out var maxUser, out var maxIOCP);
|
||||
|
|
@ -629,7 +629,7 @@ namespace Server.Gumps
|
|||
AddLabel(12, 140, LabelHue, "There are no accounts to display.");
|
||||
}
|
||||
|
||||
using var sb = new ValueStringBuilder();
|
||||
using var sb = ValueStringBuilder.Create();
|
||||
|
||||
for (int i = 0, index = listPage * 12;
|
||||
i < 12 && index >= 0 && index < sharedAccounts.Count;
|
||||
|
|
@ -1169,7 +1169,7 @@ namespace Server.Gumps
|
|||
|
||||
AddButtonLabeled(20, 150, GetButtonID(5, 4), "Add Comment");
|
||||
|
||||
var sb = new ValueStringBuilder();
|
||||
var sb = ValueStringBuilder.Create();
|
||||
|
||||
if (a.Comments.Count == 0)
|
||||
{
|
||||
|
|
@ -1208,7 +1208,7 @@ namespace Server.Gumps
|
|||
|
||||
AddButtonLabeled(20, 150, GetButtonID(5, 5), "Add Tag");
|
||||
|
||||
var sb = new ValueStringBuilder();
|
||||
var sb = ValueStringBuilder.Create();
|
||||
|
||||
if (a.Tags.Count == 0)
|
||||
{
|
||||
|
|
@ -3054,7 +3054,7 @@ namespace Server.Gumps
|
|||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
using var sb = new ValueStringBuilder();
|
||||
using var sb = ValueStringBuilder.Create();
|
||||
sb.Append("You are about to ban ");
|
||||
sb.Append(list.Count);
|
||||
sb.Append(list.Count != 1 ? "accounts." : "account.");
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Server.Misc
|
|||
|
||||
private static void EventSink_ClientVersionReceived(NetState state, ClientVersion version)
|
||||
{
|
||||
using var message = new ValueStringBuilder();
|
||||
using var message = ValueStringBuilder.Create();
|
||||
|
||||
if (!_enable || state.Mobile?.AccessLevel != AccessLevel.Player)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue