diff options
author | Justin Clark-Casey (justincc) | 2011-09-23 22:36:20 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-23 22:36:20 +0100 |
commit | 8c4dd6b3302a142c6ac7578cc5012049c51610ed (patch) | |
tree | 75540bc841ed9588479c64d2cffd116130afd928 /OpenSim/Framework | |
parent | Use a copy of the inventory items list to register users in the thread starte... (diff) | |
parent | remove unused SOP.Create() method (diff) | |
download | opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.zip opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.tar.gz opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.tar.bz2 opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.tar.xz |
Merge branch 'master' into 0.7.2-post-fixes
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 93 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Console/LocalConsole.cs | 180 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 42 |
6 files changed, 192 insertions, 127 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index e8c85c9..d2c6c57 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -167,6 +167,7 @@ namespace OpenSim.Framework | |||
167 | get { return m_metadata.FullID; } | 167 | get { return m_metadata.FullID; } |
168 | set { m_metadata.FullID = value; } | 168 | set { m_metadata.FullID = value; } |
169 | } | 169 | } |
170 | |||
170 | /// <summary> | 171 | /// <summary> |
171 | /// Asset MetaData ID (transferring from UUID to string ID) | 172 | /// Asset MetaData ID (transferring from UUID to string ID) |
172 | /// </summary> | 173 | /// </summary> |
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index cce44b0..72b580b 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -225,6 +225,8 @@ namespace OpenSim.Framework | |||
225 | /// </summary> | 225 | /// </summary> |
226 | public virtual void ResetAppearance() | 226 | public virtual void ResetAppearance() |
227 | { | 227 | { |
228 | // m_log.WarnFormat("[AVATAR APPEARANCE]: Reset appearance"); | ||
229 | |||
228 | m_serial = 0; | 230 | m_serial = 0; |
229 | 231 | ||
230 | SetDefaultTexture(); | 232 | SetDefaultTexture(); |
@@ -391,10 +393,14 @@ namespace OpenSim.Framework | |||
391 | public List<AvatarAttachment> GetAttachments() | 393 | public List<AvatarAttachment> GetAttachments() |
392 | { | 394 | { |
393 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | 395 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); |
394 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 396 | |
397 | lock (m_attachments) | ||
395 | { | 398 | { |
396 | foreach (AvatarAttachment attach in kvp.Value) | 399 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
397 | alist.Add(new AvatarAttachment(attach)); | 400 | { |
401 | foreach (AvatarAttachment attach in kvp.Value) | ||
402 | alist.Add(new AvatarAttachment(attach)); | ||
403 | } | ||
398 | } | 404 | } |
399 | 405 | ||
400 | return alist; | 406 | return alist; |
@@ -406,10 +412,13 @@ namespace OpenSim.Framework | |||
406 | // "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}", | 412 | // "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}", |
407 | // attach.ItemID, attach.AssetID, attach.AttachPoint); | 413 | // attach.ItemID, attach.AssetID, attach.AttachPoint); |
408 | 414 | ||
409 | if (!m_attachments.ContainsKey(attach.AttachPoint)) | 415 | lock (m_attachments) |
410 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); | 416 | { |
411 | 417 | if (!m_attachments.ContainsKey(attach.AttachPoint)) | |
412 | m_attachments[attach.AttachPoint].Add(attach); | 418 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); |
419 | |||
420 | m_attachments[attach.AttachPoint].Add(attach); | ||
421 | } | ||
413 | } | 422 | } |
414 | 423 | ||
415 | internal void ReplaceAttachment(AvatarAttachment attach) | 424 | internal void ReplaceAttachment(AvatarAttachment attach) |
@@ -418,8 +427,11 @@ namespace OpenSim.Framework | |||
418 | // "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}", | 427 | // "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}", |
419 | // attach.ItemID, attach.AssetID, attach.AttachPoint); | 428 | // attach.ItemID, attach.AssetID, attach.AttachPoint); |
420 | 429 | ||
421 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); | 430 | lock (m_attachments) |
422 | m_attachments[attach.AttachPoint].Add(attach); | 431 | { |
432 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); | ||
433 | m_attachments[attach.AttachPoint].Add(attach); | ||
434 | } | ||
423 | } | 435 | } |
424 | 436 | ||
425 | /// <summary> | 437 | /// <summary> |
@@ -448,10 +460,13 @@ namespace OpenSim.Framework | |||
448 | 460 | ||
449 | if (item == UUID.Zero) | 461 | if (item == UUID.Zero) |
450 | { | 462 | { |
451 | if (m_attachments.ContainsKey(attachpoint)) | 463 | lock (m_attachments) |
452 | { | 464 | { |
453 | m_attachments.Remove(attachpoint); | 465 | if (m_attachments.ContainsKey(attachpoint)) |
454 | return true; | 466 | { |
467 | m_attachments.Remove(attachpoint); | ||
468 | return true; | ||
469 | } | ||
455 | } | 470 | } |
456 | 471 | ||
457 | return false; | 472 | return false; |
@@ -494,11 +509,14 @@ namespace OpenSim.Framework | |||
494 | /// <returns>Returns null if this item is not attached.</returns> | 509 | /// <returns>Returns null if this item is not attached.</returns> |
495 | public AvatarAttachment GetAttachmentForItem(UUID itemID) | 510 | public AvatarAttachment GetAttachmentForItem(UUID itemID) |
496 | { | 511 | { |
497 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 512 | lock (m_attachments) |
498 | { | 513 | { |
499 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); | 514 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
500 | if (index >= 0) | 515 | { |
501 | return kvp.Value[index]; | 516 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); |
517 | if (index >= 0) | ||
518 | return kvp.Value[index]; | ||
519 | } | ||
502 | } | 520 | } |
503 | 521 | ||
504 | return null; | 522 | return null; |
@@ -506,11 +524,14 @@ namespace OpenSim.Framework | |||
506 | 524 | ||
507 | public int GetAttachpoint(UUID itemID) | 525 | public int GetAttachpoint(UUID itemID) |
508 | { | 526 | { |
509 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 527 | lock (m_attachments) |
510 | { | 528 | { |
511 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); | 529 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
512 | if (index >= 0) | 530 | { |
513 | return kvp.Key; | 531 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); |
532 | if (index >= 0) | ||
533 | return kvp.Key; | ||
534 | } | ||
514 | } | 535 | } |
515 | 536 | ||
516 | return 0; | 537 | return 0; |
@@ -518,27 +539,32 @@ namespace OpenSim.Framework | |||
518 | 539 | ||
519 | public bool DetachAttachment(UUID itemID) | 540 | public bool DetachAttachment(UUID itemID) |
520 | { | 541 | { |
521 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 542 | lock (m_attachments) |
522 | { | 543 | { |
523 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); | 544 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
524 | if (index >= 0) | ||
525 | { | 545 | { |
526 | // Remove it from the list of attachments at that attach point | 546 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); |
527 | m_attachments[kvp.Key].RemoveAt(index); | 547 | if (index >= 0) |
528 | 548 | { | |
529 | // And remove the list if there are no more attachments here | 549 | // Remove it from the list of attachments at that attach point |
530 | if (m_attachments[kvp.Key].Count == 0) | 550 | m_attachments[kvp.Key].RemoveAt(index); |
531 | m_attachments.Remove(kvp.Key); | 551 | |
532 | 552 | // And remove the list if there are no more attachments here | |
533 | return true; | 553 | if (m_attachments[kvp.Key].Count == 0) |
554 | m_attachments.Remove(kvp.Key); | ||
555 | |||
556 | return true; | ||
557 | } | ||
534 | } | 558 | } |
535 | } | 559 | } |
560 | |||
536 | return false; | 561 | return false; |
537 | } | 562 | } |
538 | 563 | ||
539 | public void ClearAttachments() | 564 | public void ClearAttachments() |
540 | { | 565 | { |
541 | m_attachments.Clear(); | 566 | lock (m_attachments) |
567 | m_attachments.Clear(); | ||
542 | } | 568 | } |
543 | 569 | ||
544 | #region Packing Functions | 570 | #region Packing Functions |
@@ -576,7 +602,8 @@ namespace OpenSim.Framework | |||
576 | data["visualparams"] = visualparams; | 602 | data["visualparams"] = visualparams; |
577 | 603 | ||
578 | // Attachments | 604 | // Attachments |
579 | OSDArray attachs = new OSDArray(m_attachments.Count); | 605 | List<AvatarAttachment> attachments = GetAttachments(); |
606 | OSDArray attachs = new OSDArray(attachments.Count); | ||
580 | foreach (AvatarAttachment attach in GetAttachments()) | 607 | foreach (AvatarAttachment attach in GetAttachments()) |
581 | attachs.Add(attach.Pack()); | 608 | attachs.Add(attach.Pack()); |
582 | data["attachments"] = attachs; | 609 | data["attachments"] = attachs; |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 53ec166..5a4811e 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -441,7 +441,6 @@ namespace OpenSim.Framework | |||
441 | args["controllers"] = controls; | 441 | args["controllers"] = controls; |
442 | } | 442 | } |
443 | 443 | ||
444 | |||
445 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) | 444 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) |
446 | args["callback_uri"] = OSD.FromString(CallbackURI); | 445 | args["callback_uri"] = OSD.FromString(CallbackURI); |
447 | 446 | ||
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index eda41b8..7c8626d 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs | |||
@@ -46,12 +46,11 @@ namespace OpenSim.Framework.Console | |||
46 | // private readonly object m_syncRoot = new object(); | 46 | // private readonly object m_syncRoot = new object(); |
47 | private const string LOGLEVEL_NONE = "(none)"; | 47 | private const string LOGLEVEL_NONE = "(none)"; |
48 | 48 | ||
49 | private int y = -1; | 49 | private int m_cursorYPosition = -1; |
50 | private int cp = 0; | 50 | private int m_cursorXPosition = 0; |
51 | private int h = 1; | 51 | private StringBuilder m_commandLine = new StringBuilder(); |
52 | private StringBuilder cmdline = new StringBuilder(); | 52 | private bool m_echo = true; |
53 | private bool echo = true; | 53 | private List<string> m_history = new List<string>(); |
54 | private List<string> history = new List<string>(); | ||
55 | 54 | ||
56 | private static readonly ConsoleColor[] Colors = { | 55 | private static readonly ConsoleColor[] Colors = { |
57 | // the dark colors don't seem to be visible on some black background terminals like putty :( | 56 | // the dark colors don't seem to be visible on some black background terminals like putty :( |
@@ -81,10 +80,10 @@ namespace OpenSim.Framework.Console | |||
81 | 80 | ||
82 | private void AddToHistory(string text) | 81 | private void AddToHistory(string text) |
83 | { | 82 | { |
84 | while (history.Count >= 100) | 83 | while (m_history.Count >= 100) |
85 | history.RemoveAt(0); | 84 | m_history.RemoveAt(0); |
86 | 85 | ||
87 | history.Add(text); | 86 | m_history.Add(text); |
88 | } | 87 | } |
89 | 88 | ||
90 | /// <summary> | 89 | /// <summary> |
@@ -111,11 +110,11 @@ namespace OpenSim.Framework.Console | |||
111 | } | 110 | } |
112 | else | 111 | else |
113 | { | 112 | { |
114 | int bw = System.Console.BufferWidth; | 113 | int bufferWidth = System.Console.BufferWidth; |
115 | 114 | ||
116 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) | 115 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) |
117 | if (bw > 0 && left >= bw) | 116 | if (bufferWidth > 0 && left >= bufferWidth) |
118 | System.Console.CursorLeft = bw - 1; | 117 | System.Console.CursorLeft = bufferWidth - 1; |
119 | } | 118 | } |
120 | 119 | ||
121 | if (top < 0) | 120 | if (top < 0) |
@@ -124,11 +123,11 @@ namespace OpenSim.Framework.Console | |||
124 | } | 123 | } |
125 | else | 124 | else |
126 | { | 125 | { |
127 | int bh = System.Console.BufferHeight; | 126 | int bufferHeight = System.Console.BufferHeight; |
128 | 127 | ||
129 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) | 128 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) |
130 | if (bh > 0 && top >= bh) | 129 | if (bufferHeight > 0 && top >= bufferHeight) |
131 | top = bh - 1; | 130 | top = bufferHeight - 1; |
132 | } | 131 | } |
133 | 132 | ||
134 | System.Console.CursorTop = top; | 133 | System.Console.CursorTop = top; |
@@ -160,10 +159,10 @@ namespace OpenSim.Framework.Console | |||
160 | } | 159 | } |
161 | else | 160 | else |
162 | { | 161 | { |
163 | int bh = System.Console.BufferHeight; | 162 | int bufferHeight = System.Console.BufferHeight; |
164 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) | 163 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) |
165 | if (bh > 0 && top >= bh) | 164 | if (bufferHeight > 0 && top >= bufferHeight) |
166 | System.Console.CursorTop = bh - 1; | 165 | System.Console.CursorTop = bufferHeight - 1; |
167 | } | 166 | } |
168 | 167 | ||
169 | if (left < 0) | 168 | if (left < 0) |
@@ -172,11 +171,11 @@ namespace OpenSim.Framework.Console | |||
172 | } | 171 | } |
173 | else | 172 | else |
174 | { | 173 | { |
175 | int bw = System.Console.BufferWidth; | 174 | int bufferWidth = System.Console.BufferWidth; |
176 | 175 | ||
177 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) | 176 | // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) |
178 | if (bw > 0 && left >= bw) | 177 | if (bufferWidth > 0 && left >= bufferWidth) |
179 | left = bw - 1; | 178 | left = bufferWidth - 1; |
180 | } | 179 | } |
181 | 180 | ||
182 | System.Console.CursorLeft = left; | 181 | System.Console.CursorLeft = left; |
@@ -186,31 +185,30 @@ namespace OpenSim.Framework.Console | |||
186 | 185 | ||
187 | private void Show() | 186 | private void Show() |
188 | { | 187 | { |
189 | lock (cmdline) | 188 | lock (m_commandLine) |
190 | { | 189 | { |
191 | if (y == -1 || System.Console.BufferWidth == 0) | 190 | if (m_cursorYPosition == -1 || System.Console.BufferWidth == 0) |
192 | return; | 191 | return; |
193 | 192 | ||
194 | int xc = prompt.Length + cp; | 193 | int xc = prompt.Length + m_cursorXPosition; |
195 | int new_x = xc % System.Console.BufferWidth; | 194 | int new_x = xc % System.Console.BufferWidth; |
196 | int new_y = y + xc / System.Console.BufferWidth; | 195 | int new_y = m_cursorYPosition + xc / System.Console.BufferWidth; |
197 | int end_y = y + (cmdline.Length + prompt.Length) / System.Console.BufferWidth; | 196 | int end_y = m_cursorYPosition + (m_commandLine.Length + prompt.Length) / System.Console.BufferWidth; |
198 | if (end_y / System.Console.BufferWidth >= h) | 197 | |
199 | h++; | ||
200 | if (end_y >= System.Console.BufferHeight) // wrap | 198 | if (end_y >= System.Console.BufferHeight) // wrap |
201 | { | 199 | { |
202 | y--; | 200 | m_cursorYPosition--; |
203 | new_y--; | 201 | new_y--; |
204 | SetCursorLeft(0); | 202 | SetCursorLeft(0); |
205 | SetCursorTop(System.Console.BufferHeight - 1); | 203 | SetCursorTop(System.Console.BufferHeight - 1); |
206 | System.Console.WriteLine(" "); | 204 | System.Console.WriteLine(" "); |
207 | } | 205 | } |
208 | 206 | ||
209 | y = SetCursorTop(y); | 207 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
210 | SetCursorLeft(0); | 208 | SetCursorLeft(0); |
211 | 209 | ||
212 | if (echo) | 210 | if (m_echo) |
213 | System.Console.Write("{0}{1}", prompt, cmdline); | 211 | System.Console.Write("{0}{1}", prompt, m_commandLine); |
214 | else | 212 | else |
215 | System.Console.Write("{0}", prompt); | 213 | System.Console.Write("{0}", prompt); |
216 | 214 | ||
@@ -221,20 +219,20 @@ namespace OpenSim.Framework.Console | |||
221 | 219 | ||
222 | public override void LockOutput() | 220 | public override void LockOutput() |
223 | { | 221 | { |
224 | Monitor.Enter(cmdline); | 222 | Monitor.Enter(m_commandLine); |
225 | try | 223 | try |
226 | { | 224 | { |
227 | if (y != -1) | 225 | if (m_cursorYPosition != -1) |
228 | { | 226 | { |
229 | y = SetCursorTop(y); | 227 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
230 | System.Console.CursorLeft = 0; | 228 | System.Console.CursorLeft = 0; |
231 | 229 | ||
232 | int count = cmdline.Length + prompt.Length; | 230 | int count = m_commandLine.Length + prompt.Length; |
233 | 231 | ||
234 | while (count-- > 0) | 232 | while (count-- > 0) |
235 | System.Console.Write(" "); | 233 | System.Console.Write(" "); |
236 | 234 | ||
237 | y = SetCursorTop(y); | 235 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
238 | SetCursorLeft(0); | 236 | SetCursorLeft(0); |
239 | } | 237 | } |
240 | } | 238 | } |
@@ -245,12 +243,12 @@ namespace OpenSim.Framework.Console | |||
245 | 243 | ||
246 | public override void UnlockOutput() | 244 | public override void UnlockOutput() |
247 | { | 245 | { |
248 | if (y != -1) | 246 | if (m_cursorYPosition != -1) |
249 | { | 247 | { |
250 | y = System.Console.CursorTop; | 248 | m_cursorYPosition = System.Console.CursorTop; |
251 | Show(); | 249 | Show(); |
252 | } | 250 | } |
253 | Monitor.Exit(cmdline); | 251 | Monitor.Exit(m_commandLine); |
254 | } | 252 | } |
255 | 253 | ||
256 | private void WriteColorText(ConsoleColor color, string sender) | 254 | private void WriteColorText(ConsoleColor color, string sender) |
@@ -317,29 +315,29 @@ namespace OpenSim.Framework.Console | |||
317 | 315 | ||
318 | public override void Output(string text, string level) | 316 | public override void Output(string text, string level) |
319 | { | 317 | { |
320 | lock (cmdline) | 318 | lock (m_commandLine) |
321 | { | 319 | { |
322 | if (y == -1) | 320 | if (m_cursorYPosition == -1) |
323 | { | 321 | { |
324 | WriteLocalText(text, level); | 322 | WriteLocalText(text, level); |
325 | 323 | ||
326 | return; | 324 | return; |
327 | } | 325 | } |
328 | 326 | ||
329 | y = SetCursorTop(y); | 327 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
330 | SetCursorLeft(0); | 328 | SetCursorLeft(0); |
331 | 329 | ||
332 | int count = cmdline.Length + prompt.Length; | 330 | int count = m_commandLine.Length + prompt.Length; |
333 | 331 | ||
334 | while (count-- > 0) | 332 | while (count-- > 0) |
335 | System.Console.Write(" "); | 333 | System.Console.Write(" "); |
336 | 334 | ||
337 | y = SetCursorTop(y); | 335 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
338 | SetCursorLeft(0); | 336 | SetCursorLeft(0); |
339 | 337 | ||
340 | WriteLocalText(text, level); | 338 | WriteLocalText(text, level); |
341 | 339 | ||
342 | y = System.Console.CursorTop; | 340 | m_cursorYPosition = System.Console.CursorTop; |
343 | 341 | ||
344 | Show(); | 342 | Show(); |
345 | } | 343 | } |
@@ -347,9 +345,9 @@ namespace OpenSim.Framework.Console | |||
347 | 345 | ||
348 | private bool ContextHelp() | 346 | private bool ContextHelp() |
349 | { | 347 | { |
350 | string[] words = Parser.Parse(cmdline.ToString()); | 348 | string[] words = Parser.Parse(m_commandLine.ToString()); |
351 | 349 | ||
352 | bool trailingSpace = cmdline.ToString().EndsWith(" "); | 350 | bool trailingSpace = m_commandLine.ToString().EndsWith(" "); |
353 | 351 | ||
354 | // Allow ? through while typing a URI | 352 | // Allow ? through while typing a URI |
355 | // | 353 | // |
@@ -368,19 +366,18 @@ namespace OpenSim.Framework.Console | |||
368 | 366 | ||
369 | public override string ReadLine(string p, bool isCommand, bool e) | 367 | public override string ReadLine(string p, bool isCommand, bool e) |
370 | { | 368 | { |
371 | h = 1; | 369 | m_cursorXPosition = 0; |
372 | cp = 0; | ||
373 | prompt = p; | 370 | prompt = p; |
374 | echo = e; | 371 | m_echo = e; |
375 | int historyLine = history.Count; | 372 | int historyLine = m_history.Count; |
376 | 373 | ||
377 | SetCursorLeft(0); // Needed for mono | 374 | SetCursorLeft(0); // Needed for mono |
378 | System.Console.Write(" "); // Needed for mono | 375 | System.Console.Write(" "); // Needed for mono |
379 | 376 | ||
380 | lock (cmdline) | 377 | lock (m_commandLine) |
381 | { | 378 | { |
382 | y = System.Console.CursorTop; | 379 | m_cursorYPosition = System.Console.CursorTop; |
383 | cmdline.Remove(0, cmdline.Length); | 380 | m_commandLine.Remove(0, m_commandLine.Length); |
384 | } | 381 | } |
385 | 382 | ||
386 | while (true) | 383 | while (true) |
@@ -388,92 +385,95 @@ namespace OpenSim.Framework.Console | |||
388 | Show(); | 385 | Show(); |
389 | 386 | ||
390 | ConsoleKeyInfo key = System.Console.ReadKey(true); | 387 | ConsoleKeyInfo key = System.Console.ReadKey(true); |
391 | char c = key.KeyChar; | 388 | char enteredChar = key.KeyChar; |
392 | 389 | ||
393 | if (!Char.IsControl(c)) | 390 | if (!Char.IsControl(enteredChar)) |
394 | { | 391 | { |
395 | if (cp >= 318) | 392 | if (m_cursorXPosition >= 318) |
396 | continue; | 393 | continue; |
397 | 394 | ||
398 | if (c == '?' && isCommand) | 395 | if (enteredChar == '?' && isCommand) |
399 | { | 396 | { |
400 | if (ContextHelp()) | 397 | if (ContextHelp()) |
401 | continue; | 398 | continue; |
402 | } | 399 | } |
403 | 400 | ||
404 | cmdline.Insert(cp, c); | 401 | m_commandLine.Insert(m_cursorXPosition, enteredChar); |
405 | cp++; | 402 | m_cursorXPosition++; |
406 | } | 403 | } |
407 | else | 404 | else |
408 | { | 405 | { |
409 | switch (key.Key) | 406 | switch (key.Key) |
410 | { | 407 | { |
411 | case ConsoleKey.Backspace: | 408 | case ConsoleKey.Backspace: |
412 | if (cp == 0) | 409 | if (m_cursorXPosition == 0) |
413 | break; | 410 | break; |
414 | cmdline.Remove(cp-1, 1); | 411 | m_commandLine.Remove(m_cursorXPosition-1, 1); |
415 | cp--; | 412 | m_cursorXPosition--; |
416 | 413 | ||
417 | SetCursorLeft(0); | 414 | SetCursorLeft(0); |
418 | y = SetCursorTop(y); | 415 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
419 | 416 | ||
420 | System.Console.Write("{0}{1} ", prompt, cmdline); | 417 | if (m_echo) |
418 | System.Console.Write("{0}{1} ", prompt, m_commandLine); | ||
419 | else | ||
420 | System.Console.Write("{0}", prompt); | ||
421 | 421 | ||
422 | break; | 422 | break; |
423 | case ConsoleKey.End: | 423 | case ConsoleKey.End: |
424 | cp = cmdline.Length; | 424 | m_cursorXPosition = m_commandLine.Length; |
425 | break; | 425 | break; |
426 | case ConsoleKey.Home: | 426 | case ConsoleKey.Home: |
427 | cp = 0; | 427 | m_cursorXPosition = 0; |
428 | break; | 428 | break; |
429 | case ConsoleKey.UpArrow: | 429 | case ConsoleKey.UpArrow: |
430 | if (historyLine < 1) | 430 | if (historyLine < 1) |
431 | break; | 431 | break; |
432 | historyLine--; | 432 | historyLine--; |
433 | LockOutput(); | 433 | LockOutput(); |
434 | cmdline.Remove(0, cmdline.Length); | 434 | m_commandLine.Remove(0, m_commandLine.Length); |
435 | cmdline.Append(history[historyLine]); | 435 | m_commandLine.Append(m_history[historyLine]); |
436 | cp = cmdline.Length; | 436 | m_cursorXPosition = m_commandLine.Length; |
437 | UnlockOutput(); | 437 | UnlockOutput(); |
438 | break; | 438 | break; |
439 | case ConsoleKey.DownArrow: | 439 | case ConsoleKey.DownArrow: |
440 | if (historyLine >= history.Count) | 440 | if (historyLine >= m_history.Count) |
441 | break; | 441 | break; |
442 | historyLine++; | 442 | historyLine++; |
443 | LockOutput(); | 443 | LockOutput(); |
444 | if (historyLine == history.Count) | 444 | if (historyLine == m_history.Count) |
445 | { | 445 | { |
446 | cmdline.Remove(0, cmdline.Length); | 446 | m_commandLine.Remove(0, m_commandLine.Length); |
447 | } | 447 | } |
448 | else | 448 | else |
449 | { | 449 | { |
450 | cmdline.Remove(0, cmdline.Length); | 450 | m_commandLine.Remove(0, m_commandLine.Length); |
451 | cmdline.Append(history[historyLine]); | 451 | m_commandLine.Append(m_history[historyLine]); |
452 | } | 452 | } |
453 | cp = cmdline.Length; | 453 | m_cursorXPosition = m_commandLine.Length; |
454 | UnlockOutput(); | 454 | UnlockOutput(); |
455 | break; | 455 | break; |
456 | case ConsoleKey.LeftArrow: | 456 | case ConsoleKey.LeftArrow: |
457 | if (cp > 0) | 457 | if (m_cursorXPosition > 0) |
458 | cp--; | 458 | m_cursorXPosition--; |
459 | break; | 459 | break; |
460 | case ConsoleKey.RightArrow: | 460 | case ConsoleKey.RightArrow: |
461 | if (cp < cmdline.Length) | 461 | if (m_cursorXPosition < m_commandLine.Length) |
462 | cp++; | 462 | m_cursorXPosition++; |
463 | break; | 463 | break; |
464 | case ConsoleKey.Enter: | 464 | case ConsoleKey.Enter: |
465 | SetCursorLeft(0); | 465 | SetCursorLeft(0); |
466 | y = SetCursorTop(y); | 466 | m_cursorYPosition = SetCursorTop(m_cursorYPosition); |
467 | 467 | ||
468 | System.Console.WriteLine(); | 468 | System.Console.WriteLine(); |
469 | //Show(); | 469 | //Show(); |
470 | 470 | ||
471 | lock (cmdline) | 471 | lock (m_commandLine) |
472 | { | 472 | { |
473 | y = -1; | 473 | m_cursorYPosition = -1; |
474 | } | 474 | } |
475 | 475 | ||
476 | string commandLine = cmdline.ToString(); | 476 | string commandLine = m_commandLine.ToString(); |
477 | 477 | ||
478 | if (isCommand) | 478 | if (isCommand) |
479 | { | 479 | { |
@@ -481,12 +481,12 @@ namespace OpenSim.Framework.Console | |||
481 | 481 | ||
482 | if (cmd.Length != 0) | 482 | if (cmd.Length != 0) |
483 | { | 483 | { |
484 | int i; | 484 | int index; |
485 | 485 | ||
486 | for (i=0 ; i < cmd.Length ; i++) | 486 | for (index=0 ; index < cmd.Length ; index++) |
487 | { | 487 | { |
488 | if (cmd[i].Contains(" ")) | 488 | if (cmd[index].Contains(" ")) |
489 | cmd[i] = "\"" + cmd[i] + "\""; | 489 | cmd[index] = "\"" + cmd[index] + "\""; |
490 | } | 490 | } |
491 | AddToHistory(String.Join(" ", cmd)); | 491 | AddToHistory(String.Join(" ", cmd)); |
492 | return String.Empty; | 492 | return String.Empty; |
@@ -494,7 +494,7 @@ namespace OpenSim.Framework.Console | |||
494 | } | 494 | } |
495 | 495 | ||
496 | // If we're not echoing to screen (e.g. a password) then we probably don't want it in history | 496 | // If we're not echoing to screen (e.g. a password) then we probably don't want it in history |
497 | if (echo && commandLine != "") | 497 | if (m_echo && commandLine != "") |
498 | AddToHistory(commandLine); | 498 | AddToHistory(commandLine); |
499 | 499 | ||
500 | return commandLine; | 500 | return commandLine; |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 150ff1b..47e79d1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -935,7 +935,7 @@ namespace OpenSim.Framework | |||
935 | event ScriptReset OnScriptReset; | 935 | event ScriptReset OnScriptReset; |
936 | event GetScriptRunning OnGetScriptRunning; | 936 | event GetScriptRunning OnGetScriptRunning; |
937 | event SetScriptRunning OnSetScriptRunning; | 937 | event SetScriptRunning OnSetScriptRunning; |
938 | event Action<Vector3, bool> OnAutoPilotGo; | 938 | event Action<Vector3, bool, bool> OnAutoPilotGo; |
939 | 939 | ||
940 | event TerrainUnacked OnUnackedTerrain; | 940 | event TerrainUnacked OnUnackedTerrain; |
941 | event ActivateGesture OnActivateGesture; | 941 | event ActivateGesture OnActivateGesture; |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 745da17..c4fc643 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1372,11 +1372,30 @@ namespace OpenSim.Framework | |||
1372 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 1372 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | /// <summary> | ||
1376 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. | ||
1377 | /// </summary> | ||
1378 | /// <param name="str"> | ||
1379 | /// If null or empty, then an bytes[0] is returned. | ||
1380 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1381 | /// </param> | ||
1382 | /// <param name="args"> | ||
1383 | /// Arguments to substitute into the string via the {} mechanism. | ||
1384 | /// </param> | ||
1385 | /// <returns></returns> | ||
1375 | public static byte[] StringToBytes256(string str, params object[] args) | 1386 | public static byte[] StringToBytes256(string str, params object[] args) |
1376 | { | 1387 | { |
1377 | return StringToBytes256(string.Format(str, args)); | 1388 | return StringToBytes256(string.Format(str, args)); |
1378 | } | 1389 | } |
1379 | 1390 | ||
1391 | /// <summary> | ||
1392 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. | ||
1393 | /// </summary> | ||
1394 | /// <param name="str"> | ||
1395 | /// If null or empty, then an bytes[0] is returned. | ||
1396 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1397 | /// </param> | ||
1398 | /// <returns></returns> | ||
1380 | public static byte[] StringToBytes256(string str) | 1399 | public static byte[] StringToBytes256(string str) |
1381 | { | 1400 | { |
1382 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1401 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
@@ -1395,11 +1414,30 @@ namespace OpenSim.Framework | |||
1395 | return data; | 1414 | return data; |
1396 | } | 1415 | } |
1397 | 1416 | ||
1417 | /// <summary> | ||
1418 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary. | ||
1419 | /// </summary> | ||
1420 | /// <param name="str"> | ||
1421 | /// If null or empty, then an bytes[0] is returned. | ||
1422 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1423 | /// </param> | ||
1424 | /// <param name="args"> | ||
1425 | /// Arguments to substitute into the string via the {} mechanism. | ||
1426 | /// </param> | ||
1427 | /// <returns></returns> | ||
1398 | public static byte[] StringToBytes1024(string str, params object[] args) | 1428 | public static byte[] StringToBytes1024(string str, params object[] args) |
1399 | { | 1429 | { |
1400 | return StringToBytes1024(string.Format(str, args)); | 1430 | return StringToBytes1024(string.Format(str, args)); |
1401 | } | 1431 | } |
1402 | 1432 | ||
1433 | /// <summary> | ||
1434 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary. | ||
1435 | /// </summary> | ||
1436 | /// <param name="str"> | ||
1437 | /// If null or empty, then an bytes[0] is returned. | ||
1438 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1439 | /// </param> | ||
1440 | /// <returns></returns> | ||
1403 | public static byte[] StringToBytes1024(string str) | 1441 | public static byte[] StringToBytes1024(string str) |
1404 | { | 1442 | { |
1405 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1443 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |