diff options
Diffstat (limited to '')
17 files changed, 77 insertions, 176 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 44c12a2..535a5ea 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -49,8 +49,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
49 | public string Version { get { return m_version; } } | 49 | public string Version { get { return m_version; } } |
50 | public string Name { get { return m_name; } } | 50 | public string Name { get { return m_name; } } |
51 | 51 | ||
52 | public void Initialise() | 52 | public void Initialise() |
53 | { | 53 | { |
54 | m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); | 54 | m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); |
55 | throw new PluginNotInitialisedException (Name); | 55 | throw new PluginNotInitialisedException (Name); |
56 | } | 56 | } |
@@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
75 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | 75 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); |
76 | 76 | ||
77 | openSim.ModuleLoader.LoadDefaultSharedModules(); | 77 | openSim.ModuleLoader.LoadDefaultSharedModules(); |
78 | 78 | ||
79 | if (!CheckRegionsForSanity(regionsToLoad)) | 79 | if (!CheckRegionsForSanity(regionsToLoad)) |
80 | { | 80 | { |
81 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); | 81 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); |
@@ -95,10 +95,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
95 | 95 | ||
96 | public void Dispose() | 96 | public void Dispose() |
97 | { | 97 | { |
98 | } | 98 | } |
99 | 99 | ||
100 | #endregion | 100 | #endregion |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Check that region configuration information makes sense. | 103 | /// Check that region configuration information makes sense. |
104 | /// </summary> | 104 | /// </summary> |
@@ -108,43 +108,43 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
108 | { | 108 | { |
109 | if (regions.Length <= 0) | 109 | if (regions.Length <= 0) |
110 | return true; | 110 | return true; |
111 | 111 | ||
112 | List<RegionInfo> checkedRegions = new List<RegionInfo>(); | 112 | List<RegionInfo> checkedRegions = new List<RegionInfo>(); |
113 | checkedRegions.Add(regions[0]); | 113 | checkedRegions.Add(regions[0]); |
114 | 114 | ||
115 | for (int i = 1; i < regions.Length; i++) | 115 | for (int i = 1; i < regions.Length; i++) |
116 | { | 116 | { |
117 | RegionInfo region = regions[i]; | 117 | RegionInfo region = regions[i]; |
118 | 118 | ||
119 | foreach (RegionInfo checkedRegion in checkedRegions) | 119 | foreach (RegionInfo checkedRegion in checkedRegions) |
120 | { | 120 | { |
121 | if (region.RegionID == checkedRegion.RegionID) | 121 | if (region.RegionID == checkedRegion.RegionID) |
122 | { | 122 | { |
123 | m_log.ErrorFormat( | 123 | m_log.ErrorFormat( |
124 | "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", | 124 | "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", |
125 | region.RegionName, checkedRegion.RegionName, region.RegionID); | 125 | region.RegionName, checkedRegion.RegionName, region.RegionID); |
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY) | 128 | else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY) |
129 | { | 129 | { |
130 | m_log.ErrorFormat( | 130 | m_log.ErrorFormat( |
131 | "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}", | 131 | "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}", |
132 | region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY); | 132 | region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY); |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port) | 135 | else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port) |
136 | { | 136 | { |
137 | m_log.ErrorFormat( | 137 | m_log.ErrorFormat( |
138 | "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", | 138 | "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", |
139 | region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port); | 139 | region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port); |
140 | return false; | 140 | return false; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | return true; | 145 | return true; |
146 | } | 146 | } |
147 | 147 | ||
148 | public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle) | 148 | public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle) |
149 | { | 149 | { |
150 | m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); | 150 | m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs index 5fd0219..f593349 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs | |||
@@ -23,14 +23,12 @@ | |||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | */ | 26 | */ |
28 | 27 | ||
29 | using System; | 28 | using System; |
30 | 29 | ||
31 | namespace OpenSim.ApplicationPlugins.Rest.Inventory | 30 | namespace OpenSim.ApplicationPlugins.Rest.Inventory |
32 | { | 31 | { |
33 | |||
34 | /// <summary> | 32 | /// <summary> |
35 | /// This interface represents the boundary between the general purpose | 33 | /// This interface represents the boundary between the general purpose |
36 | /// REST plugin handling, and the functionally specific handlers. The | 34 | /// REST plugin handling, and the functionally specific handlers. The |
@@ -44,5 +42,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
44 | void Initialize(); | 42 | void Initialize(); |
45 | void Close(); | 43 | void Close(); |
46 | } | 44 | } |
47 | |||
48 | } | 45 | } |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs index 6fc3ea3..d08f830 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs | |||
@@ -40,7 +40,6 @@ using System.Xml; | |||
40 | 40 | ||
41 | namespace OpenSim.ApplicationPlugins.Rest.Inventory | 41 | namespace OpenSim.ApplicationPlugins.Rest.Inventory |
42 | { | 42 | { |
43 | |||
44 | /// <summary> | 43 | /// <summary> |
45 | /// This class represents the current REST request. It | 44 | /// This class represents the current REST request. It |
46 | /// encapsulates the request/response state and takes care | 45 | /// encapsulates the request/response state and takes care |
@@ -66,7 +65,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
66 | 65 | ||
67 | internal class RequestData | 66 | internal class RequestData |
68 | { | 67 | { |
69 | |||
70 | // HTTP Server interface data | 68 | // HTTP Server interface data |
71 | 69 | ||
72 | internal OSHttpRequest request = null; | 70 | internal OSHttpRequest request = null; |
@@ -170,7 +168,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
170 | 168 | ||
171 | internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) | 169 | internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) |
172 | { | 170 | { |
173 | |||
174 | request = p_request; | 171 | request = p_request; |
175 | response = p_response; | 172 | response = p_response; |
176 | qprefix = p_qprefix; | 173 | qprefix = p_qprefix; |
@@ -187,7 +184,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
187 | initUrl(); | 184 | initUrl(); |
188 | 185 | ||
189 | initParameters(p_qprefix.Length); | 186 | initParameters(p_qprefix.Length); |
190 | |||
191 | } | 187 | } |
192 | 188 | ||
193 | // Just for convenience... | 189 | // Just for convenience... |
@@ -212,7 +208,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
212 | 208 | ||
213 | return authenticated; | 209 | return authenticated; |
214 | } | 210 | } |
215 | else return true; | 211 | else |
212 | return true; | ||
216 | } | 213 | } |
217 | } | 214 | } |
218 | 215 | ||
@@ -229,7 +226,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
229 | 226 | ||
230 | private void authenticate() | 227 | private void authenticate() |
231 | { | 228 | { |
232 | |||
233 | string authdata = request.Headers.Get("Authorization"); | 229 | string authdata = request.Headers.Get("Authorization"); |
234 | string reqscheme = String.Empty; | 230 | string reqscheme = String.Empty; |
235 | 231 | ||
@@ -291,7 +287,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
291 | Rest.Log.DebugFormat("{0} Challenge reason: Authentication failed", MsgId); | 287 | Rest.Log.DebugFormat("{0} Challenge reason: Authentication failed", MsgId); |
292 | DoChallenge(); | 288 | DoChallenge(); |
293 | } | 289 | } |
294 | |||
295 | } | 290 | } |
296 | 291 | ||
297 | /// <summary> | 292 | /// <summary> |
@@ -315,7 +310,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
315 | 310 | ||
316 | private void DoBasic(string authdata) | 311 | private void DoBasic(string authdata) |
317 | { | 312 | { |
318 | |||
319 | string response = null; | 313 | string response = null; |
320 | 314 | ||
321 | MatchCollection matches = basicParms.Matches(authdata); | 315 | MatchCollection matches = basicParms.Matches(authdata); |
@@ -346,7 +340,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
346 | // Validate against user database | 340 | // Validate against user database |
347 | authenticated = Validate(userName,userPass); | 341 | authenticated = Validate(userName,userPass); |
348 | } | 342 | } |
349 | |||
350 | } | 343 | } |
351 | 344 | ||
352 | /// <summary> | 345 | /// <summary> |
@@ -357,7 +350,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
357 | 350 | ||
358 | private void DoDigest(string authdata) | 351 | private void DoDigest(string authdata) |
359 | { | 352 | { |
360 | |||
361 | string response = null; | 353 | string response = null; |
362 | 354 | ||
363 | MatchCollection matches = digestParm1.Matches(authdata); | 355 | MatchCollection matches = digestParm1.Matches(authdata); |
@@ -390,12 +382,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
390 | 382 | ||
391 | if (authparms.TryGetValue("response", out response)) | 383 | if (authparms.TryGetValue("response", out response)) |
392 | { | 384 | { |
393 | |||
394 | string temp = null; | 385 | string temp = null; |
395 | 386 | ||
396 | do | 387 | do |
397 | { | 388 | { |
398 | |||
399 | string nck = null; | 389 | string nck = null; |
400 | string ncl = null; | 390 | string ncl = null; |
401 | 391 | ||
@@ -448,7 +438,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
448 | 438 | ||
449 | if (authparms.TryGetValue("qop", out temp)) | 439 | if (authparms.TryGetValue("qop", out temp)) |
450 | { | 440 | { |
451 | |||
452 | qop = temp.ToLower(); // replace with actual value used | 441 | qop = temp.ToLower(); // replace with actual value used |
453 | 442 | ||
454 | // if QOP was specified then | 443 | // if QOP was specified then |
@@ -485,11 +474,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
485 | { | 474 | { |
486 | lock (cntable) cntable.Add(nonce, nck); | 475 | lock (cntable) cntable.Add(nonce, nck); |
487 | } | 476 | } |
488 | |||
489 | } | 477 | } |
490 | else | 478 | else |
491 | { | 479 | { |
492 | |||
493 | qop = String.Empty; | 480 | qop = String.Empty; |
494 | 481 | ||
495 | // if QOP was not specified then | 482 | // if QOP was not specified then |
@@ -509,12 +496,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
509 | // Validate the supplied userid/password info | 496 | // Validate the supplied userid/password info |
510 | 497 | ||
511 | authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); | 498 | authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); |
512 | |||
513 | } | 499 | } |
514 | while (false); | 500 | while (false); |
515 | |||
516 | } | 501 | } |
517 | |||
518 | } | 502 | } |
519 | 503 | ||
520 | // Indicate that authentication is required | 504 | // Indicate that authentication is required |
@@ -523,7 +507,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
523 | string opaque, string stale, string alg, | 507 | string opaque, string stale, string alg, |
524 | string qop, string auth) | 508 | string qop, string auth) |
525 | { | 509 | { |
526 | |||
527 | sbuilder.Length = 0; | 510 | sbuilder.Length = 0; |
528 | 511 | ||
529 | if (scheme == null || scheme == Rest.AS_BASIC) | 512 | if (scheme == null || scheme == Rest.AS_BASIC) |
@@ -544,7 +527,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
544 | 527 | ||
545 | if (scheme == null || scheme == Rest.AS_DIGEST) | 528 | if (scheme == null || scheme == Rest.AS_DIGEST) |
546 | { | 529 | { |
547 | |||
548 | sbuilder.Append(Rest.AS_DIGEST); | 530 | sbuilder.Append(Rest.AS_DIGEST); |
549 | sbuilder.Append(" "); | 531 | sbuilder.Append(" "); |
550 | 532 | ||
@@ -617,9 +599,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
617 | sbuilder.Append(Rest.CS_DQUOTE); | 599 | sbuilder.Append(Rest.CS_DQUOTE); |
618 | 600 | ||
619 | AddHeader(Rest.HttpHeaderWWWAuthenticate,sbuilder.ToString()); | 601 | AddHeader(Rest.HttpHeaderWWWAuthenticate,sbuilder.ToString()); |
620 | |||
621 | } | 602 | } |
622 | |||
623 | } | 603 | } |
624 | 604 | ||
625 | /// <summary> | 605 | /// <summary> |
@@ -631,7 +611,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
631 | 611 | ||
632 | private bool Validate(string user, string pass) | 612 | private bool Validate(string user, string pass) |
633 | { | 613 | { |
634 | |||
635 | Rest.Log.DebugFormat("{0} Simple User Validation", MsgId); | 614 | Rest.Log.DebugFormat("{0} Simple User Validation", MsgId); |
636 | 615 | ||
637 | // Both values are required | 616 | // Both values are required |
@@ -643,7 +622,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
643 | user = user.Trim(); | 622 | user = user.Trim(); |
644 | 623 | ||
645 | return vetPassword(user, pass); | 624 | return vetPassword(user, pass); |
646 | |||
647 | } | 625 | } |
648 | 626 | ||
649 | /// <summary> | 627 | /// <summary> |
@@ -658,7 +636,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
658 | 636 | ||
659 | private string getPassword(string user) | 637 | private string getPassword(string user) |
660 | { | 638 | { |
661 | |||
662 | int x; | 639 | int x; |
663 | string first; | 640 | string first; |
664 | string last; | 641 | string last; |
@@ -690,7 +667,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
690 | Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user); | 667 | Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user); |
691 | return udata.PasswordHash; | 668 | return udata.PasswordHash; |
692 | } | 669 | } |
693 | |||
694 | } | 670 | } |
695 | 671 | ||
696 | /// <summary> | 672 | /// <summary> |
@@ -704,7 +680,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
704 | 680 | ||
705 | private bool vetPassword(string user, string pass) | 681 | private bool vetPassword(string user, string pass) |
706 | { | 682 | { |
707 | |||
708 | int x; | 683 | int x; |
709 | string HA1; | 684 | string HA1; |
710 | string first; | 685 | string first; |
@@ -734,13 +709,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
734 | HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); | 709 | HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); |
735 | 710 | ||
736 | return (0 == sc.Compare(HA1, udata.PasswordHash)); | 711 | return (0 == sc.Compare(HA1, udata.PasswordHash)); |
737 | |||
738 | } | 712 | } |
739 | 713 | ||
740 | // Validate the request-digest | 714 | // Validate the request-digest |
741 | private bool ValidateDigest(string user, string nonce, string cnonce, string nck, string uri, string response) | 715 | private bool ValidateDigest(string user, string nonce, string cnonce, string nck, string uri, string response) |
742 | { | 716 | { |
743 | |||
744 | string patt = null; | 717 | string patt = null; |
745 | string payl = String.Empty; | 718 | string payl = String.Empty; |
746 | string KDS = null; | 719 | string KDS = null; |
@@ -798,12 +771,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
798 | // Compare the generated sequence with the original | 771 | // Compare the generated sequence with the original |
799 | 772 | ||
800 | return (0 == sc.Compare(KDS, response)); | 773 | return (0 == sc.Compare(KDS, response)); |
801 | |||
802 | } | 774 | } |
803 | 775 | ||
804 | private string HashToString(string pattern) | 776 | private string HashToString(string pattern) |
805 | { | 777 | { |
806 | |||
807 | Rest.Log.DebugFormat("{0} Generate <{1}>", MsgId, pattern); | 778 | Rest.Log.DebugFormat("{0} Generate <{1}>", MsgId, pattern); |
808 | 779 | ||
809 | byte[] hash = md5hash.ComputeHash(encoding.GetBytes(pattern)); | 780 | byte[] hash = md5hash.ComputeHash(encoding.GetBytes(pattern)); |
@@ -818,7 +789,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
818 | Rest.Log.DebugFormat("{0} Hash = <{1}>", MsgId, sbuilder.ToString()); | 789 | Rest.Log.DebugFormat("{0} Hash = <{1}>", MsgId, sbuilder.ToString()); |
819 | 790 | ||
820 | return sbuilder.ToString(); | 791 | return sbuilder.ToString(); |
821 | |||
822 | } | 792 | } |
823 | 793 | ||
824 | internal void Complete() | 794 | internal void Complete() |
@@ -829,7 +799,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
829 | 799 | ||
830 | internal void Redirect(string Url, bool temp) | 800 | internal void Redirect(string Url, bool temp) |
831 | { | 801 | { |
832 | |||
833 | redirectLocation = Url; | 802 | redirectLocation = Url; |
834 | 803 | ||
835 | if (temp) | 804 | if (temp) |
@@ -844,7 +813,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
844 | } | 813 | } |
845 | 814 | ||
846 | Fail(statusCode, statusDescription, true); | 815 | Fail(statusCode, statusDescription, true); |
847 | |||
848 | } | 816 | } |
849 | 817 | ||
850 | // Fail for an arbitrary reason. Just a failure with | 818 | // Fail for an arbitrary reason. Just a failure with |
@@ -867,7 +835,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
867 | 835 | ||
868 | internal void Fail(int code, string message, bool reset) | 836 | internal void Fail(int code, string message, bool reset) |
869 | { | 837 | { |
870 | |||
871 | statusCode = code; | 838 | statusCode = code; |
872 | statusDescription = message; | 839 | statusDescription = message; |
873 | 840 | ||
@@ -907,7 +874,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
907 | re.httppath = path; | 874 | re.httppath = path; |
908 | 875 | ||
909 | throw re; | 876 | throw re; |
910 | |||
911 | } | 877 | } |
912 | 878 | ||
913 | // Reject this request | 879 | // Reject this request |
@@ -924,19 +890,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
924 | 890 | ||
925 | internal virtual bool Respond(string reason) | 891 | internal virtual bool Respond(string reason) |
926 | { | 892 | { |
927 | |||
928 | Rest.Log.DebugFormat("{0} Respond ENTRY, handled = {1}, reason = {2}", MsgId, handled, reason); | 893 | Rest.Log.DebugFormat("{0} Respond ENTRY, handled = {1}, reason = {2}", MsgId, handled, reason); |
929 | 894 | ||
930 | if (!handled) | 895 | if (!handled) |
931 | { | 896 | { |
932 | |||
933 | Rest.Log.DebugFormat("{0} Generating Response", MsgId); | 897 | Rest.Log.DebugFormat("{0} Generating Response", MsgId); |
934 | Rest.Log.DebugFormat("{0} Method is {1}", MsgId, method); | 898 | Rest.Log.DebugFormat("{0} Method is {1}", MsgId, method); |
935 | 899 | ||
936 | // A Head request can NOT have a body! | 900 | // A Head request can NOT have a body! |
937 | if (method != Rest.HEAD) | 901 | if (method != Rest.HEAD) |
938 | { | 902 | { |
939 | |||
940 | Rest.Log.DebugFormat("{0} Response is not abbreviated", MsgId); | 903 | Rest.Log.DebugFormat("{0} Response is not abbreviated", MsgId); |
941 | 904 | ||
942 | // If the writer is non-null then we know that an XML | 905 | // If the writer is non-null then we know that an XML |
@@ -993,7 +956,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
993 | 956 | ||
994 | response.SendChunked = chunked; | 957 | response.SendChunked = chunked; |
995 | response.KeepAlive = keepAlive; | 958 | response.KeepAlive = keepAlive; |
996 | |||
997 | } | 959 | } |
998 | 960 | ||
999 | // Set the status code & description. If nothing has been stored, | 961 | // Set the status code & description. If nothing has been stored, |
@@ -1054,13 +1016,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1054 | 1016 | ||
1055 | Rest.Log.DebugFormat("{0} Closing output stream", MsgId); | 1017 | Rest.Log.DebugFormat("{0} Closing output stream", MsgId); |
1056 | response.OutputStream.Close(); | 1018 | response.OutputStream.Close(); |
1057 | |||
1058 | } | 1019 | } |
1059 | 1020 | ||
1060 | Rest.Log.DebugFormat("{0} Respond EXIT, handled = {1}, reason = {2}", MsgId, handled, reason); | 1021 | Rest.Log.DebugFormat("{0} Respond EXIT, handled = {1}, reason = {2}", MsgId, handled, reason); |
1061 | 1022 | ||
1062 | return handled; | 1023 | return handled; |
1063 | |||
1064 | } | 1024 | } |
1065 | 1025 | ||
1066 | // Add a header to the table. We need to allow | 1026 | // Add a header to the table. We need to allow |
@@ -1122,7 +1082,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1122 | 1082 | ||
1123 | private void initUrl() | 1083 | private void initUrl() |
1124 | { | 1084 | { |
1125 | |||
1126 | uri = request.Url; | 1085 | uri = request.Url; |
1127 | 1086 | ||
1128 | if (query == null) | 1087 | if (query == null) |
@@ -1137,7 +1096,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1137 | { | 1096 | { |
1138 | path = uri.AbsolutePath; | 1097 | path = uri.AbsolutePath; |
1139 | if (path.EndsWith(Rest.UrlPathSeparator)) | 1098 | if (path.EndsWith(Rest.UrlPathSeparator)) |
1140 | path = path.Substring(0,path.Length-1); | 1099 | path = path.Substring(0, path.Length-1); |
1141 | } | 1100 | } |
1142 | 1101 | ||
1143 | // If we succeeded in getting a path, perform any | 1102 | // If we succeeded in getting a path, perform any |
@@ -1149,7 +1108,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1149 | { | 1108 | { |
1150 | // Handle "+". Not a standard substitution, but | 1109 | // Handle "+". Not a standard substitution, but |
1151 | // common enough... | 1110 | // common enough... |
1152 | path = path.Replace(Rest.C_PLUS,Rest.C_SPACE); | 1111 | path = path.Replace(Rest.C_PLUS, Rest.C_SPACE); |
1153 | } | 1112 | } |
1154 | pathNodes = path.Split(Rest.CA_PATHSEP); | 1113 | pathNodes = path.Split(Rest.CA_PATHSEP); |
1155 | } | 1114 | } |
@@ -1167,12 +1126,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1167 | 1126 | ||
1168 | hostname = uri.Host; | 1127 | hostname = uri.Host; |
1169 | port = uri.Port; | 1128 | port = uri.Port; |
1170 | |||
1171 | } | 1129 | } |
1172 | 1130 | ||
1173 | internal int initParameters(int prfxlen) | 1131 | internal int initParameters(int prfxlen) |
1174 | { | 1132 | { |
1175 | |||
1176 | if (prfxlen < path.Length-1) | 1133 | if (prfxlen < path.Length-1) |
1177 | { | 1134 | { |
1178 | parameters = path.Substring(prfxlen+1).Split(Rest.CA_PATHSEP); | 1135 | parameters = path.Substring(prfxlen+1).Split(Rest.CA_PATHSEP); |
@@ -1194,7 +1151,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1194 | } | 1151 | } |
1195 | 1152 | ||
1196 | return parameters.Length; | 1153 | return parameters.Length; |
1197 | |||
1198 | } | 1154 | } |
1199 | 1155 | ||
1200 | internal string[] PathNodes | 1156 | internal string[] PathNodes |
@@ -1211,7 +1167,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1211 | 1167 | ||
1212 | internal string BuildUrl(int first, int last) | 1168 | internal string BuildUrl(int first, int last) |
1213 | { | 1169 | { |
1214 | |||
1215 | if (pathNodes == null) | 1170 | if (pathNodes == null) |
1216 | { | 1171 | { |
1217 | initUrl(); | 1172 | initUrl(); |
@@ -1252,7 +1207,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1252 | } | 1207 | } |
1253 | 1208 | ||
1254 | return sbuilder.ToString(); | 1209 | return sbuilder.ToString(); |
1255 | |||
1256 | } | 1210 | } |
1257 | 1211 | ||
1258 | // Setup the XML writer for output | 1212 | // Setup the XML writer for output |
@@ -1272,7 +1226,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1272 | 1226 | ||
1273 | internal void initXmlReader() | 1227 | internal void initXmlReader() |
1274 | { | 1228 | { |
1275 | |||
1276 | XmlReaderSettings settings = new XmlReaderSettings(); | 1229 | XmlReaderSettings settings = new XmlReaderSettings(); |
1277 | 1230 | ||
1278 | settings.ConformanceLevel = ConformanceLevel.Fragment; | 1231 | settings.ConformanceLevel = ConformanceLevel.Fragment; |
@@ -1282,14 +1235,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1282 | settings.ValidationType = ValidationType.None; | 1235 | settings.ValidationType = ValidationType.None; |
1283 | 1236 | ||
1284 | reader = XmlReader.Create(request.InputStream,settings); | 1237 | reader = XmlReader.Create(request.InputStream,settings); |
1285 | |||
1286 | } | 1238 | } |
1287 | 1239 | ||
1288 | private void Flush() | 1240 | private void Flush() |
1289 | { | 1241 | { |
1290 | byte[] dbuffer = new byte[8192]; | 1242 | byte[] dbuffer = new byte[8192]; |
1291 | while (request.InputStream.Read(dbuffer,0,dbuffer.Length) != 0); | 1243 | while (request.InputStream.Read(dbuffer,0,dbuffer.Length) != 0); |
1292 | return; | ||
1293 | } | 1244 | } |
1294 | 1245 | ||
1295 | // This allows us to make errors a bit more apparent in REST | 1246 | // This allows us to make errors a bit more apparent in REST |
@@ -1301,7 +1252,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1301 | 1252 | ||
1302 | internal void SendHtml(string title, string text) | 1253 | internal void SendHtml(string title, string text) |
1303 | { | 1254 | { |
1304 | |||
1305 | AddHeader(Rest.HttpHeaderContentType, "text/html"); | 1255 | AddHeader(Rest.HttpHeaderContentType, "text/html"); |
1306 | sbuilder.Length = 0; | 1256 | sbuilder.Length = 0; |
1307 | 1257 | ||
@@ -1321,7 +1271,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1321 | sbuilder.Append("</html>"); | 1271 | sbuilder.Append("</html>"); |
1322 | 1272 | ||
1323 | html = sbuilder.ToString(); | 1273 | html = sbuilder.ToString(); |
1324 | |||
1325 | } | 1274 | } |
1326 | } | 1275 | } |
1327 | } | 1276 | } |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 2bb91a4..e8c0ee8 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | |||
@@ -38,10 +38,8 @@ using Nini.Config; | |||
38 | 38 | ||
39 | namespace OpenSim.ApplicationPlugins.Rest.Inventory | 39 | namespace OpenSim.ApplicationPlugins.Rest.Inventory |
40 | { | 40 | { |
41 | |||
42 | public class Rest | 41 | public class Rest |
43 | { | 42 | { |
44 | |||
45 | internal static readonly log4net.ILog Log = | 43 | internal static readonly log4net.ILog Log = |
46 | log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 45 | ||
@@ -374,7 +372,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
374 | } | 372 | } |
375 | 373 | ||
376 | return sum; | 374 | return sum; |
377 | |||
378 | } | 375 | } |
379 | 376 | ||
380 | public static string Int2Hex8(int val) | 377 | public static string Int2Hex8(int val) |
@@ -409,7 +406,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
409 | 406 | ||
410 | public static void Dump(byte[] data) | 407 | public static void Dump(byte[] data) |
411 | { | 408 | { |
412 | |||
413 | char[] buffer = new char[Rest.DumpLineSize]; | 409 | char[] buffer = new char[Rest.DumpLineSize]; |
414 | int cc = 0; | 410 | int cc = 0; |
415 | 411 | ||
@@ -435,7 +431,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
435 | Console.Write(" |"+(new String(buffer))+"|"); | 431 | Console.Write(" |"+(new String(buffer))+"|"); |
436 | cc = 0; | 432 | cc = 0; |
437 | } | 433 | } |
438 | |||
439 | } | 434 | } |
440 | 435 | ||
441 | // Finish off any incomplete line | 436 | // Finish off any incomplete line |
@@ -455,16 +450,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
455 | { | 450 | { |
456 | Console.Write("\n"); | 451 | Console.Write("\n"); |
457 | } | 452 | } |
458 | |||
459 | } | 453 | } |
460 | |||
461 | } | 454 | } |
462 | 455 | ||
463 | // Local exception type | 456 | // Local exception type |
464 | 457 | ||
465 | public class RestException : Exception | 458 | public class RestException : Exception |
466 | { | 459 | { |
467 | |||
468 | internal int statusCode; | 460 | internal int statusCode; |
469 | internal string statusDesc; | 461 | internal string statusDesc; |
470 | internal string httpmethod; | 462 | internal string httpmethod; |
@@ -474,5 +466,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
474 | { | 466 | { |
475 | } | 467 | } |
476 | } | 468 | } |
477 | |||
478 | } | 469 | } |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index 95b0ee3..85748fa 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | |||
@@ -182,7 +182,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
182 | } | 182 | } |
183 | 183 | ||
184 | Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId); | 184 | Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId); |
185 | |||
186 | } | 185 | } |
187 | 186 | ||
188 | #endregion Interface | 187 | #endregion Interface |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs index 7f4157c..9853f16 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs | |||
@@ -358,8 +358,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
358 | { | 358 | { |
359 | if (path.StartsWith(key)) | 359 | if (path.StartsWith(key)) |
360 | { | 360 | { |
361 | return ( path.Length == key.Length || | 361 | return (path.Length == key.Length || |
362 | path.Substring(key.Length,1) == Rest.UrlPathSeparator); | 362 | path.Substring(key.Length, 1) == Rest.UrlPathSeparator); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 0c107d5..8a0eba5 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | |||
@@ -257,7 +257,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
257 | 257 | ||
258 | if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) | 258 | if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) |
259 | { | 259 | { |
260 | |||
261 | rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid); | 260 | rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid); |
262 | 261 | ||
263 | Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", | 262 | Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", |
@@ -646,7 +645,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
646 | 645 | ||
647 | // Scan the set of folders in the entity collection for an | 646 | // Scan the set of folders in the entity collection for an |
648 | // entry that matches the context folder. It is assumed that | 647 | // entry that matches the context folder. It is assumed that |
649 | // the only reliable indicator of this is a zero UUID ( using | 648 | // the only reliable indicator of this is a zero UUID (using |
650 | // implicit context), or the parent's UUID matches that of the | 649 | // implicit context), or the parent's UUID matches that of the |
651 | // URI designated node (explicit context). We don't allow | 650 | // URI designated node (explicit context). We don't allow |
652 | // ambiguity in this case because this is POST and we are | 651 | // ambiguity in this case because this is POST and we are |
@@ -1368,7 +1367,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1368 | 1367 | ||
1369 | foreach (InventoryFolderBase parent in ic.rdata.folders) | 1368 | foreach (InventoryFolderBase parent in ic.rdata.folders) |
1370 | { | 1369 | { |
1371 | if ( parent.ID == result.ParentID ) | 1370 | if (parent.ID == result.ParentID) |
1372 | { | 1371 | { |
1373 | found = true; | 1372 | found = true; |
1374 | break; | 1373 | break; |
@@ -1382,7 +1381,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1382 | ic.Fail(Rest.HttpStatusCodeBadRequest, | 1381 | ic.Fail(Rest.HttpStatusCodeBadRequest, |
1383 | Rest.HttpStatusDescBadRequest+": invalid parent"); | 1382 | Rest.HttpStatusDescBadRequest+": invalid parent"); |
1384 | } | 1383 | } |
1385 | |||
1386 | } | 1384 | } |
1387 | 1385 | ||
1388 | // This is a new folder, so no existing UUID is available | 1386 | // This is a new folder, so no existing UUID is available |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs index 41319ea..a5165d9 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs | |||
@@ -40,10 +40,8 @@ using OpenSim.Framework.Communications.Cache; | |||
40 | 40 | ||
41 | namespace OpenSim.ApplicationPlugins.Rest.Inventory | 41 | namespace OpenSim.ApplicationPlugins.Rest.Inventory |
42 | { | 42 | { |
43 | |||
44 | public class RestTestServices : IRest | 43 | public class RestTestServices : IRest |
45 | { | 44 | { |
46 | |||
47 | private bool enabled = false; | 45 | private bool enabled = false; |
48 | private string qPrefix = "test"; | 46 | private string qPrefix = "test"; |
49 | 47 | ||
@@ -52,7 +50,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
52 | 50 | ||
53 | public RestTestServices() | 51 | public RestTestServices() |
54 | { | 52 | { |
55 | |||
56 | Rest.Log.InfoFormat("{0} Test services initializing", MsgId); | 53 | Rest.Log.InfoFormat("{0} Test services initializing", MsgId); |
57 | Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); | 54 | Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); |
58 | 55 | ||
@@ -67,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
67 | // Load test cases | 64 | // Load test cases |
68 | 65 | ||
69 | loadTests(); | 66 | loadTests(); |
70 | foreach ( ITest test in tests ) | 67 | foreach (ITest test in tests) |
71 | { | 68 | { |
72 | test.Initialize(); | 69 | test.Initialize(); |
73 | } | 70 | } |
@@ -81,7 +78,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
81 | enabled = true; | 78 | enabled = true; |
82 | 79 | ||
83 | Rest.Log.InfoFormat("{0} Test services initialization complete", MsgId); | 80 | Rest.Log.InfoFormat("{0} Test services initialization complete", MsgId); |
84 | |||
85 | } | 81 | } |
86 | 82 | ||
87 | // Post-construction, pre-enabled initialization opportunity | 83 | // Post-construction, pre-enabled initialization opportunity |
@@ -98,7 +94,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
98 | public void Close() | 94 | public void Close() |
99 | { | 95 | { |
100 | enabled = false; | 96 | enabled = false; |
101 | foreach ( ITest test in tests ) | 97 | foreach (ITest test in tests) |
102 | { | 98 | { |
103 | test.Close(); | 99 | test.Close(); |
104 | } | 100 | } |
@@ -123,8 +119,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
123 | 119 | ||
124 | private void DoTests(RequestData rdata) | 120 | private void DoTests(RequestData rdata) |
125 | { | 121 | { |
126 | 122 | if (!enabled) | |
127 | if (!enabled) return; | 123 | return; |
128 | 124 | ||
129 | // Now that we know this is a serious attempt to | 125 | // Now that we know this is a serious attempt to |
130 | // access inventory data, we should find out who | 126 | // access inventory data, we should find out who |
@@ -177,7 +173,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
177 | if (!rdata.handled) | 173 | if (!rdata.handled) |
178 | test.Execute(rdata); | 174 | test.Execute(rdata); |
179 | } | 175 | } |
180 | |||
181 | } | 176 | } |
182 | 177 | ||
183 | #endregion Interface | 178 | #endregion Interface |
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index b857aad..c9a0498 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs | |||
@@ -668,7 +668,7 @@ namespace OpenSim.Data.MySQL | |||
668 | while (r.Read()) | 668 | while (r.Read()) |
669 | { | 669 | { |
670 | int attachpoint = Convert.ToInt32(r["attachpoint"]); | 670 | int attachpoint = Convert.ToInt32(r["attachpoint"]); |
671 | if(ret.ContainsKey(attachpoint)) | 671 | if (ret.ContainsKey(attachpoint)) |
672 | continue; | 672 | continue; |
673 | Hashtable item = new Hashtable(); | 673 | Hashtable item = new Hashtable(); |
674 | item.Add("item", r["item"].ToString()); | 674 | item.Add("item", r["item"].ToString()); |
@@ -676,7 +676,7 @@ namespace OpenSim.Data.MySQL | |||
676 | 676 | ||
677 | ret.Add(attachpoint, item); | 677 | ret.Add(attachpoint, item); |
678 | } | 678 | } |
679 | 679 | ||
680 | r.Close(); | 680 | r.Close(); |
681 | 681 | ||
682 | return ret; | 682 | return ret; |
@@ -1205,7 +1205,7 @@ namespace OpenSim.Data.MySQL | |||
1205 | MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand(); | 1205 | MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand(); |
1206 | cmd.CommandText = sql; | 1206 | cmd.CommandText = sql; |
1207 | cmd.Parameters.AddWithValue("?uuid", agentID.ToString()); | 1207 | cmd.Parameters.AddWithValue("?uuid", agentID.ToString()); |
1208 | 1208 | ||
1209 | cmd.ExecuteNonQuery(); | 1209 | cmd.ExecuteNonQuery(); |
1210 | 1210 | ||
1211 | if (data == null) | 1211 | if (data == null) |
@@ -1216,7 +1216,7 @@ namespace OpenSim.Data.MySQL | |||
1216 | cmd = (MySqlCommand) dbcon.CreateCommand(); | 1216 | cmd = (MySqlCommand) dbcon.CreateCommand(); |
1217 | cmd.CommandText = sql; | 1217 | cmd.CommandText = sql; |
1218 | 1218 | ||
1219 | foreach(DictionaryEntry e in data) | 1219 | foreach (DictionaryEntry e in data) |
1220 | { | 1220 | { |
1221 | int attachpoint = Convert.ToInt32(e.Key); | 1221 | int attachpoint = Convert.ToInt32(e.Key); |
1222 | 1222 | ||
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 82ca5b1..9a056b2 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -57,8 +57,8 @@ namespace OpenSim.Data.MySQL | |||
57 | private string m_appearanceTableName = "avatarappearance"; | 57 | private string m_appearanceTableName = "avatarappearance"; |
58 | private string m_connectString; | 58 | private string m_connectString; |
59 | 59 | ||
60 | public override void Initialise() | 60 | public override void Initialise() |
61 | { | 61 | { |
62 | m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!"); | 62 | m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!"); |
63 | throw new PluginNotInitialisedException (Name); | 63 | throw new PluginNotInitialisedException (Name); |
64 | } | 64 | } |
@@ -409,7 +409,7 @@ namespace OpenSim.Data.MySQL | |||
409 | 409 | ||
410 | Lfli.Add(fli); | 410 | Lfli.Add(fli); |
411 | } | 411 | } |
412 | 412 | ||
413 | reader.Dispose(); | 413 | reader.Dispose(); |
414 | result.Dispose(); | 414 | result.Dispose(); |
415 | } | 415 | } |
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 67e26b1..3459504 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -363,7 +363,7 @@ namespace OpenSim.Framework | |||
363 | h["skirt_asset"] = SkirtAsset.ToString(); | 363 | h["skirt_asset"] = SkirtAsset.ToString(); |
364 | 364 | ||
365 | string attachments = GetAttachmentsString(); | 365 | string attachments = GetAttachmentsString(); |
366 | if(attachments != String.Empty) | 366 | if (attachments != String.Empty) |
367 | h["attachments"] = attachments; | 367 | h["attachments"] = attachments; |
368 | 368 | ||
369 | return h; | 369 | return h; |
@@ -411,7 +411,7 @@ namespace OpenSim.Framework | |||
411 | SkirtItem = new LLUUID((string)h["skirt_item"]); | 411 | SkirtItem = new LLUUID((string)h["skirt_item"]); |
412 | SkirtAsset = new LLUUID((string)h["skirt_asset"]); | 412 | SkirtAsset = new LLUUID((string)h["skirt_asset"]); |
413 | 413 | ||
414 | if(h.ContainsKey("attachments")) | 414 | if (h.ContainsKey("attachments")) |
415 | { | 415 | { |
416 | SetAttachmentsString(h["attachments"].ToString()); | 416 | SetAttachmentsString(h["attachments"].ToString()); |
417 | } | 417 | } |
@@ -441,7 +441,7 @@ namespace OpenSim.Framework | |||
441 | { | 441 | { |
442 | m_attachments.Clear(); | 442 | m_attachments.Clear(); |
443 | 443 | ||
444 | if(data == null) | 444 | if (data == null) |
445 | return; | 445 | return; |
446 | 446 | ||
447 | foreach (DictionaryEntry e in data) | 447 | foreach (DictionaryEntry e in data) |
@@ -468,7 +468,7 @@ namespace OpenSim.Framework | |||
468 | 468 | ||
469 | public Hashtable GetAttachments() | 469 | public Hashtable GetAttachments() |
470 | { | 470 | { |
471 | if(m_attachments.Count == 0) | 471 | if (m_attachments.Count == 0) |
472 | return null; | 472 | return null; |
473 | 473 | ||
474 | Hashtable ret = new Hashtable(); | 474 | Hashtable ret = new Hashtable(); |
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index b9610e0..767740b 100644 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs | |||
@@ -245,7 +245,7 @@ namespace OpenSim.Framework.Console | |||
245 | try | 245 | try |
246 | { | 246 | { |
247 | string line = System.Console.ReadLine(); | 247 | string line = System.Console.ReadLine(); |
248 | 248 | ||
249 | while (line == null) | 249 | while (line == null) |
250 | { | 250 | { |
251 | line = System.Console.ReadLine(); | 251 | line = System.Console.ReadLine(); |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index abc2bc1..29ee143 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -255,8 +255,8 @@ namespace OpenSim.Framework.Servers | |||
255 | 255 | ||
256 | SetConsoleLogLevel(setParams); | 256 | SetConsoleLogLevel(setParams); |
257 | } | 257 | } |
258 | } | 258 | } |
259 | 259 | ||
260 | /// <summary> | 260 | /// <summary> |
261 | /// Show help information | 261 | /// Show help information |
262 | /// </summary> | 262 | /// </summary> |
@@ -270,7 +270,7 @@ namespace OpenSim.Framework.Servers | |||
270 | //Notice("help [command] - display general help or specific command help. Try help help for more info."); | 270 | //Notice("help [command] - display general help or specific command help. Try help help for more info."); |
271 | Notice("quit - equivalent to shutdown."); | 271 | Notice("quit - equivalent to shutdown."); |
272 | 272 | ||
273 | Notice("set log level [level] - change the console logging level only. For example, off or debug."); | 273 | Notice("set log level [level] - change the console logging level only. For example, off or debug."); |
274 | Notice("show info - show server information (e.g. startup path)."); | 274 | Notice("show info - show server information (e.g. startup path)."); |
275 | 275 | ||
276 | if (m_stats != null) | 276 | if (m_stats != null) |
@@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers | |||
280 | Notice("show uptime - show server startup time and uptime."); | 280 | Notice("show uptime - show server startup time and uptime."); |
281 | Notice("show version - show server version."); | 281 | Notice("show version - show server version."); |
282 | Notice("shutdown - shutdown the server.\n"); | 282 | Notice("shutdown - shutdown the server.\n"); |
283 | 283 | ||
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | } | 286 | } |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 2061ab9..fb62504 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim | |||
56 | 56 | ||
57 | private string m_timedScript = "disabled"; | 57 | private string m_timedScript = "disabled"; |
58 | private Timer m_scriptTimer; | 58 | private Timer m_scriptTimer; |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// List of Console Plugin Commands | 61 | /// List of Console Plugin Commands |
62 | /// </summary> | 62 | /// </summary> |
@@ -601,11 +601,11 @@ namespace OpenSim | |||
601 | break; | 601 | break; |
602 | } | 602 | } |
603 | } | 603 | } |
604 | 604 | ||
605 | public override void ShowHelp(string[] helpArgs) | 605 | public override void ShowHelp(string[] helpArgs) |
606 | { | 606 | { |
607 | base.ShowHelp(helpArgs); | 607 | base.ShowHelp(helpArgs); |
608 | 608 | ||
609 | m_console.Notice("alert - send alert to a designated user or all users."); | 609 | m_console.Notice("alert - send alert to a designated user or all users."); |
610 | m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | 610 | m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); |
611 | m_console.Notice(" alert general [Message] - send an alert to all users."); | 611 | m_console.Notice(" alert general [Message] - send an alert to all users."); |
@@ -619,7 +619,7 @@ namespace OpenSim | |||
619 | m_console.Notice(" debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False"); | 619 | m_console.Notice(" debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False"); |
620 | m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); | 620 | m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); |
621 | m_console.Notice("export-map [filename] - save image of world map"); | 621 | m_console.Notice("export-map [filename] - save image of world map"); |
622 | m_console.Notice("force-update - force an update of prims in the scene"); | 622 | m_console.Notice("force-update - force an update of prims in the scene"); |
623 | m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); | 623 | m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); |
624 | m_console.Notice("remove-region [name] - remove a region"); | 624 | m_console.Notice("remove-region [name] - remove a region"); |
625 | m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); | 625 | m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); |
@@ -637,15 +637,15 @@ namespace OpenSim | |||
637 | m_console.Notice("config set section field value - set a config value"); | 637 | m_console.Notice("config set section field value - set a config value"); |
638 | m_console.Notice("config get section field - get a config value"); | 638 | m_console.Notice("config get section field - get a config value"); |
639 | m_console.Notice("config save - save OpenSim.ini"); | 639 | m_console.Notice("config save - save OpenSim.ini"); |
640 | m_console.Notice("terrain help - show help for terrain commands."); | 640 | m_console.Notice("terrain help - show help for terrain commands."); |
641 | 641 | ||
642 | ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); | 642 | ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); |
643 | 643 | ||
644 | if (m_sandbox) | 644 | if (m_sandbox) |
645 | { | 645 | { |
646 | m_console.Notice(""); | 646 | m_console.Notice(""); |
647 | m_console.Notice("create user - adds a new user."); | 647 | m_console.Notice("create user - adds a new user."); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | 650 | ||
651 | // see BaseOpenSimServer | 651 | // see BaseOpenSimServer |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ef66e93..059255f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -457,7 +457,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
457 | public void Close(bool shutdownCircuit) | 457 | public void Close(bool shutdownCircuit) |
458 | { | 458 | { |
459 | m_clientPingTimer.Enabled = false; | 459 | m_clientPingTimer.Enabled = false; |
460 | 460 | ||
461 | m_log.DebugFormat( | 461 | m_log.DebugFormat( |
462 | "[CLIENT]: Close has been called with shutdownCircuit = {0} on scene {1}", | 462 | "[CLIENT]: Close has been called with shutdownCircuit = {0} on scene {1}", |
463 | shutdownCircuit, m_scene.RegionInfo.RegionName); | 463 | shutdownCircuit, m_scene.RegionInfo.RegionName); |
@@ -658,15 +658,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
658 | || (m_probesWithNoIngressPackets > 90 && m_clientBlocked)) | 658 | || (m_probesWithNoIngressPackets > 90 && m_clientBlocked)) |
659 | { | 659 | { |
660 | m_clientPingTimer.Enabled = false; | 660 | m_clientPingTimer.Enabled = false; |
661 | 661 | ||
662 | m_log.WarnFormat( | 662 | m_log.WarnFormat( |
663 | "[CLIENT]: Client for agent {0} {1} has stopped responding to pings. Closing connection", | 663 | "[CLIENT]: Client for agent {0} {1} has stopped responding to pings. Closing connection", |
664 | Name, AgentId); | 664 | Name, AgentId); |
665 | 665 | ||
666 | if (OnConnectionClosed != null) | 666 | if (OnConnectionClosed != null) |
667 | { | 667 | { |
668 | OnConnectionClosed(this); | 668 | OnConnectionClosed(this); |
669 | } | 669 | } |
670 | } | 670 | } |
671 | else | 671 | else |
672 | { | 672 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 2775241..3071110 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -168,7 +168,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
168 | ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item); | 168 | ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item); |
169 | break; | 169 | break; |
170 | case ThrottleOutPacketType.Task: | 170 | case ThrottleOutPacketType.Task: |
171 | if((item.throttleType & ThrottleOutPacketType.LowPriority) != 0) | 171 | if ((item.throttleType & ThrottleOutPacketType.LowPriority) != 0) |
172 | ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item); | 172 | ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item); |
173 | else | 173 | else |
174 | ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); | 174 | ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); |
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs index 7a1c516..38c52f0 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | |||
@@ -97,7 +97,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
97 | DrawObjectVolume(m_scene, mapbmp); | 97 | DrawObjectVolume(m_scene, mapbmp); |
98 | } | 98 | } |
99 | 99 | ||
100 | |||
101 | try | 100 | try |
102 | { | 101 | { |
103 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); | 102 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); |
@@ -153,14 +152,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
153 | // if (entity is SceneObjectGroup) | 152 | // if (entity is SceneObjectGroup) |
154 | // { | 153 | // { |
155 | // SceneObjectGroup sog = (SceneObjectGroup) entity; | 154 | // SceneObjectGroup sog = (SceneObjectGroup) entity; |
156 | // | 155 | // |
157 | // foreach (SceneObjectPart primitive in sog.Children.Values) | 156 | // foreach (SceneObjectPart primitive in sog.Children.Values) |
158 | // { | 157 | // { |
159 | // int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); | 158 | // int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); |
160 | // int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); | 159 | // int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); |
161 | // int w = (int) primitive.Scale.X; | 160 | // int w = (int) primitive.Scale.X; |
162 | // int h = (int) primitive.Scale.Y; | 161 | // int h = (int) primitive.Scale.Y; |
163 | // | 162 | // |
164 | // int dx; | 163 | // int dx; |
165 | // for (dx = x; dx < x + w; dx++) | 164 | // for (dx = x; dx < x + w; dx++) |
166 | // { | 165 | // { |
@@ -171,7 +170,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
171 | // continue; | 170 | // continue; |
172 | // if (x >= map.Width || y >= map.Height) | 171 | // if (x >= map.Width || y >= map.Height) |
173 | // continue; | 172 | // continue; |
174 | // | 173 | // |
175 | // map.SetPixel(dx, dy, Color.DarkGray); | 174 | // map.SetPixel(dx, dy, Color.DarkGray); |
176 | // } | 175 | // } |
177 | // } | 176 | // } |
@@ -189,7 +188,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
189 | 188 | ||
190 | double[,] hm = whichScene.Heightmap.GetDoubles(); | 189 | double[,] hm = whichScene.Heightmap.GetDoubles(); |
191 | bool ShadowDebugContinue = true; | 190 | bool ShadowDebugContinue = true; |
192 | 191 | ||
193 | bool terraincorruptedwarningsaid = false; | 192 | bool terraincorruptedwarningsaid = false; |
194 | 193 | ||
195 | float low = 255; | 194 | float low = 255; |
@@ -220,13 +219,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
220 | //int tc = System.Environment.TickCount; | 219 | //int tc = System.Environment.TickCount; |
221 | for (int y = 0; y < 256; y++) | 220 | for (int y = 0; y < 256; y++) |
222 | { | 221 | { |
223 | |||
224 | float heightvalue = (float)hm[x, y]; | 222 | float heightvalue = (float)hm[x, y]; |
225 | 223 | ||
226 | |||
227 | if (heightvalue > (float)whichScene.RegionInfo.RegionSettings.WaterHeight) | 224 | if (heightvalue > (float)whichScene.RegionInfo.RegionSettings.WaterHeight) |
228 | { | 225 | { |
229 | |||
230 | // scale height value | 226 | // scale height value |
231 | heightvalue = low + mid * (heightvalue - low) / mid; | 227 | heightvalue = low + mid * (heightvalue - low) / mid; |
232 | 228 | ||
@@ -238,6 +234,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
238 | 234 | ||
239 | if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) | 235 | if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) |
240 | heightvalue = 0; | 236 | heightvalue = 0; |
237 | |||
241 | try | 238 | try |
242 | { | 239 | { |
243 | Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue); | 240 | Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue); |
@@ -264,7 +261,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
264 | 261 | ||
265 | if (hfdiff > 0.3f) | 262 | if (hfdiff > 0.3f) |
266 | { | 263 | { |
267 | |||
268 | } | 264 | } |
269 | else if (hfdiff < -0.3f) | 265 | else if (hfdiff < -0.3f) |
270 | { | 266 | { |
@@ -301,15 +297,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
301 | mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade); | 297 | mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade); |
302 | } | 298 | } |
303 | } | 299 | } |
304 | |||
305 | |||
306 | } | 300 | } |
307 | |||
308 | } | 301 | } |
309 | |||
310 | |||
311 | |||
312 | |||
313 | } | 302 | } |
314 | catch (System.ArgumentException) | 303 | catch (System.ArgumentException) |
315 | { | 304 | { |
@@ -367,7 +356,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
367 | return mapbmp; | 356 | return mapbmp; |
368 | } | 357 | } |
369 | 358 | ||
370 | |||
371 | private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) | 359 | private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) |
372 | { | 360 | { |
373 | int tc = 0; | 361 | int tc = 0; |
@@ -395,7 +383,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
395 | if (part == null) | 383 | if (part == null) |
396 | continue; | 384 | continue; |
397 | 385 | ||
398 | |||
399 | // Draw if the object is at least 1 meter wide in any direction | 386 | // Draw if the object is at least 1 meter wide in any direction |
400 | if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f) | 387 | if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f) |
401 | { | 388 | { |
@@ -459,8 +446,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
459 | continue; | 446 | continue; |
460 | 447 | ||
461 | // skip prim in non-finite position | 448 | // skip prim in non-finite position |
462 | if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) || Single.IsInfinity(pos.X) | 449 | if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) || |
463 | || Single.IsInfinity(pos.Y)) | 450 | Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y)) |
464 | continue; | 451 | continue; |
465 | 452 | ||
466 | // Figure out if object is under 256m above the height of the terrain | 453 | // Figure out if object is under 256m above the height of the terrain |
@@ -481,7 +468,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
481 | Vector3 scale = new Vector3(); | 468 | Vector3 scale = new Vector3(); |
482 | Vector3 tScale = new Vector3(); | 469 | Vector3 tScale = new Vector3(); |
483 | Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); | 470 | Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); |
484 | |||
485 | 471 | ||
486 | LLQuaternion llrot = part.GetWorldRotation(); | 472 | LLQuaternion llrot = part.GetWorldRotation(); |
487 | Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); | 473 | Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); |
@@ -609,7 +595,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
609 | FaceC[3] = vertexes[7]; | 595 | FaceC[3] = vertexes[7]; |
610 | FaceD[5] = vertexes[7]; | 596 | FaceD[5] = vertexes[7]; |
611 | #endregion | 597 | #endregion |
612 | 598 | ||
613 | //int wy = 0; | 599 | //int wy = 0; |
614 | 600 | ||
615 | //bool breakYN = false; // If we run into an error drawing, break out of the | 601 | //bool breakYN = false; // If we run into an error drawing, break out of the |
@@ -618,14 +604,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
618 | ds.brush = new SolidBrush(mapdotspot); | 604 | ds.brush = new SolidBrush(mapdotspot); |
619 | //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY); | 605 | //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY); |
620 | 606 | ||
621 | |||
622 | ds.trns = new face[FaceA.Length]; | 607 | ds.trns = new face[FaceA.Length]; |
623 | 608 | ||
624 | |||
625 | |||
626 | for (int i = 0; i < FaceA.Length; i++) | 609 | for (int i = 0; i < FaceA.Length; i++) |
627 | { | 610 | { |
628 | |||
629 | Point[] working = new Point[5]; | 611 | Point[] working = new Point[5]; |
630 | working[0] = project(FaceA[i], axPos); | 612 | working[0] = project(FaceA[i], axPos); |
631 | working[1] = project(FaceB[i], axPos); | 613 | working[1] = project(FaceB[i], axPos); |
@@ -635,20 +617,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
635 | 617 | ||
636 | face workingface = new face(); | 618 | face workingface = new face(); |
637 | workingface.pts = working; | 619 | workingface.pts = working; |
638 | 620 | ||
639 | ds.trns[i] = workingface; | 621 | ds.trns[i] = workingface; |
640 | |||
641 | } | 622 | } |
642 | 623 | ||
643 | |||
644 | |||
645 | |||
646 | z_sort.Add(part.LocalId, ds); | 624 | z_sort.Add(part.LocalId, ds); |
647 | z_localIDs.Add(part.LocalId); | 625 | z_localIDs.Add(part.LocalId); |
648 | z_sortheights.Add(pos.Z); | 626 | z_sortheights.Add(pos.Z); |
649 | 627 | ||
650 | |||
651 | |||
652 | //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) | 628 | //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) |
653 | //{ | 629 | //{ |
654 | //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) | 630 | //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) |
@@ -676,20 +652,17 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
676 | } // loop over group children | 652 | } // loop over group children |
677 | } // entitybase is sceneobject group | 653 | } // entitybase is sceneobject group |
678 | } // foreach loop over entities | 654 | } // foreach loop over entities |
679 | 655 | ||
680 | float[] sortedZHeights = z_sortheights.ToArray(); | 656 | float[] sortedZHeights = z_sortheights.ToArray(); |
681 | uint[] sortedlocalIds = z_localIDs.ToArray(); | 657 | uint[] sortedlocalIds = z_localIDs.ToArray(); |
682 | 658 | ||
683 | // Sort prim by Z position | 659 | // Sort prim by Z position |
684 | Array.Sort(sortedZHeights, sortedlocalIds); | 660 | Array.Sort(sortedZHeights, sortedlocalIds); |
685 | 661 | ||
686 | |||
687 | |||
688 | Graphics g = Graphics.FromImage(mapbmp); | 662 | Graphics g = Graphics.FromImage(mapbmp); |
689 | 663 | ||
690 | for (int s = 0; s < sortedZHeights.Length; s++) | 664 | for (int s = 0; s < sortedZHeights.Length; s++) |
691 | { | 665 | { |
692 | |||
693 | if (z_sort.ContainsKey(sortedlocalIds[s])) | 666 | if (z_sort.ContainsKey(sortedlocalIds[s])) |
694 | { | 667 | { |
695 | DrawStruct rectDrawStruct = z_sort[sortedlocalIds[s]]; | 668 | DrawStruct rectDrawStruct = z_sort[sortedlocalIds[s]]; |
@@ -701,13 +674,13 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
701 | } | 674 | } |
702 | } | 675 | } |
703 | 676 | ||
704 | |||
705 | g.Dispose(); | 677 | g.Dispose(); |
706 | } // lock entities objs | 678 | } // lock entities objs |
707 | 679 | ||
708 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (System.Environment.TickCount - tc) + " ms"); | 680 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (System.Environment.TickCount - tc) + " ms"); |
709 | return mapbmp; | 681 | return mapbmp; |
710 | } | 682 | } |
683 | |||
711 | private Point project(Vector3 point3d, Vector3 originpos) | 684 | private Point project(Vector3 point3d, Vector3 originpos) |
712 | { | 685 | { |
713 | Point returnpt = new Point(); | 686 | Point returnpt = new Point(); |
@@ -716,12 +689,11 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
716 | 689 | ||
717 | //Vector3 topos = new Vector3(0, 0, 0); | 690 | //Vector3 topos = new Vector3(0, 0, 0); |
718 | // float z = -point3d.z - topos.z; | 691 | // float z = -point3d.z - topos.z; |
719 | 692 | ||
720 | returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d); | 693 | returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d); |
721 | returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d))); | 694 | returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d))); |
722 | 695 | ||
723 | return returnpt; | 696 | return returnpt; |
724 | |||
725 | } | 697 | } |
726 | 698 | ||
727 | // TODO: unused: | 699 | // TODO: unused: |
@@ -729,17 +701,17 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
729 | // private Bitmap TerrainToBitmap(string gradientmap) | 701 | // private Bitmap TerrainToBitmap(string gradientmap) |
730 | // { | 702 | // { |
731 | // Bitmap gradientmapLd = new Bitmap(gradientmap); | 703 | // Bitmap gradientmapLd = new Bitmap(gradientmap); |
732 | // | 704 | // |
733 | // int pallete = gradientmapLd.Height; | 705 | // int pallete = gradientmapLd.Height; |
734 | // | 706 | // |
735 | // Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); | 707 | // Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); |
736 | // Color[] colours = new Color[pallete]; | 708 | // Color[] colours = new Color[pallete]; |
737 | // | 709 | // |
738 | // for (int i = 0; i < pallete; i++) | 710 | // for (int i = 0; i < pallete; i++) |
739 | // { | 711 | // { |
740 | // colours[i] = gradientmapLd.GetPixel(0, i); | 712 | // colours[i] = gradientmapLd.GetPixel(0, i); |
741 | // } | 713 | // } |
742 | // | 714 | // |
743 | // lock (m_scene.Heightmap) | 715 | // lock (m_scene.Heightmap) |
744 | // { | 716 | // { |
745 | // ITerrainChannel copy = m_scene.Heightmap; | 717 | // ITerrainChannel copy = m_scene.Heightmap; |
@@ -749,7 +721,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
749 | // { | 721 | // { |
750 | // // 512 is the largest possible height before colours clamp | 722 | // // 512 is the largest possible height before colours clamp |
751 | // int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); | 723 | // int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); |
752 | // | 724 | // |
753 | // // Handle error conditions | 725 | // // Handle error conditions |
754 | // if (colorindex > pallete - 1 || colorindex < 0) | 726 | // if (colorindex > pallete - 1 || colorindex < 0) |
755 | // bmp.SetPixel(x, copy.Height - y - 1, Color.Red); | 727 | // bmp.SetPixel(x, copy.Height - y - 1, Color.Red); |