diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 83 |
1 files changed, 2 insertions, 81 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8c7cc34..ec7fde0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10160,90 +10160,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10160 | 10160 | ||
10161 | Notecard nc = new Notecard(); | 10161 | Notecard nc = new Notecard(); |
10162 | nc.lastRef = DateTime.Now; | 10162 | nc.lastRef = DateTime.Now; |
10163 | nc.text = ParseText(text.Replace("\r", "").Split('\n')); | 10163 | nc.text = SLUtil.ParseNotecardToList(text).ToArray(); |
10164 | m_Notecards[assetID] = nc; | 10164 | m_Notecards[assetID] = nc; |
10165 | } | 10165 | } |
10166 | } | 10166 | } |
10167 | 10167 | ||
10168 | protected static string[] ParseText(string[] input) | ||
10169 | { | ||
10170 | int idx = 0; | ||
10171 | int level = 0; | ||
10172 | List<string> output = new List<string>(); | ||
10173 | string[] words; | ||
10174 | |||
10175 | while (idx < input.Length) | ||
10176 | { | ||
10177 | if (input[idx] == "{") | ||
10178 | { | ||
10179 | level++; | ||
10180 | idx++; | ||
10181 | continue; | ||
10182 | } | ||
10183 | |||
10184 | if (input[idx]== "}") | ||
10185 | { | ||
10186 | level--; | ||
10187 | idx++; | ||
10188 | continue; | ||
10189 | } | ||
10190 | |||
10191 | switch (level) | ||
10192 | { | ||
10193 | case 0: | ||
10194 | words = input[idx].Split(' '); // Linden text ver | ||
10195 | // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard) | ||
10196 | if (words.Length < 3) | ||
10197 | return new String[0]; | ||
10198 | |||
10199 | int version = int.Parse(words[3]); | ||
10200 | if (version != 2) | ||
10201 | return new String[0]; | ||
10202 | break; | ||
10203 | case 1: | ||
10204 | words = input[idx].Split(' '); | ||
10205 | if (words[0] == "LLEmbeddedItems") | ||
10206 | break; | ||
10207 | if (words[0] == "Text") | ||
10208 | { | ||
10209 | int len = int.Parse(words[2]); | ||
10210 | idx++; | ||
10211 | |||
10212 | int count = -1; | ||
10213 | |||
10214 | while (count < len) | ||
10215 | { | ||
10216 | // int l = input[idx].Length; | ||
10217 | string ln = input[idx]; | ||
10218 | |||
10219 | int need = len-count-1; | ||
10220 | if (ln.Length > need) | ||
10221 | ln = ln.Substring(0, need); | ||
10222 | |||
10223 | output.Add(ln); | ||
10224 | count += ln.Length + 1; | ||
10225 | idx++; | ||
10226 | } | ||
10227 | |||
10228 | return output.ToArray(); | ||
10229 | } | ||
10230 | break; | ||
10231 | case 2: | ||
10232 | words = input[idx].Split(' '); // count | ||
10233 | if (words[0] == "count") | ||
10234 | { | ||
10235 | int c = int.Parse(words[1]); | ||
10236 | if (c > 0) | ||
10237 | return new String[0]; | ||
10238 | break; | ||
10239 | } | ||
10240 | break; | ||
10241 | } | ||
10242 | idx++; | ||
10243 | } | ||
10244 | return output.ToArray(); | ||
10245 | } | ||
10246 | |||
10247 | public static bool IsCached(UUID assetID) | 10168 | public static bool IsCached(UUID assetID) |
10248 | { | 10169 | { |
10249 | lock (m_Notecards) | 10170 | lock (m_Notecards) |
@@ -10299,4 +10220,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10299 | } | 10220 | } |
10300 | } | 10221 | } |
10301 | } | 10222 | } |
10302 | } | 10223 | } \ No newline at end of file |