Merge branch 'justincc-master'

master-beforevarregion
Justin Clark-Casey (justincc) 2013-12-14 02:33:08 +00:00
commit 38d7d46c17
1 changed files with 15 additions and 15 deletions

View File

@ -247,12 +247,18 @@ namespace OpenSim.Framework
/// <returns></returns> /// <returns></returns>
public static List<string> ParseNotecardToList(string rawInput) public static List<string> ParseNotecardToList(string rawInput)
{ {
string[] input = rawInput.Replace("\r", "").Split('\n'); string[] input;
int idx = 0; int idx = 0;
int level = 0; int level = 0;
List<string> output = new List<string>(); List<string> output = new List<string>();
string[] words; string[] words;
//The Linden format always ends with a } after the input data.
//Strip off trailing } so there is nothing after the input data.
int i = rawInput.LastIndexOf("}");
rawInput = rawInput.Remove(i, rawInput.Length-i);
input = rawInput.Replace("\r", "").Split('\n');
while (idx < input.Length) while (idx < input.Length)
{ {
if (input[idx] == "{") if (input[idx] == "{")
@ -287,24 +293,18 @@ namespace OpenSim.Framework
break; break;
if (words[0] == "Text") if (words[0] == "Text")
{ {
int len = int.Parse(words[2]); idx++; //Now points to first line of notecard text
idx++;
int count = -1; //Number of lines in notecard.
int lines = input.Length - idx;
int line = 0;
while (count < len && idx < input.Length) while (line < lines)
{ {
// int l = input[idx].Length; // m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", input[idx]);
string ln = input[idx]; output.Add(input[idx]);
int need = len-count-1;
if (ln.Length > need)
ln = ln.Substring(0, need);
// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln);
output.Add(ln);
count += ln.Length + 1;
idx++; idx++;
line++;
} }
return output; return output;