diff options
author | Tedd Hansen | 2007-09-15 16:45:37 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-09-15 16:45:37 +0000 |
commit | 88968622ea161e9c60db0a721b0ee2feb850300d (patch) | |
tree | fee3ab258e1a835a17693c774341f8d9a4a758f7 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler | |
parent | Bugfixed: llListRandomize (diff) | |
download | opensim-SC-88968622ea161e9c60db0a721b0ee2feb850300d.zip opensim-SC-88968622ea161e9c60db0a721b0ee2feb850300d.tar.gz opensim-SC-88968622ea161e9c60db0a721b0ee2feb850300d.tar.bz2 opensim-SC-88968622ea161e9c60db0a721b0ee2feb850300d.tar.xz |
Implemented: llStringToBase64, llBase64ToString, llXorBase64Strings, llXorBase64StringsCorrect, llGetTimestamp
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index f95811e..064ed4f 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -32,6 +32,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
32 | private LLUUID m_itemID; | 32 | private LLUUID m_itemID; |
33 | private bool throwErrorOnNotImplemented = true; | 33 | private bool throwErrorOnNotImplemented = true; |
34 | 34 | ||
35 | |||
35 | public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) | 36 | public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) |
36 | { | 37 | { |
37 | m_ScriptEngine = ScriptEngine; | 38 | m_ScriptEngine = ScriptEngine; |
@@ -794,9 +795,40 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
794 | } | 795 | } |
795 | 796 | ||
796 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } | 797 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } |
797 | public string llStringToBase64(string str) { NotImplemented("llStringToBase64"); return ""; } | 798 | public string llStringToBase64(string str) { |
798 | public string llBase64ToString(string str) { NotImplemented("llBase64ToString"); return ""; } | 799 | |
799 | public void llXorBase64Strings() { NotImplemented("llXorBase64Strings"); } | 800 | try |
801 | { | ||
802 | byte[] encData_byte = new byte[str.Length]; | ||
803 | encData_byte = System.Text.Encoding.UTF8.GetBytes(str); | ||
804 | string encodedData = Convert.ToBase64String(encData_byte); | ||
805 | return encodedData; | ||
806 | } | ||
807 | catch (Exception e) | ||
808 | { | ||
809 | throw new Exception("Error in base64Encode" + e.Message); | ||
810 | } | ||
811 | } | ||
812 | |||
813 | public string llBase64ToString(string str) { | ||
814 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); | ||
815 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); | ||
816 | try | ||
817 | { | ||
818 | |||
819 | byte[] todecode_byte = Convert.FromBase64String(str); | ||
820 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | ||
821 | char[] decoded_char = new char[charCount]; | ||
822 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); | ||
823 | string result = new String(decoded_char); | ||
824 | return result; | ||
825 | } | ||
826 | catch (Exception e) | ||
827 | { | ||
828 | throw new Exception("Error in base64Decode" + e.Message); | ||
829 | } | ||
830 | } | ||
831 | public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } | ||
800 | public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } | 832 | public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } |
801 | public double llLog10(double val) { return (double)Math.Log10(val); } | 833 | public double llLog10(double val) { return (double)Math.Log10(val); } |
802 | public double llLog(double val) { return (double)Math.Log(val); } | 834 | public double llLog(double val) { return (double)Math.Log(val); } |
@@ -822,15 +854,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
822 | return m_host.ObjectCreator.ToStringHyphenated(); | 854 | return m_host.ObjectCreator.ToStringHyphenated(); |
823 | } | 855 | } |
824 | 856 | ||
825 | public string llGetTimestamp() { NotImplemented("llGetTimestamp"); return ""; } | 857 | public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } |
826 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } | 858 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } |
827 | public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } | 859 | public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } |
828 | public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } | 860 | public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } |
829 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } | 861 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } |
830 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } | 862 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } |
831 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } | 863 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } |
832 | public string llIntegerToBase64(int number) { NotImplemented("llIntegerToBase64"); return ""; } | 864 | public string llIntegerToBase64(int number) { |
833 | public int llBase64ToInteger(string str) { NotImplemented("llBase64ToInteger"); return 0; } | 865 | NotImplemented("llIntegerToBase64"); return ""; |
866 | } | ||
867 | public int llBase64ToInteger(string str) { | ||
868 | NotImplemented("llBase64ToInteger"); return 0; | ||
869 | } | ||
834 | 870 | ||
835 | public double llGetGMTclock() | 871 | public double llGetGMTclock() |
836 | { | 872 | { |
@@ -921,7 +957,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
921 | 957 | ||
922 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } | 958 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } |
923 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } | 959 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } |
924 | public string llXorBase64StringsCorrect(string str1, string str2) { NotImplemented("llXorBase64StringsCorrect"); return ""; } | 960 | public string llXorBase64StringsCorrect(string str1, string str2) { |
961 | string ret = ""; | ||
962 | string src1 = llBase64ToString(str1); | ||
963 | string src2 = llBase64ToString(str2); | ||
964 | int c = 0; | ||
965 | for (int i = 0; i < src1.Length; i++) | ||
966 | { | ||
967 | ret += src1[i] ^ src2[c]; | ||
968 | |||
969 | c++; | ||
970 | if (c > src2.Length) | ||
971 | c = 0; | ||
972 | } | ||
973 | return llStringToBase64(ret); | ||
974 | } | ||
925 | public void llHTTPRequest() { NotImplemented("llHTTPRequest"); } | 975 | public void llHTTPRequest() { NotImplemented("llHTTPRequest"); } |
926 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } | 976 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } |
927 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } | 977 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } |