retire StringToBytes variants with string format. Do the format before calling..

This commit is contained in:
UbitUmarov 2024-02-05 18:34:44 +00:00
parent db04234685
commit f1cba63aad
3 changed files with 14 additions and 4 deletions

View File

@ -2643,12 +2643,13 @@ namespace OpenSim.Framework
/// Arguments to substitute into the string via the {} mechanism.
/// </param>
/// <returns></returns>
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes256(string str, params object[] args)
{
return Utils.StringToBytes(string.Format(str, args), 255);
}
*/
/// <summary>
/// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary.
/// </summary>
@ -2674,11 +2675,13 @@ namespace OpenSim.Framework
/// Arguments to substitute into the string via the {} mechanism.
/// </param>
/// <returns></returns>
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes1024(string str, params object[] args)
{
return Utils.StringToBytes(string.Format(str, args), 1024);
return Utils.StringToBytes(string.Format(str, args).AsSpan(), 1024);
}
*/
/// <summary>
/// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary.
@ -2705,11 +2708,13 @@ namespace OpenSim.Framework
/// Arguments to substitute into the string via the {} mechanism.
/// </param>
/// <returns></returns>
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes(string str, int MaxLength, params object[] args)
{
return StringToBytes1024(string.Format(str, args), MaxLength);
return Utils.StringToBytes(string.Format(str, args).AsSpan(), MaxLength);
}
*/
/// <summary>
/// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to MaxLength bytes if necessary.

View File

@ -3708,7 +3708,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Position = pos,
RegionID = World.RegionInfo.RegionID.Guid,
message = (message.Length > 1024) ? message[..1024] : message,
binaryBucket = Util.StringToBytes256("{0}/{1}/{2}/{3}", m_regionName, (int)pos.X, (int)pos.Y, (int)pos.Z)
binaryBucket = Util.StringToBytes256($"{m_regionName}/{(int)pos.X}/{(int)pos.Y}/{(int)pos.Z}")
};
m_TransferModule?.SendInstantMessage(msg, delegate(bool success) {});

View File

@ -459,6 +459,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_REFLECTION_PROBE = 44;
public const int PRIM_GLTF_NORMAL = 45;
public const int PRIM_GLTF_EMISSIVE = 46;
public const int PRIM_GLTF_METALLIC_ROUGHNESS = 47;
public const int PRIM_GLTF_BASE_COLOR = 48;
public const int PRIM_RENDER_MATERIAL = 49;
// parameters