1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-10 05:15:42 +00:00

Call ZString.CreateUtf8StringBuilder

Don't instantiate directly, let ZString handle it
This commit is contained in:
Oliver Booth 2022-11-30 19:58:02 +00:00
parent 99bda9d53f
commit 554d326819
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
12 changed files with 16 additions and 16 deletions

View File

@ -270,8 +270,8 @@ public sealed class VirtualParadiseParticleEmitterObject : VirtualParadiseObject
Span<char> text = stackalloc char[data.Length]; Span<char> text = stackalloc char[data.Length];
Encoding.UTF8.GetChars(data, text); Encoding.UTF8.GetChars(data, text);
using var keyBuffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder keyBuffer = ZString.CreateUtf8StringBuilder();
using var valueBuffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder valueBuffer = ZString.CreateUtf8StringBuilder();
var isKey = true; var isKey = true;
for (var index = 0; index < text.Length; index++) for (var index = 0; index < text.Length; index++)

View File

@ -45,7 +45,7 @@ public sealed class VirtualParadisePathObject : VirtualParadiseObject
Span<char> chars = stackalloc char[data.Length]; Span<char> chars = stackalloc char[data.Length];
Encoding.UTF8.GetChars(data, chars); Encoding.UTF8.GetChars(data, chars);
using var buffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder buffer = ZString.CreateUtf8StringBuilder();
int index; int index;
// version // version

View File

@ -62,7 +62,7 @@ internal static class SpanExtensions
float y = 0; float y = 0;
byte spaceCount = 0; byte spaceCount = 0;
using var buffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder buffer = ZString.CreateUtf8StringBuilder();
for (var index = 0; index < value.Length; index++) for (var index = 0; index < value.Length; index++)
{ {
char current = value[index]; char current = value[index];
@ -107,7 +107,7 @@ internal static class SpanExtensions
float z = 0; float z = 0;
byte spaceCount = 0; byte spaceCount = 0;
using var buffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder buffer = ZString.CreateUtf8StringBuilder();
for (var index = 0; index < value.Length; index++) for (var index = 0; index < value.Length; index++)
{ {
char current = value[index]; char current = value[index];
@ -155,7 +155,7 @@ internal static class SpanExtensions
double z = 0; double z = 0;
byte spaceCount = 0; byte spaceCount = 0;
using var buffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder buffer = ZString.CreateUtf8StringBuilder();
for (var index = 0; index < value.Length; index++) for (var index = 0; index < value.Length; index++)
{ {
char current = value[index]; char current = value[index];
@ -204,7 +204,7 @@ internal static class SpanExtensions
float w = 0; float w = 0;
byte spaceCount = 0; byte spaceCount = 0;
using var buffer = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder buffer = ZString.CreateUtf8StringBuilder();
for (var index = 0; index < value.Length; index++) for (var index = 0; index < value.Length; index++)
{ {
char current = value[index]; char current = value[index];

View File

@ -10,7 +10,7 @@ internal sealed class IntToBoolConverter : ValueConverter<bool>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out bool result) public override void Deserialize(TextReader reader, out bool result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
int read; int read;
while ((read = reader.Read()) != -1) while ((read = reader.Read()) != -1)
{ {

View File

@ -10,7 +10,7 @@ internal sealed class MillisecondToTimeSpanConverter : ValueConverter<TimeSpan>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out TimeSpan result) public override void Deserialize(TextReader reader, out TimeSpan result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
int read; int read;
while ((read = reader.Read()) != -1) while ((read = reader.Read()) != -1)
{ {

View File

@ -11,7 +11,7 @@ internal sealed class Vector2Converter : ValueConverter<Vector2>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out Vector2 result) public override void Deserialize(TextReader reader, out Vector2 result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)

View File

@ -11,7 +11,7 @@ internal sealed class Vector3Converter : ValueConverter<Vector3>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out Vector3 result) public override void Deserialize(TextReader reader, out Vector3 result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)

View File

@ -10,7 +10,7 @@ internal sealed class Vector3ToColorConverter : ValueConverter<ColorF>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out ColorF result) public override void Deserialize(TextReader reader, out ColorF result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)

View File

@ -10,7 +10,7 @@ internal sealed class Vector3dConverter : ValueConverter<Vector3d>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out Vector3d result) public override void Deserialize(TextReader reader, out Vector3d result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)

View File

@ -10,7 +10,7 @@ internal sealed class Vector4ToColorConverter : ValueConverter<ColorF>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out ColorF result) public override void Deserialize(TextReader reader, out ColorF result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)

View File

@ -11,7 +11,7 @@ internal sealed class Vector4ToVector3Converter : ValueConverter<Vector3>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out Vector3 result) public override void Deserialize(TextReader reader, out Vector3 result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)

View File

@ -18,7 +18,7 @@ internal sealed class VectorToNthComponentConverter : ValueConverter<float>
/// <inheritdoc /> /// <inheritdoc />
public override void Deserialize(TextReader reader, out float result) public override void Deserialize(TextReader reader, out float result)
{ {
using var builder = new Utf8ValueStringBuilder(false); using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
var spaceCount = 0; var spaceCount = 0;
while (true) while (true)