break them a bit more...

This commit is contained in:
UbitUmarov
2024-02-24 15:47:06 +00:00
parent 121f270414
commit eb9afdaffc
3 changed files with 47 additions and 36 deletions

View File

@@ -6380,13 +6380,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(string.IsNullOrEmpty(secret) || string.IsNullOrEmpty(plainText))
return LSL_String.Empty;
string ret = Util.AESEncrypt(secret, plainText);
if(string.IsNullOrEmpty(ret))
ReadOnlySpan<char> ret = Util.AESEncrypt(secret.AsSpan(), plainText.AsSpan());
if(ret.Length == 0)
{
OSSLShoutError("osAESEncrypt: Failed to encrypt!");
return LSL_String.Empty;
}
return ret;
return ret.ToString();
}
public LSL_String osAESDecrypt(string secret, string encryptedText)
@@ -6394,13 +6394,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(string.IsNullOrEmpty(secret) || string.IsNullOrEmpty(encryptedText))
return LSL_String.Empty;
string ret = Util.AESDecrypt(secret, encryptedText);
if(string.IsNullOrEmpty(ret))
ReadOnlySpan<char> ret = Util.AESDecrypt(secret.AsSpan(), encryptedText.AsSpan());
if(ret.Length == 0)
{
OSSLShoutError("osAESDecrypt: Failed to Decrypt!");
return LSL_String.Empty;
}
return ret;
return ret.ToString();
}
public LSL_String osAESEncryptTo(string secret, string plainText, string ivString)
@@ -6408,13 +6408,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(string.IsNullOrEmpty(secret) || string.IsNullOrEmpty(plainText) || string.IsNullOrEmpty(ivString))
return LSL_String.Empty;
string ret = Util.AESEncryptTo(secret, plainText, ivString);
if(string.IsNullOrEmpty(ret))
ReadOnlySpan<char> ret = Util.AESEncryptTo(secret.AsSpan(), plainText.AsSpan(), ivString.AsSpan());
if (ret.Length == 0)
{
OSSLShoutError("osAESEncryptTo: Failed to encrypt!");
return LSL_String.Empty;
}
return ret;
return ret.ToString();
}
public LSL_String osAESDecryptFrom(string secret, string encryptedText, string ivString)
@@ -6422,13 +6422,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(string.IsNullOrEmpty(secret) || string.IsNullOrEmpty(encryptedText) || string.IsNullOrEmpty(ivString))
return LSL_String.Empty;
string ret = Util.AESDecryptFrom(secret, encryptedText, ivString);
if(string.IsNullOrEmpty(ret))
ReadOnlySpan<char> ret = Util.AESDecryptFrom(secret.AsSpan(), encryptedText.AsSpan(), ivString.AsSpan());
if (ret.Length == 0)
{
OSSLShoutError("osAESDecryptFrom: Failed to decrypt!");
return LSL_String.Empty;
}
return ret;
return ret.ToString();
}
}
}

View File

@@ -2256,6 +2256,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
m_string = s;
}
public LSLString(ReadOnlySpan<char> s)
{
m_string = s.ToString();
}
public LSLString(double d)
{
string s = String.Format(Culture.FormatProvider, "{0:0.000000}", d);
@@ -2301,6 +2306,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new LSLString(s);
}
static public implicit operator LSLString(ReadOnlySpan<char> s)
{
return new LSLString(s);
}
public static string ToString(LSLString s)
{
return s.m_string;
@@ -2353,10 +2363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
static public explicit operator LSLString(bool b)
{
if (b)
return new LSLString("1");
else
return new LSLString("0");
return new LSLString( b ? "1" : "0");
}
public static implicit operator Vector3(LSLString s)
@@ -2379,6 +2386,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new list(new object[] { s });
}
public static implicit operator ReadOnlySpan<char>(LSLString s)
{
return s.m_string.AsSpan();
}
#endregion
#region Overriders