aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-03-04 20:08:25 +0000
committerJustin Clark-Casey (justincc)2010-03-04 20:08:25 +0000
commite07548d703798bfd661c1ab89cc3b48c936d0a77 (patch)
tree90f23640fda71f2b74a181df9cadf56cdabc4b41 /OpenSim/Region/ScriptEngine/Shared/Api
parentcompiler warnings revealed that public PlaySoundSlavePrims properties were ch... (diff)
downloadopensim-SC_OLD-e07548d703798bfd661c1ab89cc3b48c936d0a77.zip
opensim-SC_OLD-e07548d703798bfd661c1ab89cc3b48c936d0a77.tar.gz
opensim-SC_OLD-e07548d703798bfd661c1ab89cc3b48c936d0a77.tar.bz2
opensim-SC_OLD-e07548d703798bfd661c1ab89cc3b48c936d0a77.tar.xz
move linden notecard parsing from LSL_Api.cs to SLUtil so that region modules can use it
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs83
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 dc4249c..974f91b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9705,90 +9705,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9705 9705
9706 Notecard nc = new Notecard(); 9706 Notecard nc = new Notecard();
9707 nc.lastRef = DateTime.Now; 9707 nc.lastRef = DateTime.Now;
9708 nc.text = ParseText(text.Replace("\r", "").Split('\n')); 9708 nc.text = SLUtil.ParseNotecardToList(text).ToArray();
9709 m_Notecards[assetID] = nc; 9709 m_Notecards[assetID] = nc;
9710 } 9710 }
9711 } 9711 }
9712 9712
9713 protected static string[] ParseText(string[] input)
9714 {
9715 int idx = 0;
9716 int level = 0;
9717 List<string> output = new List<string>();
9718 string[] words;
9719
9720 while (idx < input.Length)
9721 {
9722 if (input[idx] == "{")
9723 {
9724 level++;
9725 idx++;
9726 continue;
9727 }
9728
9729 if (input[idx]== "}")
9730 {
9731 level--;
9732 idx++;
9733 continue;
9734 }
9735
9736 switch (level)
9737 {
9738 case 0:
9739 words = input[idx].Split(' '); // Linden text ver
9740 // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
9741 if (words.Length < 3)
9742 return new String[0];
9743
9744 int version = int.Parse(words[3]);
9745 if (version != 2)
9746 return new String[0];
9747 break;
9748 case 1:
9749 words = input[idx].Split(' ');
9750 if (words[0] == "LLEmbeddedItems")
9751 break;
9752 if (words[0] == "Text")
9753 {
9754 int len = int.Parse(words[2]);
9755 idx++;
9756
9757 int count = -1;
9758
9759 while (count < len)
9760 {
9761 // int l = input[idx].Length;
9762 string ln = input[idx];
9763
9764 int need = len-count-1;
9765 if (ln.Length > need)
9766 ln = ln.Substring(0, need);
9767
9768 output.Add(ln);
9769 count += ln.Length + 1;
9770 idx++;
9771 }
9772
9773 return output.ToArray();
9774 }
9775 break;
9776 case 2:
9777 words = input[idx].Split(' '); // count
9778 if (words[0] == "count")
9779 {
9780 int c = int.Parse(words[1]);
9781 if (c > 0)
9782 return new String[0];
9783 break;
9784 }
9785 break;
9786 }
9787 idx++;
9788 }
9789 return output.ToArray();
9790 }
9791
9792 public static bool IsCached(UUID assetID) 9713 public static bool IsCached(UUID assetID)
9793 { 9714 {
9794 lock (m_Notecards) 9715 lock (m_Notecards)
@@ -9844,4 +9765,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9844 } 9765 }
9845 } 9766 }
9846 } 9767 }
9847} 9768} \ No newline at end of file