* Refactored out and de-duplicated Base64ToString(string)

* Fixed minor typo
This commit is contained in:
lbsa71
2009-03-31 05:51:28 +00:00
parent 20e1a8d7f6
commit fb9a358b79
4 changed files with 27 additions and 25 deletions

View File

@@ -6824,16 +6824,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llBase64ToString(string str)
{
m_host.AddScriptLPS(1);
UTF8Encoding encoder = new UTF8Encoding();
Decoder utf8Decode = encoder.GetDecoder();
try
{
byte[] todecode_byte = Convert.FromBase64String(str);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
string result = new String(decoded_char);
return result;
return Util.Base64ToString(str);
}
catch (Exception e)
{
@@ -6841,6 +6834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public LSL_String llXorBase64Strings(string str1, string str2)
{
m_host.AddScriptLPS(1);