Compare commits
617 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 94619cba58 | |||
| 519c753e46 | |||
| 96a2449122 | |||
| 1f40630a9a | |||
| 427240f935 | |||
| 376fab1402 | |||
| af286d5fcb | |||
| 2d3072f053 | |||
| 3f35c5a421 | |||
| 70953dbfcd | |||
| a3bd708e77 | |||
| b4ce71df1e | |||
| e271607bef | |||
| 41f2f3132b | |||
| e4d16e6795 | |||
| 73e20b7f5f | |||
| 0692ebfbc6 | |||
| 4b04d22899 | |||
| 6e6512eb4a | |||
| 29400538b7 | |||
| b08ab1e375 | |||
| e19d1ecce8 | |||
| 40c579addf | |||
| 3e5bc75f89 | |||
| e8ca900ef8 | |||
| ac866a1c46 | |||
| d582db6132 | |||
| 473c559478 | |||
| bb7c88805a | |||
| 4d8bc007e2 | |||
| 0cc3cdfb4e | |||
| a02dae566c | |||
| 099212167b | |||
| 1b75ec5647 | |||
| 3555c0c3f3 | |||
| 305c3e668a | |||
| 1a3ffda852 | |||
| f132f642b2 | |||
| b1ff78f4d8 | |||
| bafa82eb12 | |||
| 42bb122232 | |||
| 64f640f901 | |||
| aeadddf77a | |||
| fabab7414f | |||
| 0cb805a64c | |||
| 709038aa2a | |||
| d899bdcb9b | |||
| f129b824c3 | |||
| 4e03d352c3 | |||
| 298376d5c7 | |||
| ce74418c20 | |||
| 88b2fc61ff | |||
| 84cea46c10 | |||
| b375f86f11 | |||
| 321816b32c | |||
| 3a643e2456 | |||
| 1d2933ca51 | |||
| e0c6bfa81e | |||
| 91e1aaa5d4 | |||
| 626536b8cc | |||
| 4c781db572 | |||
| 6ea82ad48a | |||
| dabb8e62f4 | |||
| bc0895c758 | |||
| 0d2a25b477 | |||
| 0db6f3a2bd | |||
| 21176a3a90 | |||
| f1f935ed95 | |||
| f1cec684e2 | |||
| fbdf507e98 | |||
| 37921c66e5 | |||
| 8738445eb7 | |||
| 30f1b424bb | |||
| 36f01dce2d | |||
| 91f3be71e3 | |||
| a483525016 | |||
| 2924d250ab | |||
| 10a8d2852e | |||
| e36e416637 | |||
| 78ccadb27e | |||
| 961cb9cc77 | |||
| dc2471fedd | |||
| 0e71e3889c | |||
| fcc665a567 | |||
| e57e9e95d4 | |||
| d6890d78ad | |||
| de3421b408 | |||
| 7cec4997db | |||
| dfd0c2a54a | |||
| 6ab463a446 | |||
| cac910d401 | |||
| 50ed97aa1a | |||
| 6c4eed5539 | |||
| 3ec695e05b | |||
| e0d8f42e6b | |||
| a4107cb6c7 | |||
| fcf5fb5dfd | |||
| 0f87a99e54 | |||
| 5cd21516a4 | |||
| f54fccba1e | |||
| 3654ae8d8c | |||
| df816b38ac | |||
| f6f7585ec5 | |||
| 9c804466e5 | |||
| 327632dc66 | |||
| 56a623ac0c | |||
| 1e3027afb1 | |||
| c0c92a95bf | |||
| 8c5c9806d7 | |||
| 46781253c3 | |||
| e85291329b | |||
| cc61681484 | |||
| 086bc6f748 | |||
| 3a87cce2e0 | |||
| 36920adb96 | |||
| 3c6becd524 | |||
| 3355bedaeb | |||
| 200dcee1b7 | |||
| 1a9c14b041 | |||
| 4a9282e681 | |||
| 899bcb7acd | |||
| 712c50e0bf | |||
| feacae173e | |||
| 4804edf77f | |||
| 2d034e20c4 | |||
| 11031abf26 | |||
| 6b57b61836 | |||
| 4c5d7d4683 | |||
| b481711fa6 | |||
| 05cacf6eb6 | |||
| f94b3bbe0f | |||
| 3cb31e9685 | |||
| 46c1d4e319 | |||
| 470161ae2e | |||
| af3498efdb | |||
| 5d53412766 | |||
| 0d70033a5d | |||
| 528704bc04 | |||
| a57b4b81b9 | |||
| f6ea5088f4 | |||
| 48d1cca303 | |||
| 9fa8d84598 | |||
| 99ac770abb | |||
| b81187db5a | |||
| aa8b44c001 | |||
| 738c60459c | |||
| d1b7c2ece3 | |||
| 29d5950838 | |||
| 4dc0aaa03f | |||
| 1bdf0bed9c | |||
| 6048dfcd71 | |||
| a26d1ffc66 | |||
| 9be935ac6d | |||
| f0853139d5 | |||
| cfbfca6447 | |||
| 1daec26ba0 | |||
| e455374a4b | |||
| 8cd7ca568d | |||
| d62acc7e37 | |||
| 0c8f3dddd8 | |||
| e008d54cd4 | |||
| 4e92b55231 | |||
| 2766bf3fef | |||
| 15b38f0036 | |||
| d7b9260496 | |||
| 6d3b409af2 | |||
| fea18a909f | |||
| a8860d79d8 | |||
| 8ae5ab809f | |||
| ba233008cd | |||
| 108978be1e | |||
| 63b5c11b9c | |||
| 219d273418 | |||
| bb9071e5f0 | |||
| 869191a51d | |||
| b019fd5a95 | |||
| 82a5d00bc8 | |||
| dac8703949 | |||
| 78c155cd12 | |||
| 4b73268cbd | |||
| 3d70db4a58 | |||
| 6e0e35cd66 | |||
| 20b47fce07 | |||
| 82b875317b | |||
| 60ad72357e | |||
| d99c8e68a7 | |||
| d0782c2bc0 | |||
| 9643792b34 | |||
| 4ba396b81c | |||
| c3923a1aa6 | |||
| 889194db63 | |||
| fe6dab7f13 | |||
| cd031d129a | |||
| 9d2789aff8 | |||
| abf85b7f19 | |||
| a93799d03b | |||
| ca2379ee83 | |||
| 481b7c71c3 | |||
| c90b986d8b | |||
| 3fe9c7c49d | |||
| 4651cd1f50 | |||
| f348928590 | |||
| 3cbdf3bfe0 | |||
| 7b2f125fb6 | |||
| a0d6705fe6 | |||
| db0c41501c | |||
| ff892b5bcf | |||
| 5450b1b024 | |||
| 602587b8d5 | |||
| b59812b4e3 | |||
| 4374ce9fbf | |||
| 696df33e5c | |||
| c5f7184d1b | |||
| dcd8e74584 | |||
| 7f0adfd203 | |||
| 31096fb1fe | |||
| 807fb8339b | |||
| e86c765be3 | |||
| c915791824 | |||
| 7f45ac72e1 | |||
| 8956cdc55f | |||
| 3552cfb1a5 | |||
| 0dc14b5f35 | |||
| 74cda2ad78 | |||
| 2766b37d8b | |||
| b913f1c8ab | |||
| fe779128b0 | |||
| 90de9df3e8 | |||
| 733763c4e2 | |||
| 5bb95a8a55 | |||
| 30cde52634 | |||
| 278530bf04 | |||
| c1bdd22274 | |||
| f8fe4dee8f | |||
| 77913eb679 | |||
| 0aa0dad478 | |||
| 3aa99b9a7f | |||
| 14a31c3e9b | |||
| 94d0ae0d91 | |||
| 0eaca7aafb | |||
| 2ff9ea3f80 | |||
| a2ea844494 | |||
| 0300ec45eb | |||
| 22dade6463 | |||
| db5a42ffac | |||
| eaf595c008 | |||
| d6f9f690e5 | |||
| 02a53665c9 | |||
| bf5320eb26 | |||
| 3c992b028c | |||
| a755c57b44 | |||
| 9ced61fbc2 | |||
| 0eede1467f | |||
| 35c7fb2038 | |||
| 8656b5e948 | |||
| 1efaf0c85c | |||
| 27597463da | |||
| c32ccfb520 | |||
| 9ca86664bb | |||
| 464d31b70b | |||
| 5622cf68aa | |||
| 394ec508f6 | |||
| bcaacb4e41 | |||
| d131c57978 | |||
| 987c56984d | |||
| e19c830a6c | |||
| fab0389cb1 | |||
| d2877b9cd4 | |||
| b778bd9423 | |||
| 449548d7a4 | |||
| 33cc847c4a | |||
| 5aeaa7fcdd | |||
| e68867c9b6 | |||
| 1fa3a6f1bd | |||
| ff9da24465 | |||
| 227685bea4 | |||
| 20f20895cf | |||
| 9bae636ff0 | |||
| cf95b65c10 | |||
| 250ea09328 | |||
| b3a496d6f2 | |||
| f55e153636 | |||
| fbcb76383d | |||
| 72c67c5091 | |||
| 5015b0b485 | |||
| c78a8271c4 | |||
| fbed245596 | |||
| 174df94172 | |||
| 3fbaef9275 | |||
| 16bf38e1ab | |||
| f8b8241239 | |||
| bffc9ad184 | |||
| 15b50ae737 | |||
| 65a135f4d3 | |||
| 1b156b7fe8 | |||
| b7c7293c7a | |||
| f7b2aa0f49 | |||
| 04aa13a086 | |||
| 251b93d97e | |||
| a1b291c889 | |||
| 5b433e101d | |||
| d93275745b | |||
| 32070fa5f4 | |||
| 9479f64778 | |||
| 5ec3429843 | |||
| 77a331fce3 | |||
| b46be88db6 | |||
| 3a6f312484 | |||
| 47b84875fd | |||
| 78733b979f | |||
| dd30a29ba0 | |||
| 882af7195c | |||
| 96e5836b50 | |||
| ab1472e5b7 | |||
| 922f76a3a7 | |||
| 0be9e3b079 | |||
| 4a74c4533c | |||
| d2c738fc09 | |||
| 6dc1b113d0 | |||
| d32d25634d | |||
| 7c12dfe185 | |||
| 2f7539a25b | |||
| 0c0ee95bd8 | |||
| c23d37a509 | |||
| 4569c595bf | |||
| 484aa72ff8 | |||
| 8ad29fc5c8 | |||
| 87e2668529 | |||
| 515d373a8e | |||
| bbc1dc6bce | |||
| 8457044b2f | |||
| 19d8f05584 | |||
| 7db4336f1c | |||
| faf9ba53fc | |||
| bf8f64e40e | |||
| 73891c7fd3 | |||
| 667a272cce | |||
| f41809e07d | |||
| afb938e579 | |||
| a31393ba0b | |||
| a845c1a893 | |||
| 093705efd1 | |||
| f4cba27105 | |||
| 3db9b847bf | |||
| 2b33677402 | |||
| 812f5e124d | |||
| 2fbafc7465 | |||
| e44450cce1 | |||
| 78015bbbdc | |||
| 9e83b43009 | |||
| 8b3c2f7d0c | |||
| cecb446e0e | |||
| 0faba7dc33 | |||
| e245638f24 | |||
| c9742c826d | |||
| 539165e6bd | |||
| 95eeb4dde8 | |||
| ef262799ca | |||
| 614b9e14c4 | |||
| eb79c882ea | |||
| 1e5cff32fc | |||
| df49196e17 | |||
| 0fe08c8799 | |||
| 7862d1e20d | |||
| 13b2ac1425 | |||
| 7f570636f8 | |||
| 5a10da3ee8 | |||
| 53b72ab4b8 | |||
| 3a2c099169 | |||
| c31d93cb6f | |||
| f0411dc128 | |||
| 7c121a2acc | |||
| f0eeb47262 | |||
| 44f533d95a | |||
| 7bb673a854 | |||
| 5d01a1ff4d | |||
| 253110293a | |||
| 5fc61942e0 | |||
| d4eee213a9 | |||
| 2dbc18054e | |||
| 88f7a833dc | |||
| 06e4fcd260 | |||
| df89e15290 | |||
| 63aea3a5f2 | |||
| cb8c3ba023 | |||
| 2e216aa056 | |||
| 9664273df6 | |||
| 2227f51b29 | |||
| 38acda9f29 | |||
| 904baa6da6 | |||
| a108fcac95 | |||
| 2572ed9ed9 | |||
| cf54df3ecf | |||
| 1d9a9e6004 | |||
| 0d898d8d8a | |||
| 463d0b2f8f | |||
| bc06db3df4 | |||
| e8a2eff2e8 | |||
| d62f0bc35d | |||
| d15a3b10a3 | |||
| 6efc203ce8 | |||
| d1865c526d | |||
| 98c1940820 | |||
| 5dc0298f83 | |||
| 7180690a14 | |||
| 0b743045ef | |||
| 5092cbd77e | |||
| cb1f2886cd | |||
| 7a5699224e | |||
| 328bc3b76e | |||
| b01e73cf27 | |||
| 7eb12f96ec | |||
| 2506b3d89e | |||
| 018832522c | |||
| ca78c8326e | |||
| 998d7009a6 | |||
| 617bc4710a | |||
| 2c9859314f | |||
| eb5bfd14fa | |||
| 85f4357ce6 | |||
| a893fd90cd | |||
| 93a9ed2a6d | |||
| 4cac87d9f4 | |||
| 538ff31b28 | |||
| 06db136fbc | |||
| acc2c42a79 | |||
| b065c02661 | |||
| bc969a6b46 | |||
| 3f76f72137 | |||
| 52f8669169 | |||
| 853c0fccc8 | |||
| 090f9bcece | |||
| 3185db7f94 | |||
| a780e01a54 | |||
| 63fd027494 | |||
| b3ebec184f | |||
| e1dd228f18 | |||
| c8914d22eb | |||
| 574a11558d | |||
| 5d964a6424 | |||
| 18b91fdbe9 | |||
| f0998a9222 | |||
| 7c148d9b2f | |||
| de0ab04d00 | |||
| 530c86335d | |||
| 562a3cb338 | |||
| 32ad66c274 | |||
| c725ad1577 | |||
| 06e0528d0b | |||
| cf1686335f | |||
| af406748a2 | |||
| e00f1a0410 | |||
| 86105a1533 | |||
| c0fd09b445 | |||
| 85d51e57a9 | |||
| 55cc8044cb | |||
| f3508649f5 | |||
| abe0f4a088 | |||
| d4acaf25af | |||
| cacbb5c165 | |||
| 86a2cd915c | |||
| 2c00b73cd2 | |||
| 8b8e1b88ec | |||
| aec723b955 | |||
| 6b1d09813e | |||
| 50eec6df52 | |||
| 3c5b7d7b79 | |||
| 4aa483777b | |||
| 672bd9fc98 | |||
| 01daa74adf | |||
| 6d2893be67 | |||
| 65c4cb48ac | |||
| 9406db3047 | |||
| e756457703 | |||
| 6ac9c9c972 | |||
| 91b7679db9 | |||
| 17929abd28 | |||
| 5cb4044539 | |||
| e6d0dcd4e8 | |||
| 2051535ce1 | |||
| 0301c81b01 | |||
| 9211361b19 | |||
| 6b65895736 | |||
| 559c66afe6 | |||
| aa217cf90f | |||
| bbfda8e19e | |||
| fad0fd7f75 | |||
| d1c3f8eef5 | |||
| ac16a667e1 | |||
| 7bafee28fa | |||
| 46095c058e | |||
| e5a5b69b08 | |||
| 43eab5e163 | |||
| 444737c830 | |||
| 7cb1690589 | |||
| 0af8886400 | |||
| 4cbd45f3d5 | |||
| 59d0e3c3c8 | |||
| 635f3f77ab | |||
| 6557eba235 | |||
| 1fe504fee5 | |||
| f360b687d6 | |||
| ba5a236922 | |||
| 20640357ab | |||
| 45ada5ca2d | |||
| 9c7b28341c | |||
| a15282f023 | |||
| 161c827a44 | |||
| 76add0fdb0 | |||
| af54e6f370 | |||
| e7fa8a4699 | |||
| 262892336b | |||
| 1247174db4 | |||
| de941d2ec7 | |||
| b0bae62c30 | |||
| 7a4c5b067d | |||
| 6c447f892e | |||
| 5e8dfb4f7e | |||
| 7a47c15edb | |||
| 14a7ddb885 | |||
| 2fbb906ff6 | |||
| 62a03a5cac | |||
| d3387d591a | |||
| cffea984f1 | |||
| 99308d64c6 | |||
| 6d1d58b654 | |||
| 14836e60ff | |||
| 9aec36156e | |||
| fce3fca7f9 | |||
| 542bef20e8 | |||
| dba33fee39 | |||
| b1d8aa0b64 | |||
| 8ecab21b37 | |||
| 368b29a680 | |||
| f90aee696a | |||
| f901a38204 | |||
| 4289b71141 | |||
| e131e73652 | |||
| 84d7227dfd | |||
| b13214af27 | |||
| e735f76553 | |||
| 4031933475 | |||
| 8555e54e22 | |||
| 7c0ebcb984 | |||
| 091f3a8000 | |||
| e12c044eab | |||
| 8276a9e5f7 | |||
| 6a477e044d | |||
| 1769e93c42 | |||
| 1a32b35279 | |||
| 305f5110c6 | |||
| 35078e03e5 | |||
| 5fd9411143 | |||
| 0ff61341e4 | |||
| 8cec0b3fa1 | |||
| 1b30ae81b5 | |||
| b9e0d0fdb2 | |||
| 1d4551e52f | |||
| c8583e566d | |||
| a2dd8f31de | |||
| 6edc446780 | |||
| bf68dbabd7 | |||
| 89945f8829 | |||
| edc04d4184 | |||
| 5b2af7f99e | |||
| df9845a283 | |||
| 7496d0b0f7 | |||
| 4bccfed80c | |||
| eaf99bf928 | |||
| f5ae36d7e2 | |||
| 425d76bb98 | |||
| 921f0052f4 | |||
| 6734b94761 | |||
| 773ffcafc3 | |||
| 62b3bdf0fc | |||
| b0cb0ec02f | |||
| 81c9952e99 | |||
| db83208794 | |||
| ff5c38534d | |||
| 58d7e3b8ed | |||
| 949139eb0b | |||
| fe16a72a9a | |||
| 58def34dbe | |||
| d4dad75a3c | |||
| ebe7726cd7 | |||
| a4d322dcd1 | |||
| ccf18fd2ef | |||
| 3d0778bcd6 | |||
| a5800f479e | |||
| 178a5a5585 | |||
| 6664079f84 | |||
| fb312279c9 | |||
| f8caf41bd8 | |||
| 47e7febebc | |||
| 33ae733006 | |||
| da25903300 | |||
| 7f027552ec | |||
| d04bb3ca9b | |||
| bd6f734d3a | |||
| b5f94c72b9 | |||
| 220ea9f687 | |||
| 61353dde80 | |||
| cf97535d9e | |||
| 52b7b40034 | |||
| 1497b75361 | |||
| 9858766516 | |||
| e6080a38c5 | |||
| 1d0a9e521c | |||
| fad1d70180 | |||
| 9e0d419239 | |||
| eed343ed8a | |||
| 7df325c275 | |||
| fdcd392582 | |||
| f27766d47b | |||
| a660c0a750 | |||
| 8ce3fa646b | |||
| e82d394ddf |
@@ -54,6 +54,7 @@ bin/Regions/*
|
||||
bin/UserAssets
|
||||
bin/assetcache
|
||||
bin/maptiles
|
||||
bin/bakes
|
||||
bin/estate_settings.xml
|
||||
bin/config-include/CenomeCache.ini
|
||||
bin/config-include/FlotsamCache.ini
|
||||
|
||||
+5
-1
@@ -19,10 +19,14 @@ Prereqs:
|
||||
|
||||
From the distribution type:
|
||||
* ./runprebuild.sh
|
||||
* nant (or xbuild)
|
||||
* nant (or !* xbuild)
|
||||
* cd bin
|
||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||
* run mono OpenSim.exe
|
||||
!* xbuild option switches
|
||||
!* clean: xbuild /target:clean
|
||||
!* debug: (default) xbuild /property:Configuration=Debug
|
||||
!* release: xbuild /property:Configuration=Release
|
||||
|
||||
# Using Monodevelop
|
||||
|
||||
|
||||
+18
-7
@@ -9,13 +9,15 @@ people that make the day to day of OpenSim happen.
|
||||
* dahlia
|
||||
* Melanie Thielker
|
||||
* Diva (Crista Lopes, University of California, Irvine)
|
||||
* Dan Lake (Intel)
|
||||
* Dan Lake
|
||||
* Marck
|
||||
* Mic Bowman (Intel)
|
||||
* Mic Bowman
|
||||
* BlueWall (James Hughes)
|
||||
* Nebadon Izumi (Michael Cerquoni, OSgrid)
|
||||
* Snoopy Pfeffer
|
||||
* Robert Adams (Intel)
|
||||
* Robert Adams
|
||||
* Oren Hurvitz (Kitely)
|
||||
* Kevin Cozens
|
||||
|
||||
= Core Developers Following the White Rabbit =
|
||||
Core developers who have temporarily (we hope) gone chasing the white rabbit.
|
||||
@@ -66,24 +68,29 @@ what it is today.
|
||||
* alex_carnell
|
||||
* Alan Webb (IBM)
|
||||
* Aleric
|
||||
* Alicia Raven
|
||||
* Allen Kerensky
|
||||
* BigFootAg
|
||||
* BlueWall Slade
|
||||
* bobshaffer2
|
||||
* brianw/Sir_Ahzz
|
||||
* CharlieO
|
||||
* ChrisDown
|
||||
* Chris Yeoh (IBM)
|
||||
* cinderblocks
|
||||
* controlbreak
|
||||
* coyled
|
||||
* ctrlaltdavid (David Rowe)
|
||||
* Daedius
|
||||
* daTwitch
|
||||
* Dev Random
|
||||
* devalnor-#708
|
||||
* dmiles (Daxtron Labs)
|
||||
* Dong Jun Lan (IBM)
|
||||
* DoranZemlja
|
||||
* dr0b3rts
|
||||
* dslake (Intel)
|
||||
* dslake
|
||||
* eeyore
|
||||
* FredoChaplin
|
||||
* Garmin Kawaguichi
|
||||
* Gerhard
|
||||
@@ -97,10 +104,12 @@ what it is today.
|
||||
* Flyte Xevious
|
||||
* Garmin Kawaguichi
|
||||
* Gryc Ueusp
|
||||
* H-H-H (ginge264)
|
||||
* Hiro Lecker
|
||||
* Iain Oliver
|
||||
* Imaze Rhiano
|
||||
* Intimidated
|
||||
* Jak Daniels
|
||||
* Jeremy Bongio (IBM)
|
||||
* jhurliman
|
||||
* John R Sohn (XenReborn)
|
||||
@@ -108,27 +117,30 @@ what it is today.
|
||||
* Jon Cundill
|
||||
* Junta Kohime
|
||||
* Kayne
|
||||
* Kevin Cozens
|
||||
* kinoc (Daxtron Labs)
|
||||
* Kira
|
||||
* Kitto Flora
|
||||
* KittyLiu
|
||||
* Kurt Taylor (IBM)
|
||||
* Lani Global
|
||||
* lillith_xue
|
||||
* lkalif
|
||||
* LuciusSirnah
|
||||
* lulurun
|
||||
* M.Igarashi
|
||||
* maimedleech
|
||||
* Mana Janus
|
||||
* MarcelEdward
|
||||
* Matt Lehmann
|
||||
* Mic Bowman
|
||||
* Michelle Argus
|
||||
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
||||
* Micheil Merlin
|
||||
* Mike Osias (IBM)
|
||||
* Mike Pitman (IBM)
|
||||
* mikemig
|
||||
* mikkopa/_someone - RealXtend
|
||||
* Misterblue (Intel)
|
||||
* Misterblue
|
||||
* Mircea Kitsune
|
||||
* mpallari
|
||||
* MrMonkE
|
||||
@@ -137,7 +149,6 @@ what it is today.
|
||||
* nornalbion
|
||||
* Omar Vera Ustariz (IBM)
|
||||
* openlifegrid.com
|
||||
* Oren Hurvitz (Kitely)
|
||||
* otakup0pe
|
||||
* Pixel Tomsen
|
||||
* ralphos
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace OpenSim.Groups
|
||||
if (dict.ContainsKey("ServiceLocation") && dict["ServiceLocation"] != null)
|
||||
grec.ServiceLocation = dict["ServiceLocation"].ToString();
|
||||
else
|
||||
grec.GroupName = string.Empty;
|
||||
grec.ServiceLocation = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("ShownInList") && dict["ShownInList"] != null)
|
||||
grec.ShowInList = bool.Parse(dict["ShownInList"].ToString());
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace OpenSim.Groups
|
||||
private IGroupsServicesConnector m_groupData = null;
|
||||
|
||||
// Config Options
|
||||
private bool m_groupMessagingEnabled = false;
|
||||
private bool m_debugEnabled = true;
|
||||
private bool m_groupMessagingEnabled;
|
||||
private bool m_debugEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, module only tries to send group IMs to online users by querying cached presence information.
|
||||
@@ -110,9 +110,17 @@ namespace OpenSim.Groups
|
||||
m_messageOnlineAgentsOnly = groupsConfig.GetBoolean("MessageOnlineUsersOnly", false);
|
||||
|
||||
if (m_messageOnlineAgentsOnly)
|
||||
{
|
||||
m_usersOnlineCache = new ExpiringCache<UUID, PresenceInfo[]>();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[Groups.Messaging]: GroupsMessagingModule V2 requires MessageOnlineUsersOnly = true");
|
||||
m_groupMessagingEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
||||
m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[Groups.Messaging]: GroupsMessagingModule enabled with MessageOnlineOnly = {0}, DebugEnabled = {1}",
|
||||
@@ -132,6 +140,14 @@ namespace OpenSim.Groups
|
||||
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||
scene.EventManager.OnClientLogin += OnClientLogin;
|
||||
|
||||
scene.AddCommand(
|
||||
"Debug",
|
||||
this,
|
||||
"debug groups messaging verbose",
|
||||
"debug groups messaging verbose <true|false>",
|
||||
"This setting turns on very verbose groups messaging debugging",
|
||||
HandleDebugGroupsMessagingVerbose);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
@@ -219,6 +235,26 @@ namespace OpenSim.Groups
|
||||
|
||||
#endregion
|
||||
|
||||
private void HandleDebugGroupsMessagingVerbose(object modules, string[] args)
|
||||
{
|
||||
if (args.Length < 5)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
|
||||
return;
|
||||
}
|
||||
|
||||
bool verbose = false;
|
||||
if (!bool.TryParse(args[4], out verbose))
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
|
||||
return;
|
||||
}
|
||||
|
||||
m_debugEnabled = verbose;
|
||||
|
||||
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not really needed, but does confirm that the group exists.
|
||||
/// </summary>
|
||||
@@ -247,6 +283,8 @@ namespace OpenSim.Groups
|
||||
public void SendMessageToGroup(
|
||||
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
|
||||
{
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
UUID fromAgentID = new UUID(im.fromAgentID);
|
||||
|
||||
// Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent
|
||||
@@ -260,7 +298,7 @@ namespace OpenSim.Groups
|
||||
// Sending to offline members is not an option.
|
||||
string[] t1 = groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()).ToArray();
|
||||
|
||||
// We cache in order not to overwhlem the presence service on large grids with many groups. This does
|
||||
// We cache in order not to overwhelm the presence service on large grids with many groups. This does
|
||||
// mean that members coming online will not see all group members until after m_usersOnlineCacheExpirySeconds has elapsed.
|
||||
// (assuming this is the same across all grid simulators).
|
||||
if (!m_usersOnlineCache.TryGetValue(groupID, out onlineAgents))
|
||||
@@ -279,8 +317,6 @@ namespace OpenSim.Groups
|
||||
// "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online",
|
||||
// groupID, groupMembersCount, groupMembers.Count());
|
||||
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
im.imSessionID = groupID.Guid;
|
||||
im.fromGroup = true;
|
||||
IClientAPI thisClient = GetActiveClient(fromAgentID);
|
||||
@@ -289,6 +325,13 @@ namespace OpenSim.Groups
|
||||
im.RegionID = thisClient.Scene.RegionInfo.RegionID.Guid;
|
||||
}
|
||||
|
||||
if ((im.binaryBucket == null) || (im.binaryBucket.Length == 0) || ((im.binaryBucket.Length == 1 && im.binaryBucket[0] == 0)))
|
||||
{
|
||||
ExtendedGroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), groupID, null);
|
||||
if (groupInfo != null)
|
||||
im.binaryBucket = Util.StringToBytes256(groupInfo.GroupName);
|
||||
}
|
||||
|
||||
// Send to self first of all
|
||||
im.toAgentID = im.fromAgentID;
|
||||
im.fromGroup = true;
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace OpenSim.Groups
|
||||
{
|
||||
scene.RegisterModuleInterface<IGroupsModule>(this);
|
||||
scene.AddCommand(
|
||||
"debug",
|
||||
"Debug",
|
||||
this,
|
||||
"debug groups verbose",
|
||||
"debug groups verbose <true|false>",
|
||||
@@ -496,12 +496,13 @@ namespace OpenSim.Groups
|
||||
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
|
||||
|
||||
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
|
||||
string message;
|
||||
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
|
||||
giver, notice.noticeData.AttachmentItemID);
|
||||
giver, notice.noticeData.AttachmentItemID, out message);
|
||||
|
||||
if (itemCopy == null)
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false);
|
||||
remoteClient.SendAgentAlertMessage(message, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1295,7 +1296,7 @@ namespace OpenSim.Groups
|
||||
presence.Grouptitle = Title;
|
||||
|
||||
if (! presence.IsChildAgent)
|
||||
presence.SendAvatarDataToAllAgents();
|
||||
presence.SendAvatarDataToAllClients();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
@@ -32,6 +32,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
@@ -560,7 +561,7 @@ namespace OpenSim.Groups
|
||||
|
||||
// so we have the list of urls to send the notice to
|
||||
// this may take a long time...
|
||||
Util.FireAndForget(delegate
|
||||
Watchdog.RunInThread(delegate
|
||||
{
|
||||
foreach (string u in urls)
|
||||
{
|
||||
@@ -571,7 +572,7 @@ namespace OpenSim.Groups
|
||||
hasAttachment, attType, attName, attItemID, AgentUUIForOutside(attOwnerID));
|
||||
}
|
||||
}
|
||||
});
|
||||
}, string.Format("AddGroupNotice (agent {0}, group {1})", RequestingAgentID, groupID) , null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
@@ -158,7 +158,7 @@ namespace OpenSim.Groups
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[Groups.RobustHGConnector]: Exception {0}", e.StackTrace);
|
||||
m_log.Error(string.Format("[Groups.RobustHGConnector]: Exception {0} ", e.Message), e);
|
||||
}
|
||||
|
||||
return FailureResult();
|
||||
@@ -209,11 +209,13 @@ namespace OpenSim.Groups
|
||||
string agentID = request["AgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
|
||||
m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token);
|
||||
if (!m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token))
|
||||
NullResult(result, "Internal error");
|
||||
else
|
||||
result["RESULT"] = "true";
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||
result["RESULT"] = "true";
|
||||
return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ using Mono.Addins;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
[assembly: Addin("OpenSim.Groups", "0.1")]
|
||||
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||
|
||||
@@ -32,27 +32,47 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
public class GroupsServiceRemoteConnector
|
||||
public class GroupsServiceRemoteConnector
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ServerURI;
|
||||
private IServiceAuth m_Auth;
|
||||
private object m_Lock = new object();
|
||||
|
||||
public GroupsServiceRemoteConnector(string url)
|
||||
public GroupsServiceRemoteConnector(IConfigSource config)
|
||||
{
|
||||
IConfig groupsConfig = config.Configs["Groups"];
|
||||
string url = groupsConfig.GetString("GroupsServerURI", string.Empty);
|
||||
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
|
||||
|
||||
m_ServerURI = url;
|
||||
if (!m_ServerURI.EndsWith("/"))
|
||||
m_ServerURI += "/";
|
||||
|
||||
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}", m_ServerURI);
|
||||
/// This is from BaseServiceConnector
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Groups" }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
m_Auth = new BasicHttpAuthentication(config, "Groups");
|
||||
break;
|
||||
}
|
||||
///
|
||||
|
||||
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}",
|
||||
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
|
||||
}
|
||||
|
||||
public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
|
||||
@@ -659,7 +679,8 @@ namespace OpenSim.Groups
|
||||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "groups",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData),
|
||||
m_Auth);
|
||||
|
||||
if (reply == string.Empty)
|
||||
return null;
|
||||
|
||||
@@ -72,12 +72,7 @@ namespace OpenSim.Groups
|
||||
|
||||
private void Init(IConfigSource config)
|
||||
{
|
||||
IConfig groupsConfig = config.Configs["Groups"];
|
||||
string url = groupsConfig.GetString("GroupsServerURI", string.Empty);
|
||||
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
|
||||
|
||||
m_GroupsService = new GroupsServiceRemoteConnector(url);
|
||||
m_GroupsService = new GroupsServiceRemoteConnector(config);
|
||||
m_Scenes = new List<Scene>();
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
@@ -52,14 +53,26 @@ namespace OpenSim.Groups
|
||||
public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
string key = string.Empty;
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);
|
||||
|
||||
IConfig groupsConfig = config.Configs[m_ConfigName];
|
||||
if (groupsConfig != null)
|
||||
{
|
||||
key = groupsConfig.GetString("SecretKey", string.Empty);
|
||||
m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key);
|
||||
}
|
||||
// else
|
||||
// m_log.DebugFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName);
|
||||
|
||||
m_GroupsService = new GroupsService(config);
|
||||
|
||||
server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, auth));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +82,8 @@ namespace OpenSim.Groups
|
||||
|
||||
private GroupsService m_GroupsService;
|
||||
|
||||
public GroupsServicePostHandler(GroupsService service) :
|
||||
base("POST", "/groups")
|
||||
public GroupsServicePostHandler(GroupsService service, IServiceAuth auth) :
|
||||
base("POST", "/groups", auth)
|
||||
{
|
||||
m_GroupsService = service;
|
||||
}
|
||||
@@ -96,7 +109,7 @@ namespace OpenSim.Groups
|
||||
string method = request["METHOD"].ToString();
|
||||
request.Remove("METHOD");
|
||||
|
||||
m_log.DebugFormat("[Groups.Handler]: {0}", method);
|
||||
// m_log.DebugFormat("[Groups.Handler]: {0}", method);
|
||||
switch (method)
|
||||
{
|
||||
case "PUTGROUP":
|
||||
@@ -140,7 +153,7 @@ namespace OpenSim.Groups
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[GROUPS HANDLER]: Exception {0}", e.StackTrace);
|
||||
m_log.Error(string.Format("[GROUPS HANDLER]: Exception {0} ", e.Message), e);
|
||||
}
|
||||
|
||||
return FailureResult();
|
||||
@@ -272,11 +285,13 @@ namespace OpenSim.Groups
|
||||
string agentID = request["AgentID"].ToString();
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
|
||||
m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID);
|
||||
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
|
||||
NullResult(result, string.Format("Insufficient permissions.", agentID));
|
||||
else
|
||||
result["RESULT"] = "true";
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||
result["RESULT"] = "true";
|
||||
return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
|
||||
}
|
||||
|
||||
@@ -652,7 +667,11 @@ namespace OpenSim.Groups
|
||||
GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(),
|
||||
new UUID(request["InviteID"].ToString()));
|
||||
|
||||
result["RESULT"] = GroupsDataUtils.GroupInviteInfo(invite);
|
||||
if (invite != null)
|
||||
result["RESULT"] = GroupsDataUtils.GroupInviteInfo(invite);
|
||||
else
|
||||
result["RESULT"] = "NULL";
|
||||
|
||||
return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
|
||||
}
|
||||
|
||||
@@ -784,6 +803,14 @@ namespace OpenSim.Groups
|
||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
||||
}
|
||||
|
||||
private byte[] FailureResult(string reason)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
NullResult(result, reason);
|
||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,8 @@ namespace OpenSim.Groups
|
||||
data.Data["ShowInList"] = showInList ? "1" : "0";
|
||||
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
|
||||
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
|
||||
data.Data["OwnerRoleID"] = UUID.Random().ToString();
|
||||
UUID roleID = UUID.Random();
|
||||
data.Data["OwnerRoleID"] = roleID.ToString();
|
||||
|
||||
if (!m_Database.StoreGroup(data))
|
||||
return UUID.Zero;
|
||||
@@ -159,7 +160,6 @@ namespace OpenSim.Groups
|
||||
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group", "Member of " + name, (ulong)DefaultEveryonePowers, true);
|
||||
|
||||
// Create Owner role
|
||||
UUID roleID = UUID.Random();
|
||||
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, roleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
|
||||
|
||||
// Add founder to group
|
||||
@@ -247,6 +247,9 @@ namespace OpenSim.Groups
|
||||
if (group == null)
|
||||
return members;
|
||||
|
||||
// Unfortunately this doesn't quite work on legacy group data because of a bug
|
||||
// that's also being fixed here on CreateGroup. The OwnerRoleID sent to the DB was wrong.
|
||||
// See how to find the ownerRoleID a few lines below.
|
||||
UUID ownerRoleID = new UUID(group.Data["OwnerRoleID"]);
|
||||
|
||||
RoleData[] roles = m_Database.RetrieveRoles(GroupID);
|
||||
@@ -255,6 +258,11 @@ namespace OpenSim.Groups
|
||||
return members;
|
||||
List<RoleData> rolesList = new List<RoleData>(roles);
|
||||
|
||||
// Let's find the "real" ownerRoleID
|
||||
RoleData ownerRole = rolesList.Find(r => r.Data["Powers"] == ((long)OwnerPowers).ToString());
|
||||
if (ownerRole != null)
|
||||
ownerRoleID = ownerRole.RoleID;
|
||||
|
||||
// Check visibility?
|
||||
// When we don't want to check visibility, we pass it "all" as the requestingAgentID
|
||||
bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
|
||||
@@ -291,17 +299,17 @@ namespace OpenSim.Groups
|
||||
{
|
||||
m.Title = selected.Data["Title"];
|
||||
m.AgentPowers = UInt64.Parse(selected.Data["Powers"]);
|
||||
|
||||
m.AgentID = d.PrincipalID;
|
||||
m.AcceptNotices = d.Data["AcceptNotices"] == "1" ? true : false;
|
||||
m.Contribution = Int32.Parse(d.Data["Contribution"]);
|
||||
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
|
||||
|
||||
// Is this person an owner of the group?
|
||||
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
|
||||
|
||||
members.Add(m);
|
||||
}
|
||||
|
||||
m.AgentID = d.PrincipalID;
|
||||
m.AcceptNotices = d.Data["AcceptNotices"] == "1" ? true : false;
|
||||
m.Contribution = Int32.Parse(d.Data["Contribution"]);
|
||||
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
|
||||
|
||||
// Is this person an owner of the group?
|
||||
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
|
||||
|
||||
members.Add(m);
|
||||
}
|
||||
|
||||
return members;
|
||||
@@ -393,13 +401,15 @@ namespace OpenSim.Groups
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
{
|
||||
// check perms
|
||||
if (RequestingAgentID != AgentID && !HasPower(RequestingAgentID, GroupID, GroupPowers.Eject))
|
||||
return;
|
||||
return false;
|
||||
|
||||
_RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID)
|
||||
|
||||
@@ -131,19 +131,27 @@ namespace OpenSim.Groups
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token)
|
||||
public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token)
|
||||
{
|
||||
// check the token
|
||||
MembershipData membership = m_Database.RetrieveMember(GroupID, AgentID);
|
||||
if (membership != null)
|
||||
{
|
||||
if (token != string.Empty && token.Equals(membership.Data["AccessToken"]))
|
||||
RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
|
||||
{
|
||||
return RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[Groups.HGGroupsService]: access token {0} did not match stored one {1}", token, membership.Data["AccessToken"]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[Groups.HGGroupsService]: membership not found for {0}", AgentID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string groupName, string token)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.OfflineIM
|
||||
if (serviceLocation == string.Empty)
|
||||
m_OfflineIMService = new OfflineIMService(config);
|
||||
else
|
||||
m_OfflineIMService = new OfflineIMServiceRemoteConnector(serviceLocation);
|
||||
m_OfflineIMService = new OfflineIMServiceRemoteConnector(config);
|
||||
|
||||
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
||||
m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name);
|
||||
@@ -226,10 +226,6 @@ namespace OpenSim.OfflineIM
|
||||
return;
|
||||
}
|
||||
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
string reason = string.Empty;
|
||||
bool success = m_OfflineIMService.StoreMessage(im, out reason);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ using Mono.Addins;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
[assembly: Addin("OpenSim.OfflineIM", "0.1")]
|
||||
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||
|
||||
@@ -32,6 +32,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
@@ -46,6 +47,7 @@ namespace OpenSim.OfflineIM
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ServerURI = string.Empty;
|
||||
private IServiceAuth m_Auth;
|
||||
private object m_Lock = new object();
|
||||
|
||||
public OfflineIMServiceRemoteConnector(string url)
|
||||
@@ -65,6 +67,18 @@ namespace OpenSim.OfflineIM
|
||||
|
||||
m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty);
|
||||
|
||||
/// This is from BaseServiceConnector
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Messaging" }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
m_Auth = new BasicHttpAuthentication(config, "Messaging");
|
||||
break;
|
||||
}
|
||||
///
|
||||
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
|
||||
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
|
||||
}
|
||||
|
||||
#region IOfflineIMService
|
||||
@@ -82,8 +96,13 @@ namespace OpenSim.OfflineIM
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
return ims;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
string result = ret["RESULT"].ToString();
|
||||
if (result == "NULL" || result.ToLower() == "false")
|
||||
{
|
||||
string reason = ret.ContainsKey("REASON") ? ret["REASON"].ToString() : "Unknown error";
|
||||
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: GetMessages for {0} failed: {1}", principalID, reason);
|
||||
return ims;
|
||||
}
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
{
|
||||
@@ -110,7 +129,7 @@ namespace OpenSim.OfflineIM
|
||||
string result = ret["RESULT"].ToString();
|
||||
if (result == "NULL" || result.ToLower() == "false")
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
reason = ret.ContainsKey("REASON") ? ret["REASON"].ToString() : "Unknown error";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,7 +157,8 @@ namespace OpenSim.OfflineIM
|
||||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/offlineim",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData),
|
||||
m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
||||
@@ -36,6 +36,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
@@ -59,7 +60,9 @@ namespace OpenSim.OfflineIM
|
||||
|
||||
m_OfflineIMService = new OfflineIMService(config);
|
||||
|
||||
server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService, auth));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +72,8 @@ namespace OpenSim.OfflineIM
|
||||
|
||||
private IOfflineIMService m_OfflineIMService;
|
||||
|
||||
public OfflineIMServicePostHandler(IOfflineIMService service) :
|
||||
base("POST", "/offlineim")
|
||||
public OfflineIMServicePostHandler(IOfflineIMService service, IServiceAuth auth) :
|
||||
base("POST", "/offlineim", auth)
|
||||
{
|
||||
m_OfflineIMService = service;
|
||||
}
|
||||
@@ -109,7 +112,7 @@ namespace OpenSim.OfflineIM
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[OFFLINE IM HANDLER]: Exception {0}", e.StackTrace);
|
||||
m_log.Error(string.Format("[OFFLINE IM HANDLER]: Exception {0} ", e.Message), e);
|
||||
}
|
||||
|
||||
return FailureResult();
|
||||
@@ -212,18 +215,7 @@ namespace OpenSim.OfflineIM
|
||||
|
||||
rootElement.AppendChild(result);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] DocToBytes(XmlDocument doc)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
doc.WriteTo(xw);
|
||||
xw.Flush();
|
||||
|
||||
return ms.ToArray();
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace OpenSim.OfflineIM
|
||||
using (MemoryStream mstream = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
settings.Encoding = Util.UTF8NoBomEncoding;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(mstream, settings))
|
||||
{
|
||||
@@ -112,7 +112,7 @@ namespace OpenSim.OfflineIM
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
imXml = Util.UTF8.GetString(mstream.ToArray());
|
||||
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
|
||||
}
|
||||
|
||||
OfflineIMData data = new OfflineIMData();
|
||||
|
||||
@@ -39,6 +39,7 @@ using OpenSim.Region.CoreModules.Avatar.InstantMessage;
|
||||
using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
|
||||
using OpenSim.Region.CoreModules.Scripting.LoadImageURL;
|
||||
using OpenSim.Region.CoreModules.Scripting.XMLRPC;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
{
|
||||
@@ -130,7 +131,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
createdScenes.Add(scene);
|
||||
|
||||
if (changed)
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
m_openSim.EstateDataService.StoreEstateSettings(regionsToLoad[i].EstateSettings);
|
||||
}
|
||||
|
||||
foreach (IScene scene in createdScenes)
|
||||
|
||||
@@ -62,4 +62,4 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("0.7.6.*")]
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
+53
-34
@@ -32,6 +32,7 @@ using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenSim;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
@@ -45,6 +46,12 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Controls whether we load modules from Mono.Addins.
|
||||
/// </summary>
|
||||
/// <remarks>For debug purposes. Defaults to true.</remarks>
|
||||
public bool LoadModulesFromAddins { get; set; }
|
||||
|
||||
// Config access
|
||||
private OpenSimBase m_openSim;
|
||||
|
||||
@@ -61,6 +68,11 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
private List<ISharedRegionModule> m_sharedInstances =
|
||||
new List<ISharedRegionModule>();
|
||||
|
||||
public RegionModulesControllerPlugin()
|
||||
{
|
||||
LoadModulesFromAddins = true;
|
||||
}
|
||||
|
||||
#region IApplicationPlugin implementation
|
||||
|
||||
public void Initialise (OpenSimBase openSim)
|
||||
@@ -69,6 +81,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
|
||||
m_log.DebugFormat("[REGIONMODULES]: Initializing...");
|
||||
|
||||
if (!LoadModulesFromAddins)
|
||||
return;
|
||||
|
||||
// Who we are
|
||||
string id = AddinManager.CurrentAddin.Id;
|
||||
|
||||
@@ -88,40 +103,8 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
Dictionary<RuntimeAddin, IList<int>> loadedModules = new Dictionary<RuntimeAddin, IList<int>>();
|
||||
|
||||
// Scan modules and load all that aren't disabled
|
||||
foreach (TypeExtensionNode node in
|
||||
AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
|
||||
{
|
||||
IList<int> loadedModuleData;
|
||||
|
||||
if (!loadedModules.ContainsKey(node.Addin))
|
||||
loadedModules.Add(node.Addin, new List<int> { 0, 0, 0 });
|
||||
|
||||
loadedModuleData = loadedModules[node.Addin];
|
||||
|
||||
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_sharedModules.Add(node);
|
||||
loadedModuleData[0]++;
|
||||
}
|
||||
}
|
||||
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_nonSharedModules.Add(node);
|
||||
loadedModuleData[1]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
||||
loadedModuleData[2]++;
|
||||
}
|
||||
}
|
||||
foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
|
||||
AddNode(node, modulesConfig, loadedModules);
|
||||
|
||||
foreach (KeyValuePair<RuntimeAddin, IList<int>> loadedModuleData in loadedModules)
|
||||
{
|
||||
@@ -194,6 +177,41 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
|
||||
#region IPlugin implementation
|
||||
|
||||
private void AddNode(
|
||||
TypeExtensionNode node, IConfig modulesConfig, Dictionary<RuntimeAddin, IList<int>> loadedModules)
|
||||
{
|
||||
IList<int> loadedModuleData;
|
||||
|
||||
if (!loadedModules.ContainsKey(node.Addin))
|
||||
loadedModules.Add(node.Addin, new List<int> { 0, 0, 0 });
|
||||
|
||||
loadedModuleData = loadedModules[node.Addin];
|
||||
|
||||
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_sharedModules.Add(node);
|
||||
loadedModuleData[0]++;
|
||||
}
|
||||
}
|
||||
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_nonSharedModules.Add(node);
|
||||
loadedModuleData[1]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
||||
loadedModuleData[2]++;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't do that here
|
||||
//
|
||||
public void Initialise ()
|
||||
@@ -215,6 +233,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||
m_sharedInstances[0].Close();
|
||||
m_sharedInstances.RemoveAt(0);
|
||||
}
|
||||
|
||||
m_sharedModules.Clear();
|
||||
m_nonSharedModules.Clear();
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -162,6 +162,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
|
||||
availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
|
||||
|
||||
// Land management
|
||||
availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand);
|
||||
|
||||
// Either enable full remote functionality or just selected features
|
||||
string enabledMethods = m_config.GetString("enabled_methods", "all");
|
||||
|
||||
@@ -694,7 +697,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
region.EstateSettings.EstateName = (string) requestData["estate_name"];
|
||||
region.EstateSettings.EstateOwner = userID;
|
||||
// Persistence does not seem to effect the need to save a new estate
|
||||
region.EstateSettings.Save();
|
||||
m_application.EstateDataService.StoreEstateSettings(region.EstateSettings);
|
||||
|
||||
if (!m_application.EstateDataService.LinkRegion(region.RegionID, (int) region.EstateSettings.EstateID))
|
||||
throw new Exception("Failed to join estate.");
|
||||
@@ -724,7 +727,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
// If an access specification was provided, use it.
|
||||
// Otherwise accept the default.
|
||||
newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
|
||||
newScene.RegionInfo.EstateSettings.Save();
|
||||
m_application.EstateDataService.StoreEstateSettings(newScene.RegionInfo.EstateSettings);
|
||||
|
||||
// enable voice on newly created region if
|
||||
// requested by either the XmlRpc request or the
|
||||
@@ -910,7 +913,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
scene.RegionInfo.EstateSettings.PublicAccess =
|
||||
GetBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess);
|
||||
if (scene.RegionInfo.Persistent)
|
||||
scene.RegionInfo.EstateSettings.Save();
|
||||
m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
|
||||
|
||||
if (requestData.ContainsKey("enable_voice"))
|
||||
{
|
||||
@@ -1792,7 +1795,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{};
|
||||
|
||||
if (scene.RegionInfo.Persistent)
|
||||
scene.RegionInfo.EstateSettings.Save();
|
||||
m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
|
||||
|
||||
m_log.Info("[RADMIN]: Access List Clear Request complete");
|
||||
}
|
||||
@@ -1838,7 +1841,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
}
|
||||
scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray();
|
||||
if (scene.RegionInfo.Persistent)
|
||||
scene.RegionInfo.EstateSettings.Save();
|
||||
m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
|
||||
}
|
||||
|
||||
responseData["added"] = addedUsers;
|
||||
@@ -1887,7 +1890,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
}
|
||||
scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray();
|
||||
if (scene.RegionInfo.Persistent)
|
||||
scene.RegionInfo.EstateSettings.Save();
|
||||
m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
|
||||
}
|
||||
|
||||
responseData["removed"] = removedUsers;
|
||||
@@ -2063,6 +2066,56 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
responseData["success"] = true;
|
||||
}
|
||||
|
||||
private void XmlRpcResetLand(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
string musicURL = string.Empty;
|
||||
UUID groupID = UUID.Zero;
|
||||
uint flags = 0;
|
||||
bool set_group = false, set_music = false, set_flags = false;
|
||||
|
||||
if (requestData.Contains("group") && requestData["group"] != null)
|
||||
set_group = UUID.TryParse(requestData["group"].ToString(), out groupID);
|
||||
if (requestData.Contains("music") && requestData["music"] != null)
|
||||
{
|
||||
musicURL = requestData["music"].ToString();
|
||||
set_music = true;
|
||||
}
|
||||
if (requestData.Contains("flags") && requestData["flags"] != null)
|
||||
set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags);
|
||||
|
||||
m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}",
|
||||
(set_group ? groupID.ToString() : "unchanged"),
|
||||
(set_music ? musicURL : "unchanged"),
|
||||
(set_flags ? flags.ToString() : "unchanged"));
|
||||
|
||||
m_application.SceneManager.ForEachScene(delegate(Scene s)
|
||||
{
|
||||
List<ILandObject> parcels = s.LandChannel.AllParcels();
|
||||
foreach (ILandObject p in parcels)
|
||||
{
|
||||
if (set_music)
|
||||
p.LandData.MusicURL = musicURL;
|
||||
|
||||
if (set_group)
|
||||
p.LandData.GroupID = groupID;
|
||||
|
||||
if (set_flags)
|
||||
p.LandData.Flags = flags;
|
||||
|
||||
s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
responseData["success"] = true;
|
||||
|
||||
m_log.Info("[RADMIN]: Reset Land Request complete");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parse a float with the given parameter name from a request data hash table.
|
||||
/// </summary>
|
||||
@@ -2238,7 +2291,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
{
|
||||
account.ServiceURLs = new Dictionary<string, object>();
|
||||
account.ServiceURLs["HomeURI"] = string.Empty;
|
||||
account.ServiceURLs["GatekeeperURI"] = string.Empty;
|
||||
account.ServiceURLs["InventoryServerURI"] = string.Empty;
|
||||
account.ServiceURLs["AssetServerURI"] = string.Empty;
|
||||
}
|
||||
|
||||
@@ -56,12 +56,15 @@ namespace OpenSim.Capabilities.Handlers
|
||||
public const string DefaultFormat = "x-j2c";
|
||||
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
private string m_RedirectURL = null;
|
||||
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description)
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description, string redirectURL)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_assetService = assService;
|
||||
m_RedirectURL = redirectURL;
|
||||
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
|
||||
m_RedirectURL += "/";
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
@@ -134,7 +137,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if (format != DefaultFormat)
|
||||
fullID = fullID + "-" + format;
|
||||
|
||||
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
||||
if (!String.IsNullOrEmpty(m_RedirectURL))
|
||||
{
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
@@ -150,8 +153,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
else
|
||||
{
|
||||
string textureUrl = REDIRECT_URL + textureID.ToString();
|
||||
string textureUrl = m_RedirectURL + "?texture_id="+ textureID.ToString();
|
||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
|
||||
httpResponse.RedirectLocation = textureUrl;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,10 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
string rurl = serverConfig.GetString("GetTextureRedirectURL");
|
||||
;
|
||||
server.AddStreamHandler(
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null));
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null, rurl));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||
// Overkill - we only really need the asset service, not a whole scene.
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null);
|
||||
GetTextureHandler handler = new GetTextureHandler("/gettexture", scene.AssetService, "TestGetTexture", null, null);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012");
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -68,7 +68,10 @@ namespace OpenSim.Framework.Capabilities
|
||||
/// <returns></returns>
|
||||
public static object LLSDDeserialize(byte[] b)
|
||||
{
|
||||
return LLSDDeserialize(new MemoryStream(b, false));
|
||||
using (MemoryStream ms = new MemoryStream(b, false))
|
||||
{
|
||||
return LLSDDeserialize(ms);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -78,21 +81,23 @@ namespace OpenSim.Framework.Capabilities
|
||||
/// <returns></returns>
|
||||
public static object LLSDDeserialize(Stream st)
|
||||
{
|
||||
XmlTextReader reader = new XmlTextReader(st);
|
||||
reader.Read();
|
||||
SkipWS(reader);
|
||||
using (XmlTextReader reader = new XmlTextReader(st))
|
||||
{
|
||||
reader.Read();
|
||||
SkipWS(reader);
|
||||
|
||||
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected <llsd>");
|
||||
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected <llsd>");
|
||||
|
||||
reader.Read();
|
||||
object ret = LLSDParseOne(reader);
|
||||
SkipWS(reader);
|
||||
reader.Read();
|
||||
object ret = LLSDParseOne(reader);
|
||||
SkipWS(reader);
|
||||
|
||||
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected </llsd>");
|
||||
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected </llsd>");
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -37,9 +37,8 @@ namespace OpenSim.Data
|
||||
public abstract class AssetDataBase : IAssetDataPlugin
|
||||
{
|
||||
public abstract AssetBase GetAsset(UUID uuid);
|
||||
|
||||
public abstract void StoreAsset(AssetBase asset);
|
||||
public abstract bool ExistsAsset(UUID uuid);
|
||||
public abstract bool[] AssetsExist(UUID[] uuids);
|
||||
|
||||
public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenSim.Data
|
||||
{
|
||||
AssetBase GetAsset(UUID uuid);
|
||||
void StoreAsset(AssetBase asset);
|
||||
bool ExistsAsset(UUID uuid);
|
||||
bool[] AssetsExist(UUID[] uuids);
|
||||
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
void Initialise(string connect);
|
||||
bool Delete(string id);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
public interface IEstateDataStore
|
||||
{
|
||||
@@ -52,12 +52,12 @@ namespace OpenSim.Data
|
||||
public int sizeY;
|
||||
|
||||
/// <summary>
|
||||
/// Return the x-coordinate of this region.
|
||||
/// Return the x-coordinate of this region in region units.
|
||||
/// </summary>
|
||||
public int coordX { get { return (int)Util.WorldToRegionLoc((uint)posX); } }
|
||||
|
||||
/// <summary>
|
||||
/// Return the y-coordinate of this region.
|
||||
/// Return the y-coordinate of this region in region units.
|
||||
/// </summary>
|
||||
public int coordY { get { return (int)Util.WorldToRegionLoc((uint)posY); } }
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenSim.Data
|
||||
{
|
||||
AssetBase GetAsset(UUID uuid);
|
||||
void StoreAsset(AssetBase asset);
|
||||
bool ExistsAsset(UUID uuid);
|
||||
bool[] AssetsExist(UUID[] uuids);
|
||||
List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
|
||||
void Initialise(string connect);
|
||||
bool Delete(string id);
|
||||
|
||||
@@ -160,18 +160,18 @@ namespace OpenSim.Data.MSSQL
|
||||
@temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)";
|
||||
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
@@ -225,17 +225,38 @@ namespace OpenSim.Data.MSSQL
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Check if asset exist in m_database
|
||||
/// Check if the assets exist in the database.
|
||||
/// </summary>
|
||||
/// <param name="uuid"></param>
|
||||
/// <returns>true if exist.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
/// <param name="uuids">The assets' IDs</param>
|
||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (GetAsset(uuid) != null)
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
string ids = "'" + string.Join("','", uuids) + "'";
|
||||
string sql = string.Format("SELECT id FROM assets WHERE id IN ({0})", ids);
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
return true;
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
UUID id = DBGuid.FromDB(reader["id"]);
|
||||
exist.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
bool[] results = new bool[uuids.Length];
|
||||
for (int i = 0; i < uuids.Length; i++)
|
||||
results[i] = exist.Contains(uuids[i]);
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
@@ -55,7 +55,7 @@ namespace OpenSim.Data.MSSQL
|
||||
return Delete(principalID.ToString(), friend);
|
||||
}
|
||||
|
||||
public bool Delete(string principalID, string friend)
|
||||
public override bool Delete(string principalID, string friend)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace OpenSim.Data.MSSQL
|
||||
// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
|
||||
// Util.PrintCallStack();
|
||||
|
||||
string sql = "update inventoryfolders set version=version+1 where folderID = ?folderID";
|
||||
string sql = "update inventoryfolders set version=version+1 where folderID = @folderID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
{
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -331,4 +331,12 @@ ALTER TABLE dbo.estate_map ADD CONSTRAINT
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 10
|
||||
|
||||
BEGIN transaction
|
||||
|
||||
ALTER TABLE estate_settings ADD AllowLandmark tinyint NOT NULL default 1;
|
||||
ALTER TABLE estate_settings ADD AllowParcelChanges tinyint NOT NULL default 1;
|
||||
ALTER TABLE estate_settings ADD AllowSetHome tinyint NOT NULL default 1;
|
||||
|
||||
COMMIT;
|
||||
@@ -1,4 +1,4 @@
|
||||
:VERSION 1
|
||||
:VERSION 1
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
@@ -26,6 +26,14 @@ COMMIT
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE Presence ADD LastSeen DateTime
|
||||
ALTER TABLE Presence ADD LastSeen DateTime;
|
||||
|
||||
COMMIT
|
||||
COMMIT
|
||||
|
||||
:VERSION 3
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE INDEX RegionID ON Presence(RegionID);
|
||||
|
||||
COMMIT
|
||||
|
||||
@@ -1161,11 +1161,11 @@ COMMIT
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE prims ADD `PhysicsShapeType` tinyint(4) NOT NULL default '0';
|
||||
ALTER TABLE prims ADD `Density` double NOT NULL default '1000';
|
||||
ALTER TABLE prims ADD `GravityModifier` double NOT NULL default '1';
|
||||
ALTER TABLE prims ADD `Friction` double NOT NULL default '0.6';
|
||||
ALTER TABLE prims ADD `Restitution` double NOT NULL default '0.5';
|
||||
ALTER TABLE prims ADD PhysicsShapeType tinyint NOT NULL default 0;
|
||||
ALTER TABLE prims ADD Density float NOT NULL default 1000;
|
||||
ALTER TABLE prims ADD GravityModifier float NOT NULL default 1;
|
||||
ALTER TABLE prims ADD Friction float NOT NULL default 0.6;
|
||||
ALTER TABLE prims ADD Restitution float NOT NULL default 0.5;
|
||||
|
||||
COMMIT
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace OpenSim.Data.MySQL
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_connectionString;
|
||||
private object m_dbLock = new object();
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
@@ -107,47 +106,46 @@ namespace OpenSim.Data.MySQL
|
||||
override public AssetBase GetAsset(UUID assetID)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
lock (m_dbLock)
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"SELECT name, description, assetType, local, temporary, asset_flags, CreatorID, data FROM assets WHERE id=?id",
|
||||
dbcon))
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.Parameters.AddWithValue("?id", assetID.ToString());
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"SELECT name, description, assetType, local, temporary, asset_flags, CreatorID, data FROM assets WHERE id=?id",
|
||||
dbcon))
|
||||
try
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", assetID.ToString());
|
||||
|
||||
try
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
if (dbReader.Read())
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], dbReader["CreatorID"].ToString());
|
||||
asset.Data = (byte[])dbReader["data"];
|
||||
asset.Description = (string)dbReader["description"];
|
||||
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], dbReader["CreatorID"].ToString());
|
||||
asset.Data = (byte[])dbReader["data"];
|
||||
asset.Description = (string)dbReader["description"];
|
||||
|
||||
string local = dbReader["local"].ToString();
|
||||
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
|
||||
asset.Local = true;
|
||||
else
|
||||
asset.Local = false;
|
||||
string local = dbReader["local"].ToString();
|
||||
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
|
||||
asset.Local = true;
|
||||
else
|
||||
asset.Local = false;
|
||||
|
||||
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
}
|
||||
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
||||
@@ -158,145 +156,134 @@ namespace OpenSim.Data.MySQL
|
||||
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
||||
dbcon))
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
||||
dbcon))
|
||||
{
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
||||
{
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ",
|
||||
asset.FullID, asset.Name)
|
||||
, e);
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ",
|
||||
asset.FullID, asset.Name)
|
||||
, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAccessTime(AssetBase asset)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
using (cmd)
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ",
|
||||
asset.FullID, asset.Name),
|
||||
e);
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ",
|
||||
asset.FullID, asset.Name),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the asset exists in the database
|
||||
/// Check if the assets exist in the database.
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>true if it exists, false otherwise.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
/// <param name="uuidss">The assets' IDs</param>
|
||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
|
||||
bool assetExists = false;
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
lock (m_dbLock)
|
||||
string ids = "'" + string.Join("','", uuids) + "'";
|
||||
string sql = string.Format("SELECT id FROM assets WHERE id IN ({0})", ids);
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand("SELECT id FROM assets WHERE id=?id", dbcon))
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", uuid.ToString());
|
||||
|
||||
try
|
||||
while (dbReader.Read())
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
|
||||
assetExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", uuid), e);
|
||||
UUID id = DBGuid.FromDB(dbReader["id"]);
|
||||
exist.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return assetExists;
|
||||
bool[] results = new bool[uuids.Length];
|
||||
for (int i = 0; i < uuids.Length; i++)
|
||||
results[i] = exist.Contains(uuids[i]);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -311,50 +298,47 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
||||
dbcon))
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
||||
dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
while (dbReader.Read())
|
||||
{
|
||||
while (dbReader.Read())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["assetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] { };
|
||||
|
||||
retList.Add(metadata);
|
||||
}
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["assetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] { };
|
||||
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
|
||||
start, count),
|
||||
e);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
|
||||
start, count),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,17 +348,14 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public override bool Delete(string id)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,11 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
return DoLoad(cmd, regionID, create);
|
||||
EstateSettings e = DoLoad(cmd, regionID, create);
|
||||
if (!create && e.EstateID == 0) // Not found
|
||||
return null;
|
||||
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +431,10 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.AddWithValue("?EstateID", estateID);
|
||||
|
||||
return DoLoad(cmd, UUID.Zero, false);
|
||||
EstateSettings e = DoLoad(cmd, UUID.Zero, false);
|
||||
if (e.EstateID != estateID)
|
||||
return null;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,38 +45,29 @@ namespace OpenSim.Data.MySQL
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected string m_connectionString;
|
||||
protected object m_dbLock = new object();
|
||||
|
||||
protected MySqlFramework(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
// All non queries are funneled through one connection
|
||||
// to increase performance a little
|
||||
//
|
||||
protected int ExecuteNonQuery(MySqlCommand cmd)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.Connection = dbcon;
|
||||
dbcon.Open();
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
try
|
||||
{
|
||||
return cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.Message, e);
|
||||
return 0;
|
||||
}
|
||||
try
|
||||
{
|
||||
return cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.Message, e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace OpenSim.Data.MySQL
|
||||
return Delete(principalID.ToString(), friend);
|
||||
}
|
||||
|
||||
public bool Delete(string principalID, string friend)
|
||||
public override bool Delete(string principalID, string friend)
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
|
||||
@@ -86,11 +86,11 @@ namespace OpenSim.Data.MySQL
|
||||
public GroupData[] RetrieveGroups(string pattern)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pattern))
|
||||
pattern = "1 ORDER BY Name LIMIT 100";
|
||||
pattern = "1";
|
||||
else
|
||||
pattern = string.Format("Name LIKE '%{0}%' ORDER BY Name LIMIT 100", pattern);
|
||||
pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern));
|
||||
|
||||
return m_Groups.Get(pattern);
|
||||
return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern));
|
||||
}
|
||||
|
||||
public bool DeleteGroup(UUID groupID)
|
||||
|
||||
@@ -51,6 +51,15 @@ namespace OpenSim.Data.MySQL
|
||||
private static string LogHeader = "[REGION DB MYSQL]";
|
||||
|
||||
private string m_connectionString;
|
||||
|
||||
/// <summary>
|
||||
/// This lock was being used to serialize database operations when the connection was shared, but this has
|
||||
/// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead.
|
||||
/// FIXME: However, the locks remain in many places since they are effectively providing a level of
|
||||
/// transactionality. This should be replaced by more efficient database transactions which would not require
|
||||
/// unrelated operations to block each other or unrelated operations on the same tables from blocking each
|
||||
/// other.
|
||||
/// </summary>
|
||||
private object m_dbLock = new object();
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
@@ -738,95 +747,92 @@ namespace OpenSim.Data.MySQL
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
// StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
nWP.valid = true;
|
||||
}
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
nWP.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -876,124 +882,118 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1001,29 +1001,26 @@ namespace OpenSim.Data.MySQL
|
||||
#region RegionEnvironmentSettings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1031,39 +1028,33 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1071,57 +1062,55 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionSettings(RegionSettings rs)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.CommandText = "replace into regionsettings (regionUUID, " +
|
||||
"block_terraform, block_fly, allow_damage, " +
|
||||
"restrict_pushing, allow_land_resell, " +
|
||||
"allow_land_join_divide, block_show_in_search, " +
|
||||
"agent_limit, object_bonus, maturity, " +
|
||||
"disable_scripts, disable_collisions, " +
|
||||
"disable_physics, terrain_texture_1, " +
|
||||
"terrain_texture_2, terrain_texture_3, " +
|
||||
"terrain_texture_4, elevation_1_nw, " +
|
||||
"elevation_2_nw, elevation_1_ne, " +
|
||||
"elevation_2_ne, elevation_1_se, " +
|
||||
"elevation_2_se, elevation_1_sw, " +
|
||||
"elevation_2_sw, water_height, " +
|
||||
"terrain_raise_limit, terrain_lower_limit, " +
|
||||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
||||
"?Maturity, ?DisableScripts, ?DisableCollisions, " +
|
||||
"?DisablePhysics, ?TerrainTexture1, " +
|
||||
"?TerrainTexture2, ?TerrainTexture3, " +
|
||||
"?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
|
||||
"?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
|
||||
"?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
|
||||
"?WaterHeight, ?TerrainRaiseLimit, " +
|
||||
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
||||
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "replace into regionsettings (regionUUID, " +
|
||||
"block_terraform, block_fly, allow_damage, " +
|
||||
"restrict_pushing, allow_land_resell, " +
|
||||
"allow_land_join_divide, block_show_in_search, " +
|
||||
"agent_limit, object_bonus, maturity, " +
|
||||
"disable_scripts, disable_collisions, " +
|
||||
"disable_physics, terrain_texture_1, " +
|
||||
"terrain_texture_2, terrain_texture_3, " +
|
||||
"terrain_texture_4, elevation_1_nw, " +
|
||||
"elevation_2_nw, elevation_1_ne, " +
|
||||
"elevation_2_ne, elevation_1_se, " +
|
||||
"elevation_2_se, elevation_1_sw, " +
|
||||
"elevation_2_sw, water_height, " +
|
||||
"terrain_raise_limit, terrain_lower_limit, " +
|
||||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
||||
"?Maturity, ?DisableScripts, ?DisableCollisions, " +
|
||||
"?DisablePhysics, ?TerrainTexture1, " +
|
||||
"?TerrainTexture2, ?TerrainTexture3, " +
|
||||
"?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
|
||||
"?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
|
||||
"?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
|
||||
"?WaterHeight, ?TerrainRaiseLimit, " +
|
||||
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
||||
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
FillRegionSettingsCommand(cmd, rs);
|
||||
|
||||
FillRegionSettingsCommand(cmd, rs);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
SaveSpawnPoints(rs);
|
||||
}
|
||||
|
||||
@@ -2043,41 +2032,35 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string val)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
cmd.Parameters.AddWithValue("?value", val);
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
cmd.Parameters.AddWithValue("?value", val);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveExtra(UUID regionID, string name)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2086,22 +2069,19 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
Dictionary<string, string> ret = new Dictionary<string, string>();
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "select * from regionextra where RegionID=?RegionID";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
using (IDataReader r = cmd.ExecuteReader())
|
||||
{
|
||||
cmd.CommandText = "select * from regionextra where RegionID=?RegionID";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
using (IDataReader r = cmd.ExecuteReader())
|
||||
while (r.Read())
|
||||
{
|
||||
while (r.Read())
|
||||
{
|
||||
ret[r["Name"].ToString()] = r["value"].ToString();
|
||||
}
|
||||
ret[r["Name"].ToString()] = r["value"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,11 +46,6 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
protected object Lock
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
@@ -250,7 +245,7 @@ namespace OpenSim.Data.MySQL
|
||||
string query = string.Empty;
|
||||
|
||||
query += "DELETE FROM classifieds WHERE ";
|
||||
query += "classifieduuid = ?ClasifiedId";
|
||||
query += "classifieduuid = ?recordId";
|
||||
|
||||
try
|
||||
{
|
||||
@@ -260,12 +255,8 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?ClassifiedId", recordId.ToString());
|
||||
|
||||
lock(Lock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -634,8 +625,6 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
if(reader.HasRows)
|
||||
{
|
||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
||||
": Getting data for {0}.", props.UserId);
|
||||
reader.Read();
|
||||
props.WebUrl = (string)reader["profileURL"];
|
||||
UUID.TryParse((string)reader["profileImage"], out props.ImageId);
|
||||
@@ -651,9 +640,6 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
||||
": No data for {0}", props.UserId);
|
||||
|
||||
props.WebUrl = string.Empty;
|
||||
props.ImageId = UUID.Zero;
|
||||
props.AboutText = string.Empty;
|
||||
@@ -974,8 +960,8 @@ namespace OpenSim.Data.MySQL
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail);
|
||||
cmd.Parameters.AddWithValue("?Visible", pref.Visible);
|
||||
cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail.ToString().ToLower());
|
||||
cmd.Parameters.AddWithValue("?Visible", pref.Visible.ToString().ToLower());
|
||||
cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -1034,11 +1020,8 @@ namespace OpenSim.Data.MySQL
|
||||
put.Parameters.AddWithValue("?TagId", props.TagId.ToString());
|
||||
put.Parameters.AddWithValue("?DataKey", props.DataKey.ToString());
|
||||
put.Parameters.AddWithValue("?DataVal", props.DataVal.ToString());
|
||||
|
||||
lock(Lock)
|
||||
{
|
||||
put.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
put.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1074,14 +1057,11 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?UserId", props.UserId.ToString());
|
||||
cmd.Parameters.AddWithValue("?TagId", props.TagId.ToString ());
|
||||
cmd.Parameters.AddWithValue("?DataKey", props.DataKey.ToString ());
|
||||
cmd.Parameters.AddWithValue("?DataVal", props.DataKey.ToString ());
|
||||
|
||||
lock(Lock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
cmd.Parameters.AddWithValue("?TagId", props.TagId.ToString());
|
||||
cmd.Parameters.AddWithValue("?DataKey", props.DataKey.ToString());
|
||||
cmd.Parameters.AddWithValue("?DataVal", props.DataKey.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1095,5 +1075,4 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
#endregion Integration
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,7 +57,6 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
private bool m_enableCompression = false;
|
||||
private string m_connectionString;
|
||||
private object m_dbLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
|
||||
@@ -131,60 +130,58 @@ namespace OpenSim.Data.MySQL
|
||||
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
|
||||
|
||||
AssetBase asset = null;
|
||||
lock (m_dbLock)
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"SELECT Name, Description, AccessTime, AssetType, Local, Temporary, AssetFlags, CreatorID, Data FROM XAssetsMeta JOIN XAssetsData ON XAssetsMeta.Hash = XAssetsData.Hash WHERE ID=?ID",
|
||||
dbcon))
|
||||
{
|
||||
dbcon.Open();
|
||||
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"SELECT Name, Description, AccessTime, AssetType, Local, Temporary, AssetFlags, CreatorID, Data FROM XAssetsMeta JOIN XAssetsData ON XAssetsMeta.Hash = XAssetsData.Hash WHERE ID=?ID",
|
||||
dbcon))
|
||||
try
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
|
||||
|
||||
try
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
if (dbReader.Read())
|
||||
{
|
||||
if (dbReader.Read())
|
||||
asset = new AssetBase(assetID, (string)dbReader["Name"], (sbyte)dbReader["AssetType"], dbReader["CreatorID"].ToString());
|
||||
asset.Data = (byte[])dbReader["Data"];
|
||||
asset.Description = (string)dbReader["Description"];
|
||||
|
||||
string local = dbReader["Local"].ToString();
|
||||
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
|
||||
asset.Local = true;
|
||||
else
|
||||
asset.Local = false;
|
||||
|
||||
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
||||
|
||||
if (m_enableCompression)
|
||||
{
|
||||
asset = new AssetBase(assetID, (string)dbReader["Name"], (sbyte)dbReader["AssetType"], dbReader["CreatorID"].ToString());
|
||||
asset.Data = (byte[])dbReader["Data"];
|
||||
asset.Description = (string)dbReader["Description"];
|
||||
|
||||
string local = dbReader["Local"].ToString();
|
||||
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
|
||||
asset.Local = true;
|
||||
else
|
||||
asset.Local = false;
|
||||
|
||||
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
||||
|
||||
if (m_enableCompression)
|
||||
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
|
||||
{
|
||||
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
|
||||
{
|
||||
MemoryStream outputStream = new MemoryStream();
|
||||
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
|
||||
// int compressedLength = asset.Data.Length;
|
||||
asset.Data = outputStream.ToArray();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
|
||||
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
|
||||
}
|
||||
}
|
||||
MemoryStream outputStream = new MemoryStream();
|
||||
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
|
||||
// int compressedLength = asset.Data.Length;
|
||||
asset.Data = outputStream.ToArray();
|
||||
|
||||
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
|
||||
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,113 +198,110 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
// m_log.DebugFormat("[XASSETS DB]: Storing asset {0} {1}", asset.Name, asset.ID);
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlTransaction transaction = dbcon.BeginTransaction())
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlTransaction transaction = dbcon.BeginTransaction())
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
||||
{
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.WarnFormat(
|
||||
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.WarnFormat(
|
||||
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
}
|
||||
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
|
||||
m_log.WarnFormat(
|
||||
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
if (m_enableCompression)
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
|
||||
m_log.WarnFormat(
|
||||
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
}
|
||||
|
||||
if (m_enableCompression)
|
||||
{
|
||||
MemoryStream outputStream = new MemoryStream();
|
||||
|
||||
using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
|
||||
{
|
||||
MemoryStream outputStream = new MemoryStream();
|
||||
|
||||
using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
|
||||
{
|
||||
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
|
||||
// We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
|
||||
compressionStream.Close();
|
||||
byte[] compressedData = outputStream.ToArray();
|
||||
asset.Data = compressedData;
|
||||
}
|
||||
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
|
||||
// We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
|
||||
compressionStream.Close();
|
||||
byte[] compressedData = outputStream.ToArray();
|
||||
asset.Data = compressedData;
|
||||
}
|
||||
}
|
||||
|
||||
byte[] hash = hasher.ComputeHash(asset.Data);
|
||||
byte[] hash = hasher.ComputeHash(asset.Data);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
|
||||
// asset.ID, asset.Name, hash, compressedData.Length);
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO XAssetsMeta(ID, Hash, Name, Description, AssetType, Local, Temporary, CreateTime, AccessTime, AssetFlags, CreatorID)" +
|
||||
"VALUES(?ID, ?Hash, ?Name, ?Description, ?AssetType, ?Local, ?Temporary, ?CreateTime, ?AccessTime, ?AssetFlags, ?CreatorID)",
|
||||
dbcon))
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?ID", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?Hash", hash);
|
||||
cmd.Parameters.AddWithValue("?Name", assetName);
|
||||
cmd.Parameters.AddWithValue("?Description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?AssetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?Local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?Temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?CreateTime", now);
|
||||
cmd.Parameters.AddWithValue("?AccessTime", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?AssetFlags", (int)asset.Flags);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
|
||||
transaction.Rollback();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ExistsData(dbcon, transaction, hash))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO XAssetsMeta(ID, Hash, Name, Description, AssetType, Local, Temporary, CreateTime, AccessTime, AssetFlags, CreatorID)" +
|
||||
"VALUES(?ID, ?Hash, ?Name, ?Description, ?AssetType, ?Local, ?Temporary, ?CreateTime, ?AccessTime, ?AssetFlags, ?CreatorID)",
|
||||
"INSERT INTO XAssetsData(Hash, Data) VALUES(?Hash, ?Data)",
|
||||
dbcon))
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?ID", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?Hash", hash);
|
||||
cmd.Parameters.AddWithValue("?Name", assetName);
|
||||
cmd.Parameters.AddWithValue("?Description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?AssetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?Local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?Temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?CreateTime", now);
|
||||
cmd.Parameters.AddWithValue("?AccessTime", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?AssetFlags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?Data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}",
|
||||
m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
|
||||
transaction.Rollback();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ExistsData(dbcon, transaction, hash))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"INSERT INTO XAssetsData(Hash, Data) VALUES(?Hash, ?Data)",
|
||||
dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?Hash", hash);
|
||||
cmd.Parameters.AddWithValue("?Data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
|
||||
transaction.Rollback();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,31 +322,28 @@ namespace OpenSim.Data.MySQL
|
||||
if ((now - Utils.UnixTimeToDateTime(accessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
|
||||
return;
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd =
|
||||
new MySqlCommand("update XAssetsMeta set AccessTime=?AccessTime where ID=?ID", dbcon);
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd =
|
||||
new MySqlCommand("update XAssetsMeta set AccessTime=?AccessTime where ID=?ID", dbcon);
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
cmd.Parameters.AddWithValue("?ID", assetMetadata.ID);
|
||||
cmd.Parameters.AddWithValue("?AccessTime", (int)Utils.DateTimeToUnixTime(now));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
|
||||
assetMetadata.ID, assetMetadata.Name);
|
||||
// create unix epoch time
|
||||
cmd.Parameters.AddWithValue("?ID", assetMetadata.ID);
|
||||
cmd.Parameters.AddWithValue("?AccessTime", (int)Utils.DateTimeToUnixTime(now));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
|
||||
assetMetadata.ID, assetMetadata.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,45 +388,40 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the asset exists in the database
|
||||
/// Check if the assets exist in the database.
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>true if it exists, false otherwise.</returns>
|
||||
public bool ExistsAsset(UUID uuid)
|
||||
/// <param name="uuids">The asset UUID's</param>
|
||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||
public bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
|
||||
bool assetExists = false;
|
||||
HashSet<UUID> exists = new HashSet<UUID>();
|
||||
|
||||
lock (m_dbLock)
|
||||
string ids = "'" + string.Join("','", uuids) + "'";
|
||||
string sql = string.Format("SELECT ID FROM assets WHERE ID IN ({0})", ids);
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand("SELECT ID FROM XAssetsMeta WHERE ID=?ID", dbcon))
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?ID", uuid.ToString());
|
||||
|
||||
try
|
||||
while (dbReader.Read())
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
|
||||
assetExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(string.Format("[XASSETS DB]: MySql failure fetching asset {0}", uuid), e);
|
||||
UUID id = DBGuid.FromDB(dbReader["ID"]);
|
||||
exists.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return assetExists;
|
||||
bool[] results = new bool[uuids.Length];
|
||||
for (int i = 0; i < uuids.Length; i++)
|
||||
results[i] = exists.Contains(uuids[i]);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
@@ -451,43 +437,40 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon);
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon);
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
while (dbReader.Read())
|
||||
{
|
||||
while (dbReader.Read())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["Name"];
|
||||
metadata.Description = (string)dbReader["Description"];
|
||||
metadata.Type = (sbyte)dbReader["AssetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["Name"];
|
||||
metadata.Description = (string)dbReader["Description"];
|
||||
metadata.Type = (sbyte)dbReader["AssetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// We'll ignore this for now - it appears unused!
|
||||
// We'll ignore this for now - it appears unused!
|
||||
// metadata.SHA1 = dbReader["hash"]);
|
||||
|
||||
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
||||
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
||||
|
||||
retList.Add(metadata);
|
||||
}
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,21 +481,18 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
// m_log.DebugFormat("[XASSETS DB]: Deleting asset {0}", id);
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from XAssetsMeta where ID=?ID", dbcon))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from XAssetsMeta where ID=?ID", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?ID", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
|
||||
// keep a reference count (?)
|
||||
cmd.Parameters.AddWithValue("?ID", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
|
||||
// keep a reference count (?)
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
:VERSION 1 # --------------------------
|
||||
:VERSION 1 # --------------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
@@ -32,3 +32,11 @@ ALTER TABLE `im_offline`
|
||||
ADD KEY `FromID` (`FromID`);
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 4 # --------------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE im_offline CONVERT TO CHARACTER SET utf8;
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
:VERSION 1 # --------------------------
|
||||
:VERSION 1 # --------------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
@@ -21,3 +21,11 @@ BEGIN;
|
||||
ALTER TABLE `Presence` ADD COLUMN LastSeen timestamp;
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 3 # --------------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE INDEX RegionID ON Presence(RegionID);
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenSim.Data.Null
|
||||
|
||||
// private string m_connectionString;
|
||||
|
||||
private Dictionary<uint, EstateSettings> m_knownEstates = new Dictionary<uint, EstateSettings>();
|
||||
// private Dictionary<uint, EstateSettings> m_knownEstates = new Dictionary<uint, EstateSettings>();
|
||||
private EstateSettings m_estate = null;
|
||||
|
||||
private EstateSettings GetEstate()
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static NullPresenceData Instance;
|
||||
public static NullPresenceData Instance;
|
||||
|
||||
Dictionary<UUID, PresenceData> m_presenceData = new Dictionary<UUID, PresenceData>();
|
||||
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -166,18 +166,18 @@ namespace OpenSim.Data.PGSQL
|
||||
";
|
||||
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
@@ -231,17 +231,38 @@ namespace OpenSim.Data.PGSQL
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Check if asset exist in m_database
|
||||
/// Check if the assets exist in the database.
|
||||
/// </summary>
|
||||
/// <param name="uuid"></param>
|
||||
/// <returns>true if exist.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
/// <param name="uuids">The assets' IDs</param>
|
||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (GetAsset(uuid) != null)
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
string ids = "'" + string.Join("','", uuids) + "'";
|
||||
string sql = string.Format("SELECT id FROM assets WHERE id IN ({0})", ids);
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
return true;
|
||||
conn.Open();
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
UUID id = DBGuid.FromDB(reader["id"]);
|
||||
exist.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
bool[] results = new bool[uuids.Length];
|
||||
for (int i = 0; i < uuids.Length; i++)
|
||||
results[i] = exist.Contains(uuids[i]);
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenSim.Data.PGSQL
|
||||
}
|
||||
|
||||
|
||||
public bool Delete(string principalID, string friend)
|
||||
public override bool Delete(string principalID, string friend)
|
||||
{
|
||||
UUID princUUID = UUID.Zero;
|
||||
|
||||
|
||||
@@ -300,7 +300,6 @@ namespace OpenSim.Data.PGSQL
|
||||
m_Realm, where);
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
|
||||
//m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where);
|
||||
|
||||
conn.Open();
|
||||
@@ -308,6 +307,25 @@ namespace OpenSim.Data.PGSQL
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string where, NpgsqlParameter parameter)
|
||||
{
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
||||
{
|
||||
|
||||
string query = String.Format("SELECT * FROM {0} WHERE {1}",
|
||||
m_Realm, where);
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
//m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where);
|
||||
|
||||
cmd.Parameters.Add(parameter);
|
||||
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Store(T row)
|
||||
{
|
||||
List<string> constraintFields = GetConstraints();
|
||||
|
||||
@@ -83,11 +83,15 @@ namespace OpenSim.Data.PGSQL
|
||||
public GroupData[] RetrieveGroups(string pattern)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pattern)) // True for where clause
|
||||
{
|
||||
pattern = " true ORDER BY lower(\"Name\") LIMIT 100";
|
||||
return m_Groups.Get(pattern);
|
||||
}
|
||||
else
|
||||
pattern = string.Format(" lower(\"Name\") LIKE lower('%{0}%') ORDER BY lower(\"Name\") LIMIT 100", pattern);
|
||||
|
||||
return m_Groups.Get(pattern);
|
||||
{
|
||||
pattern = " lower(\"Name\") LIKE lower('%:pattern%') ORDER BY lower(\"Name\") LIMIT 100";
|
||||
return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern));
|
||||
}
|
||||
}
|
||||
|
||||
public bool DeleteGroup(UUID groupID)
|
||||
|
||||
@@ -406,6 +406,43 @@ namespace OpenSim.Data.PGSQL
|
||||
return exists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the assets exist in the database.
|
||||
/// </summary>
|
||||
/// <param name="uuids">The assets' IDs</param>
|
||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||
public bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
string ids = "'" + string.Join("','", uuids) + "'";
|
||||
string sql = string.Format(@"SELECT ""ID"" FROM XAssetsMeta WHERE ""ID"" IN ({0})", ids);
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
UUID id = DBGuid.FromDB(reader["id"]);
|
||||
exist.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool[] results = new bool[uuids.Length];
|
||||
for (int i = 0; i < uuids.Length; i++)
|
||||
results[i] = exist.Contains(uuids[i]);
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the asset exists in the database
|
||||
/// </summary>
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.7.6.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -134,25 +134,25 @@ namespace OpenSim.Data.SQLite
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
}
|
||||
|
||||
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
|
||||
if (ExistsAsset(asset.FullID))
|
||||
if (AssetsExist(new[] { asset.FullID })[0])
|
||||
{
|
||||
//LogAssetLoad(asset);
|
||||
|
||||
@@ -214,32 +214,39 @@ namespace OpenSim.Data.SQLite
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Check if an asset exist in database
|
||||
/// Check if the assets exist in the database.
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>True if exist, or false.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
/// <param name="uuids">The assets' IDs</param>
|
||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
lock (this)
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
string ids = "'" + string.Join("','", uuids) + "'";
|
||||
string sql = string.Format("select UUID from assets where UUID in ({0})", ids);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
||||
using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
while (reader.Read())
|
||||
{
|
||||
reader.Close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Close();
|
||||
return false;
|
||||
UUID id = new UUID((string)reader["UUID"]);
|
||||
exist.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool[] results = new bool[uuids.Length];
|
||||
for (int i = 0; i < uuids.Length; i++)
|
||||
results[i] = exist.Contains(uuids[i]);
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLite
|
||||
return Delete(principalID.ToString(), friend);
|
||||
}
|
||||
|
||||
public bool Delete(string principalID, string friend)
|
||||
public override bool Delete(string principalID, string friend)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand())
|
||||
{
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace OpenSim.Data.SQLite
|
||||
if (inventoryRow == null)
|
||||
{
|
||||
if (! add)
|
||||
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID);
|
||||
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existent inventory folder: {0}", folder.ID);
|
||||
|
||||
inventoryRow = inventoryFolderTable.NewRow();
|
||||
fillFolderRow(inventoryRow, folder);
|
||||
@@ -298,7 +298,7 @@ namespace OpenSim.Data.SQLite
|
||||
if (inventoryRow == null)
|
||||
{
|
||||
if (!add)
|
||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID);
|
||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existent inventory item: {0}", item.ID);
|
||||
|
||||
inventoryRow = inventoryItemTable.NewRow();
|
||||
fillItemRow(inventoryRow, item);
|
||||
|
||||
@@ -1605,7 +1605,7 @@ namespace OpenSim.Data.SQLite
|
||||
prim.SitName = (String)row["SitName"];
|
||||
prim.TouchName = (String)row["TouchName"];
|
||||
// permissions
|
||||
prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
|
||||
prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]);
|
||||
prim.CreatorIdentification = (String)row["CreatorID"];
|
||||
prim.OwnerID = new UUID((String)row["OwnerID"]);
|
||||
prim.GroupID = new UUID((String)row["GroupID"]);
|
||||
@@ -2034,7 +2034,7 @@ namespace OpenSim.Data.SQLite
|
||||
row["SitName"] = prim.SitName;
|
||||
row["TouchName"] = prim.TouchName;
|
||||
// permissions
|
||||
row["ObjectFlags"] = prim.ObjectFlags;
|
||||
row["ObjectFlags"] = (uint)prim.Flags;
|
||||
row["CreatorID"] = prim.CreatorIdentification.ToString();
|
||||
row["OwnerID"] = prim.OwnerID.ToString();
|
||||
row["GroupID"] = prim.GroupID.ToString();
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace OpenSim.Data.SQLite
|
||||
private SqliteConnection m_connection;
|
||||
private string m_connectionString;
|
||||
|
||||
private FieldInfo[] m_Fields;
|
||||
private Dictionary<string, FieldInfo> m_FieldMap =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
@@ -585,9 +584,6 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
if(reader != null && reader.Read())
|
||||
{
|
||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
||||
": Getting data for {0}.", props.UserId);
|
||||
|
||||
props.WebUrl = (string)reader["profileURL"];
|
||||
UUID.TryParse((string)reader["profileImage"], out props.ImageId);
|
||||
props.AboutText = (string)reader["profileAboutText"];
|
||||
@@ -602,9 +598,6 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
||||
": No data for {0}", props.UserId);
|
||||
|
||||
props.WebUrl = string.Empty;
|
||||
props.ImageId = UUID.Zero;
|
||||
props.AboutText = string.Empty;
|
||||
|
||||
@@ -107,10 +107,11 @@ namespace OpenSim.Data.Tests
|
||||
public void T001_LoadEmpty()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(m_db.ExistsAsset(uuid1), Is.False);
|
||||
Assert.That(m_db.ExistsAsset(uuid2), Is.False);
|
||||
Assert.That(m_db.ExistsAsset(uuid3), Is.False);
|
||||
|
||||
bool[] exist = m_db.AssetsExist(new[] { uuid1, uuid2, uuid3 });
|
||||
Assert.IsFalse(exist[0]);
|
||||
Assert.IsFalse(exist[1]);
|
||||
Assert.IsFalse(exist[2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -159,9 +160,10 @@ namespace OpenSim.Data.Tests
|
||||
AssetBase a3b = m_db.GetAsset(uuid3);
|
||||
Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a));
|
||||
|
||||
Assert.That(m_db.ExistsAsset(uuid1), Is.True);
|
||||
Assert.That(m_db.ExistsAsset(uuid2), Is.True);
|
||||
Assert.That(m_db.ExistsAsset(uuid3), Is.True);
|
||||
bool[] exist = m_db.AssetsExist(new[] { uuid1, uuid2, uuid3 });
|
||||
Assert.IsTrue(exist[0]);
|
||||
Assert.IsTrue(exist[1]);
|
||||
Assert.IsTrue(exist[2]);
|
||||
|
||||
List<AssetMetadata> metadatas = m_db.FetchAssetMetadataSet(0, 1000);
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@ namespace OpenSim.Data.Tests
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
Assert.Ignore();
|
||||
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
// for SQLite, if no explicit conn string is specified, use a temp file
|
||||
if (String.IsNullOrEmpty(m_connStr))
|
||||
{
|
||||
|
||||
@@ -321,6 +321,8 @@ namespace OpenSim.Framework
|
||||
Mac = args["mac"].AsString();
|
||||
if (args["id0"] != null)
|
||||
Id0 = args["id0"].AsString();
|
||||
if (args["teleport_flags"] != null)
|
||||
teleportFlags = args["teleport_flags"].AsUInteger();
|
||||
|
||||
if (args["start_pos"] != null)
|
||||
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
|
||||
|
||||
@@ -132,6 +132,11 @@ namespace OpenSim.Framework
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "AnimID=" + AnimID.ToString()
|
||||
|
||||
@@ -59,4 +59,4 @@ using System.Runtime.InteropServices;
|
||||
// Revision
|
||||
//
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
@@ -50,6 +50,9 @@ namespace OpenSim.Framework
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static readonly int MAX_ASSET_NAME = 64;
|
||||
public static readonly int MAX_ASSET_DESC = 64;
|
||||
|
||||
/// <summary>
|
||||
/// Data of the Asset
|
||||
/// </summary>
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -520,6 +520,12 @@ namespace OpenSim.Framework
|
||||
if (!m_attachments.ContainsKey(attach.AttachPoint))
|
||||
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
|
||||
|
||||
foreach (AvatarAttachment prev in m_attachments[attach.AttachPoint])
|
||||
{
|
||||
if (prev.ItemID == attach.ItemID)
|
||||
return;
|
||||
}
|
||||
|
||||
m_attachments[attach.AttachPoint].Add(attach);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ namespace OpenSim.Framework
|
||||
/// </remarks>
|
||||
public bool Contains(T item)
|
||||
{
|
||||
if (m_queue.Count < 1 && m_pqueue.Count < 1)
|
||||
return false;
|
||||
|
||||
lock (m_queueSync)
|
||||
{
|
||||
if (m_queue.Count < 1 && m_pqueue.Count < 1)
|
||||
return false;
|
||||
|
||||
if (m_pqueue.Contains(item))
|
||||
return true;
|
||||
return m_queue.Contains(item);
|
||||
@@ -112,12 +112,10 @@ namespace OpenSim.Framework
|
||||
/// <summary>
|
||||
/// Return a count of the number of requests on this queue.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method is not thread-safe. Do not rely on the result without consistent external locking.
|
||||
/// </remarks>
|
||||
public int Count()
|
||||
{
|
||||
return m_queue.Count + m_pqueue.Count;
|
||||
lock (m_queueSync)
|
||||
return m_queue.Count + m_pqueue.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -128,11 +126,11 @@ namespace OpenSim.Framework
|
||||
/// </remarks>
|
||||
public T[] GetQueueArray()
|
||||
{
|
||||
if (m_queue.Count < 1 && m_pqueue.Count < 1)
|
||||
return new T[0];
|
||||
|
||||
lock (m_queueSync)
|
||||
{
|
||||
if (m_queue.Count < 1 && m_pqueue.Count < 1)
|
||||
return new T[0];
|
||||
|
||||
return m_queue.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace OpenSim.Framework
|
||||
public int assetThrottle;
|
||||
public int textureThrottle;
|
||||
public int totalThrottle;
|
||||
public int maxThrottle;
|
||||
|
||||
public Dictionary<string, int> SyncRequests = new Dictionary<string,int>();
|
||||
public Dictionary<string, int> AsyncRequests = new Dictionary<string,int>();
|
||||
|
||||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ using System.Threading;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
/// <summary>
|
||||
@@ -54,7 +56,7 @@ namespace OpenSim.Framework.Communications
|
||||
/// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
|
||||
/// invoked by the caller in either synchronous mode or asynchronous modes.
|
||||
/// </remarks>
|
||||
public class RestClient
|
||||
public class RestClient : IDisposable
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -146,6 +148,33 @@ namespace OpenSim.Framework.Communications
|
||||
|
||||
#endregion constructors
|
||||
|
||||
|
||||
#region Dispose
|
||||
|
||||
private bool disposed = false;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_resource.Dispose();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
#endregion Dispose
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a path element to the query, e.g. assets
|
||||
/// </summary>
|
||||
@@ -298,6 +327,14 @@ namespace OpenSim.Framework.Communications
|
||||
/// Perform a synchronous request
|
||||
/// </summary>
|
||||
public Stream Request()
|
||||
{
|
||||
return Request(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous request
|
||||
/// </summary>
|
||||
public Stream Request(IServiceAuth auth)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
@@ -307,6 +344,12 @@ namespace OpenSim.Framework.Communications
|
||||
_request.Timeout = 200000;
|
||||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
try
|
||||
@@ -318,12 +361,12 @@ namespace OpenSim.Framework.Communications
|
||||
HttpWebResponse errorResponse = e.Response as HttpWebResponse;
|
||||
if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode)
|
||||
{
|
||||
m_log.Warn("[REST CLIENT] Resource not found (404)");
|
||||
// This is often benign. E.g., requesting a missing asset will return 404.
|
||||
m_log.DebugFormat("[REST CLIENT] Resource not found (404): {0}", _request.Address.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[REST CLIENT] Error fetching resource from server " + _request.Address.ToString());
|
||||
m_log.Debug(e.ToString());
|
||||
m_log.Error(string.Format("[REST CLIENT] Error fetching resource from server: {0} ", _request.Address.ToString()), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -354,11 +397,14 @@ namespace OpenSim.Framework.Communications
|
||||
_resource.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
WebUtil.LogResponseDetail(reqnum, _resource);
|
||||
|
||||
return _resource;
|
||||
}
|
||||
}
|
||||
|
||||
public Stream Request(Stream src)
|
||||
public Stream Request(Stream src, IServiceAuth auth)
|
||||
{
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
_request.KeepAlive = false;
|
||||
@@ -367,24 +413,58 @@ namespace OpenSim.Framework.Communications
|
||||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
_request.ContentLength = src.Length;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength);
|
||||
m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
|
||||
src.Seek(0, SeekOrigin.Begin);
|
||||
m_log.Info("[REST]: Seek is ok");
|
||||
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
|
||||
|
||||
Stream dst = _request.GetRequestStream();
|
||||
m_log.Info("[REST]: GetRequestStream is ok");
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int length = src.Read(buf, 0, 1024);
|
||||
m_log.Info("[REST]: First Read is ok");
|
||||
while (length > 0)
|
||||
{
|
||||
dst.Write(buf, 0, length);
|
||||
length = src.Read(buf, 0, 1024);
|
||||
}
|
||||
|
||||
_response = (HttpWebResponse) _request.GetResponse();
|
||||
try
|
||||
{
|
||||
_response = (HttpWebResponse)_request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
|
||||
RequestMethod, _request.RequestUri, e.Status, e.Message);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[REST]: Request {0} {1} failed with exception {2} {3}",
|
||||
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
{
|
||||
using (Stream responseStream = _response.GetResponseStream())
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(responseStream))
|
||||
{
|
||||
string responseStr = reader.ReadToEnd();
|
||||
WebUtil.LogResponseDetail(reqnum, responseStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_response.Close();
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
|
||||
@@ -423,7 +503,7 @@ namespace OpenSim.Framework.Communications
|
||||
try
|
||||
{
|
||||
// Perform the operation; if sucessful set the result
|
||||
Stream s = Request();
|
||||
Stream s = Request(null);
|
||||
ar.SetAsCompleted(s, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using OpenSim.Framework.Configuration.XML;
|
||||
|
||||
namespace OpenSim.Framework.Configuration.HTTP
|
||||
{
|
||||
public class HTTPConfiguration : IGenericConfig
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private RemoteConfigSettings remoteConfigSettings;
|
||||
|
||||
private XmlConfiguration xmlConfig;
|
||||
|
||||
private string configFileName = String.Empty;
|
||||
|
||||
public HTTPConfiguration()
|
||||
{
|
||||
remoteConfigSettings = new RemoteConfigSettings("remoteconfig.xml");
|
||||
xmlConfig = new XmlConfiguration();
|
||||
}
|
||||
|
||||
public void SetFileName(string fileName)
|
||||
{
|
||||
configFileName = fileName;
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
byte[] buf = new byte[8192];
|
||||
HttpWebRequest request =
|
||||
(HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
using (Stream resStream = response.GetResponseStream())
|
||||
{
|
||||
string tempString = null;
|
||||
int count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
count = resStream.Read(buf, 0, buf.Length);
|
||||
if (count != 0)
|
||||
{
|
||||
tempString = Util.UTF8.GetString(buf, 0, count);
|
||||
sb.Append(tempString);
|
||||
}
|
||||
}
|
||||
while (count > 0);
|
||||
|
||||
LoadDataFromString(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
m_log.Warn("Unable to connect to remote configuration file (" +
|
||||
remoteConfigSettings.baseConfigURL + configFileName +
|
||||
"). Creating local file instead.");
|
||||
xmlConfig.SetFileName(configFileName);
|
||||
xmlConfig.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadDataFromString(string data)
|
||||
{
|
||||
xmlConfig.LoadDataFromString(data);
|
||||
}
|
||||
|
||||
public string GetAttribute(string attributeName)
|
||||
{
|
||||
return xmlConfig.GetAttribute(attributeName);
|
||||
}
|
||||
|
||||
public bool SetAttribute(string attributeName, string attributeValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Framework.Configuration.HTTP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||
[assembly: AssemblyProduct("OpenSim")]
|
||||
[assembly: AssemblyCopyright("OpenSimulator develoeprs")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("cb78b672-d000-4f93-88f9-dae151cc0061")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Framework.Configuration.XML")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||
[assembly: AssemblyProduct("OpenSim")]
|
||||
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("eeb880df-0112-4c3d-87ed-b2108d614c55")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace OpenSim.Framework.Configuration.XML
|
||||
{
|
||||
public class XmlConfiguration : IGenericConfig
|
||||
{
|
||||
private XmlDocument doc;
|
||||
private XmlNode rootNode;
|
||||
private XmlNode configNode;
|
||||
private string fileName;
|
||||
private bool createdFile = false;
|
||||
|
||||
public void SetFileName(string file)
|
||||
{
|
||||
fileName = file;
|
||||
}
|
||||
|
||||
private void LoadDataToClass()
|
||||
{
|
||||
rootNode = doc.SelectSingleNode("Root");
|
||||
if (null == rootNode)
|
||||
throw new Exception("Error: Invalid .xml File. Missing <Root>");
|
||||
|
||||
configNode = rootNode.SelectSingleNode("Config");
|
||||
if (null == configNode)
|
||||
throw new Exception("Error: Invalid .xml File. <Root> should contain a <Config>");
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
doc = new XmlDocument();
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
XmlTextReader reader = new XmlTextReader(fileName);
|
||||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||
doc.Load(reader);
|
||||
reader.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
createdFile = true;
|
||||
rootNode = doc.CreateNode(XmlNodeType.Element, "Root", String.Empty);
|
||||
doc.AppendChild(rootNode);
|
||||
configNode = doc.CreateNode(XmlNodeType.Element, "Config", String.Empty);
|
||||
rootNode.AppendChild(configNode);
|
||||
}
|
||||
|
||||
LoadDataToClass();
|
||||
|
||||
if (createdFile)
|
||||
{
|
||||
Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadDataFromString(string data)
|
||||
{
|
||||
doc = new XmlDocument();
|
||||
doc.LoadXml(data);
|
||||
|
||||
LoadDataToClass();
|
||||
}
|
||||
|
||||
public string GetAttribute(string attributeName)
|
||||
{
|
||||
string result = null;
|
||||
if (configNode.Attributes[attributeName] != null)
|
||||
{
|
||||
result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool SetAttribute(string attributeName, string attributeValue)
|
||||
{
|
||||
if (configNode.Attributes[attributeName] != null)
|
||||
{
|
||||
((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlAttribute attri;
|
||||
attri = doc.CreateAttribute(attributeName);
|
||||
attri.Value = attributeValue;
|
||||
configNode.Attributes.Append(attri);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
return;
|
||||
|
||||
if (!Directory.Exists(Util.configDir()))
|
||||
{
|
||||
Directory.CreateDirectory(Util.configDir());
|
||||
}
|
||||
doc.Save(fileName);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
configNode = null;
|
||||
rootNode = null;
|
||||
doc = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,530 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
//using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class ConfigurationMember
|
||||
{
|
||||
#region Delegates
|
||||
|
||||
public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result);
|
||||
|
||||
public delegate void ConfigurationOptionsLoad();
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private int cE = 0;
|
||||
|
||||
private string configurationDescription = String.Empty;
|
||||
private string configurationFilename = String.Empty;
|
||||
private XmlNode configurationFromXMLNode = null;
|
||||
private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>();
|
||||
private IGenericConfig configurationPlugin = null;
|
||||
|
||||
/// <summary>
|
||||
/// This is the default configuration DLL loaded
|
||||
/// </summary>
|
||||
private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll";
|
||||
|
||||
private ConfigurationOptionsLoad loadFunction;
|
||||
private ConfigurationOptionResult resultFunction;
|
||||
|
||||
private bool useConsoleToPromptOnError = true;
|
||||
|
||||
public ConfigurationMember(string configuration_filename, string configuration_description,
|
||||
ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function, bool use_console_to_prompt_on_error)
|
||||
{
|
||||
configurationFilename = configuration_filename;
|
||||
configurationDescription = configuration_description;
|
||||
loadFunction = load_function;
|
||||
resultFunction = result_function;
|
||||
useConsoleToPromptOnError = use_console_to_prompt_on_error;
|
||||
}
|
||||
|
||||
public ConfigurationMember(XmlNode configuration_xml, string configuration_description,
|
||||
ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function, bool use_console_to_prompt_on_error)
|
||||
{
|
||||
configurationFilename = String.Empty;
|
||||
configurationFromXMLNode = configuration_xml;
|
||||
configurationDescription = configuration_description;
|
||||
loadFunction = load_function;
|
||||
resultFunction = result_function;
|
||||
useConsoleToPromptOnError = use_console_to_prompt_on_error;
|
||||
}
|
||||
|
||||
public void setConfigurationFilename(string filename)
|
||||
{
|
||||
configurationFilename = filename;
|
||||
}
|
||||
|
||||
public void setConfigurationDescription(string desc)
|
||||
{
|
||||
configurationDescription = desc;
|
||||
}
|
||||
|
||||
public void setConfigurationResultFunction(ConfigurationOptionResult result)
|
||||
{
|
||||
resultFunction = result;
|
||||
}
|
||||
|
||||
public void forceConfigurationPluginLibrary(string dll_filename)
|
||||
{
|
||||
configurationPluginFilename = dll_filename;
|
||||
}
|
||||
|
||||
private void checkAndAddConfigOption(ConfigurationOption option)
|
||||
{
|
||||
if ((option.configurationKey != String.Empty && option.configurationQuestion != String.Empty) ||
|
||||
(option.configurationKey != String.Empty && option.configurationUseDefaultNoPrompt))
|
||||
{
|
||||
if (!configurationOptions.Contains(option))
|
||||
{
|
||||
configurationOptions.Add(option);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info(
|
||||
"Required fields for adding a configuration option is invalid. Will not add this option (" +
|
||||
option.configurationKey + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public void addConfigurationOption(string configuration_key,
|
||||
ConfigurationOption.ConfigurationTypes configuration_type,
|
||||
string configuration_question, string configuration_default,
|
||||
bool use_default_no_prompt)
|
||||
{
|
||||
ConfigurationOption configOption = new ConfigurationOption();
|
||||
configOption.configurationKey = configuration_key;
|
||||
configOption.configurationQuestion = configuration_question;
|
||||
configOption.configurationDefault = configuration_default;
|
||||
configOption.configurationType = configuration_type;
|
||||
configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
|
||||
configOption.shouldIBeAsked = null; //Assumes true, I can ask whenever
|
||||
checkAndAddConfigOption(configOption);
|
||||
}
|
||||
|
||||
public void addConfigurationOption(string configuration_key,
|
||||
ConfigurationOption.ConfigurationTypes configuration_type,
|
||||
string configuration_question, string configuration_default,
|
||||
bool use_default_no_prompt,
|
||||
ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate)
|
||||
{
|
||||
ConfigurationOption configOption = new ConfigurationOption();
|
||||
configOption.configurationKey = configuration_key;
|
||||
configOption.configurationQuestion = configuration_question;
|
||||
configOption.configurationDefault = configuration_default;
|
||||
configOption.configurationType = configuration_type;
|
||||
configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
|
||||
configOption.shouldIBeAsked = shouldIBeAskedDelegate;
|
||||
checkAndAddConfigOption(configOption);
|
||||
}
|
||||
|
||||
// TEMP - REMOVE
|
||||
public void performConfigurationRetrieve()
|
||||
{
|
||||
if (cE > 1)
|
||||
m_log.Error("READING CONFIGURATION COUT: " + cE.ToString());
|
||||
|
||||
|
||||
configurationPlugin = LoadConfigDll(configurationPluginFilename);
|
||||
configurationOptions.Clear();
|
||||
if (loadFunction == null)
|
||||
{
|
||||
m_log.Error("Load Function for '" + configurationDescription +
|
||||
"' is null. Refusing to run configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (resultFunction == null)
|
||||
{
|
||||
m_log.Error("Result Function for '" + configurationDescription +
|
||||
"' is null. Refusing to run configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
//m_log.Debug("[CONFIG]: Calling Configuration Load Function...");
|
||||
loadFunction();
|
||||
|
||||
if (configurationOptions.Count <= 0)
|
||||
{
|
||||
m_log.Error("[CONFIG]: No configuration options were specified for '" + configurationOptions +
|
||||
"'. Refusing to continue configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
bool useFile = true;
|
||||
if (configurationPlugin == null)
|
||||
{
|
||||
m_log.Error("[CONFIG]: Configuration Plugin NOT LOADED!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (configurationFilename.Trim() != String.Empty)
|
||||
{
|
||||
configurationPlugin.SetFileName(configurationFilename);
|
||||
try
|
||||
{
|
||||
configurationPlugin.LoadData();
|
||||
useFile = true;
|
||||
}
|
||||
catch (XmlException e)
|
||||
{
|
||||
m_log.WarnFormat("[CONFIG] Not using {0}: {1}",
|
||||
configurationFilename,
|
||||
e.Message.ToString());
|
||||
//m_log.Error("Error loading " + configurationFilename + ": " + e.ToString());
|
||||
useFile = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (configurationFromXMLNode != null)
|
||||
{
|
||||
m_log.Info("Loading from XML Node, will not save to the file");
|
||||
configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml);
|
||||
}
|
||||
|
||||
m_log.Info("XML Configuration Filename is not valid; will not save to the file.");
|
||||
useFile = false;
|
||||
}
|
||||
|
||||
foreach (ConfigurationOption configOption in configurationOptions)
|
||||
{
|
||||
bool convertSuccess = false;
|
||||
object return_result = null;
|
||||
string errorMessage = String.Empty;
|
||||
bool ignoreNextFromConfig = false;
|
||||
while (convertSuccess == false)
|
||||
{
|
||||
string console_result = String.Empty;
|
||||
string attribute = null;
|
||||
if (useFile || configurationFromXMLNode != null)
|
||||
{
|
||||
if (!ignoreNextFromConfig)
|
||||
{
|
||||
attribute = configurationPlugin.GetAttribute(configOption.configurationKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
ignoreNextFromConfig = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (attribute == null)
|
||||
{
|
||||
if (configOption.configurationUseDefaultNoPrompt || useConsoleToPromptOnError == false)
|
||||
{
|
||||
console_result = configOption.configurationDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((configOption.shouldIBeAsked != null &&
|
||||
configOption.shouldIBeAsked(configOption.configurationKey)) ||
|
||||
configOption.shouldIBeAsked == null)
|
||||
{
|
||||
if (configurationDescription.Trim() != String.Empty)
|
||||
{
|
||||
console_result =
|
||||
MainConsole.Instance.CmdPrompt(
|
||||
configurationDescription + ": " + configOption.configurationQuestion,
|
||||
configOption.configurationDefault);
|
||||
}
|
||||
else
|
||||
{
|
||||
console_result =
|
||||
MainConsole.Instance.CmdPrompt(configOption.configurationQuestion,
|
||||
configOption.configurationDefault);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Dont Ask! Just use default
|
||||
console_result = configOption.configurationDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console_result = attribute;
|
||||
}
|
||||
|
||||
// if the first character is a "$", assume it's the name
|
||||
// of an environment variable and substitute with the value of that variable
|
||||
if (console_result.StartsWith("$"))
|
||||
console_result = Environment.GetEnvironmentVariable(console_result.Substring(1));
|
||||
|
||||
switch (configOption.configurationType)
|
||||
{
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_STRING:
|
||||
return_result = console_result;
|
||||
convertSuccess = true;
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY:
|
||||
if (console_result.Length > 0)
|
||||
{
|
||||
return_result = console_result;
|
||||
convertSuccess = true;
|
||||
}
|
||||
errorMessage = "a string that is not empty";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN:
|
||||
bool boolResult;
|
||||
if (Boolean.TryParse(console_result, out boolResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = boolResult;
|
||||
}
|
||||
errorMessage = "'true' or 'false' (Boolean)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_BYTE:
|
||||
byte byteResult;
|
||||
if (Byte.TryParse(console_result, out byteResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = byteResult;
|
||||
}
|
||||
errorMessage = "a byte (Byte)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_CHARACTER:
|
||||
char charResult;
|
||||
if (Char.TryParse(console_result, out charResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = charResult;
|
||||
}
|
||||
errorMessage = "a character (Char)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_INT16:
|
||||
short shortResult;
|
||||
if (Int16.TryParse(console_result, out shortResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = shortResult;
|
||||
}
|
||||
errorMessage = "a signed 32 bit integer (short)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_INT32:
|
||||
int intResult;
|
||||
if (Int32.TryParse(console_result, out intResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = intResult;
|
||||
}
|
||||
errorMessage = "a signed 32 bit integer (int)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_INT64:
|
||||
long longResult;
|
||||
if (Int64.TryParse(console_result, out longResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = longResult;
|
||||
}
|
||||
errorMessage = "a signed 32 bit integer (long)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS:
|
||||
IPAddress ipAddressResult;
|
||||
if (IPAddress.TryParse(console_result, out ipAddressResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = ipAddressResult;
|
||||
}
|
||||
errorMessage = "an IP Address (IPAddress)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_UUID:
|
||||
UUID uuidResult;
|
||||
if (UUID.TryParse(console_result, out uuidResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = uuidResult;
|
||||
}
|
||||
errorMessage = "a UUID (UUID)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_UUID_NULL_FREE:
|
||||
UUID uuidResult2;
|
||||
if (UUID.TryParse(console_result, out uuidResult2))
|
||||
{
|
||||
convertSuccess = true;
|
||||
|
||||
if (uuidResult2 == UUID.Zero)
|
||||
uuidResult2 = UUID.Random();
|
||||
|
||||
return_result = uuidResult2;
|
||||
}
|
||||
errorMessage = "a non-null UUID (UUID)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_Vector3:
|
||||
Vector3 vectorResult;
|
||||
if (Vector3.TryParse(console_result, out vectorResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = vectorResult;
|
||||
}
|
||||
errorMessage = "a vector (Vector3)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_UINT16:
|
||||
ushort ushortResult;
|
||||
if (UInt16.TryParse(console_result, out ushortResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = ushortResult;
|
||||
}
|
||||
errorMessage = "an unsigned 16 bit integer (ushort)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_UINT32:
|
||||
uint uintResult;
|
||||
if (UInt32.TryParse(console_result, out uintResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = uintResult;
|
||||
}
|
||||
errorMessage = "an unsigned 32 bit integer (uint)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_UINT64:
|
||||
ulong ulongResult;
|
||||
if (UInt64.TryParse(console_result, out ulongResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = ulongResult;
|
||||
}
|
||||
errorMessage = "an unsigned 64 bit integer (ulong)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
|
||||
float floatResult;
|
||||
if (
|
||||
float.TryParse(console_result, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, Culture.NumberFormatInfo,
|
||||
out floatResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = floatResult;
|
||||
}
|
||||
errorMessage = "a single-precision floating point number (float)";
|
||||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
|
||||
double doubleResult;
|
||||
if (
|
||||
Double.TryParse(console_result, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, Culture.NumberFormatInfo,
|
||||
out doubleResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = doubleResult;
|
||||
}
|
||||
errorMessage = "an double-precision floating point number (double)";
|
||||
break;
|
||||
}
|
||||
|
||||
if (convertSuccess)
|
||||
{
|
||||
if (useFile)
|
||||
{
|
||||
configurationPlugin.SetAttribute(configOption.configurationKey, console_result);
|
||||
}
|
||||
|
||||
if (!resultFunction(configOption.configurationKey, return_result))
|
||||
{
|
||||
m_log.Info(
|
||||
"The handler for the last configuration option denied that input, please try again.");
|
||||
convertSuccess = false;
|
||||
ignoreNextFromConfig = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (configOption.configurationUseDefaultNoPrompt)
|
||||
{
|
||||
m_log.Error(string.Format(
|
||||
"[CONFIG]: [{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n",
|
||||
configOption.configurationKey, console_result, errorMessage,
|
||||
configurationFilename));
|
||||
convertSuccess = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn(string.Format(
|
||||
"[CONFIG]: [{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n",
|
||||
configOption.configurationKey, console_result, errorMessage,
|
||||
configurationFilename));
|
||||
ignoreNextFromConfig = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (useFile)
|
||||
{
|
||||
configurationPlugin.Commit();
|
||||
configurationPlugin.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private static IGenericConfig LoadConfigDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IGenericConfig plug = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IGenericConfig", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
plug =
|
||||
(IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginAssembly = null;
|
||||
return plug;
|
||||
}
|
||||
|
||||
public void forceSetConfigurationOption(string configuration_key, string configuration_value)
|
||||
{
|
||||
configurationPlugin.LoadData();
|
||||
configurationPlugin.SetAttribute(configuration_key, configuration_value);
|
||||
configurationPlugin.Commit();
|
||||
configurationPlugin.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly : AssemblyVersion("0.8.0.*")]
|
||||
[assembly : AssemblyVersion("0.8.1.*")]
|
||||
|
||||
@@ -424,9 +424,9 @@ namespace OpenSim.Framework.Console
|
||||
return new string[] { new List<string>(current.Keys)[0] };
|
||||
}
|
||||
|
||||
public string[] Resolve(string[] cmd)
|
||||
private CommandInfo ResolveCommand(string[] cmd, out string[] result)
|
||||
{
|
||||
string[] result = cmd;
|
||||
result = cmd;
|
||||
int index = -1;
|
||||
|
||||
Dictionary<string, object> current = tree;
|
||||
@@ -458,7 +458,7 @@ namespace OpenSim.Framework.Console
|
||||
}
|
||||
else if (found.Count > 0)
|
||||
{
|
||||
return new string[0];
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -467,21 +467,37 @@ namespace OpenSim.Framework.Console
|
||||
}
|
||||
|
||||
if (current.ContainsKey(String.Empty))
|
||||
return (CommandInfo)current[String.Empty];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool HasCommand(string command)
|
||||
{
|
||||
string[] result;
|
||||
return ResolveCommand(Parser.Parse(command), out result) != null;
|
||||
}
|
||||
|
||||
public string[] Resolve(string[] cmd)
|
||||
{
|
||||
string[] result;
|
||||
CommandInfo ci = ResolveCommand(cmd, out result);
|
||||
|
||||
if (ci == null)
|
||||
return new string[0];
|
||||
|
||||
if (ci.fn.Count == 0)
|
||||
return new string[0];
|
||||
|
||||
foreach (CommandDelegate fn in ci.fn)
|
||||
{
|
||||
CommandInfo ci = (CommandInfo)current[String.Empty];
|
||||
if (ci.fn.Count == 0)
|
||||
if (fn != null)
|
||||
fn(ci.module, result);
|
||||
else
|
||||
return new string[0];
|
||||
foreach (CommandDelegate fn in ci.fn)
|
||||
{
|
||||
if (fn != null)
|
||||
fn(ci.module, result);
|
||||
else
|
||||
return new string[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return new string[0];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public XmlElement GetXml(XmlDocument doc)
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace OpenSim.Framework.Console
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a console integer to an int, automatically complaining if a console is given.
|
||||
/// Convert a console input to a bool, automatically complaining if a console is given.
|
||||
/// </summary>
|
||||
/// <param name='console'>Can be null if no console is available.</param>
|
||||
/// <param name='rawConsoleVector'>/param>
|
||||
@@ -176,7 +176,7 @@ namespace OpenSim.Framework.Console
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a console integer to an int, automatically complaining if a console is given.
|
||||
/// Convert a console input to an int, automatically complaining if a console is given.
|
||||
/// </summary>
|
||||
/// <param name='console'>Can be null if no console is available.</param>
|
||||
/// <param name='rawConsoleInt'>/param>
|
||||
@@ -195,6 +195,46 @@ namespace OpenSim.Framework.Console
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a console input to a float, automatically complaining if a console is given.
|
||||
/// </summary>
|
||||
/// <param name='console'>Can be null if no console is available.</param>
|
||||
/// <param name='rawConsoleInput'>/param>
|
||||
/// <param name='i'></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryParseConsoleFloat(ICommandConsole console, string rawConsoleInput, out float i)
|
||||
{
|
||||
if (!float.TryParse(rawConsoleInput, out i))
|
||||
{
|
||||
if (console != null)
|
||||
console.OutputFormat("ERROR: {0} is not a valid float", rawConsoleInput);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a console input to a double, automatically complaining if a console is given.
|
||||
/// </summary>
|
||||
/// <param name='console'>Can be null if no console is available.</param>
|
||||
/// <param name='rawConsoleInput'>/param>
|
||||
/// <param name='i'></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryParseConsoleDouble(ICommandConsole console, string rawConsoleInput, out double i)
|
||||
{
|
||||
if (!double.TryParse(rawConsoleInput, out i))
|
||||
{
|
||||
if (console != null)
|
||||
console.OutputFormat("ERROR: {0} is not a valid double", rawConsoleInput);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a console integer to a natural int, automatically complaining if a console is given.
|
||||
/// </summary>
|
||||
@@ -252,24 +292,82 @@ namespace OpenSim.Framework.Console
|
||||
/// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
|
||||
/// Other than that, component values must be numeric.
|
||||
/// </param>
|
||||
/// <param name='blankComponentFunc'></param>
|
||||
/// <param name='blankComponentFunc'>
|
||||
/// Behaviour if component is blank. If null then conversion fails on a blank component.
|
||||
/// </param>
|
||||
/// <param name='vector'></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryParseConsoleVector(
|
||||
string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
|
||||
{
|
||||
List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
|
||||
|
||||
if (components.Count < 1 || components.Count > 3)
|
||||
return Vector3.TryParse(CookVector(rawConsoleVector, 3, blankComponentFunc), out vector);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a vector input from the console to an OpenMetaverse.Vector2
|
||||
/// </summary>
|
||||
/// <param name='rawConsoleVector'>
|
||||
/// A string in the form <x>,<y> where there is no space between values.
|
||||
/// Any component can be missing (e.g. ,40). blankComponentFunc is invoked to replace the blank with a suitable value
|
||||
/// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40)
|
||||
/// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
|
||||
/// Other than that, component values must be numeric.
|
||||
/// </param>
|
||||
/// <param name='blankComponentFunc'>
|
||||
/// Behaviour if component is blank. If null then conversion fails on a blank component.
|
||||
/// </param>
|
||||
/// <param name='vector'></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryParseConsole2DVector(
|
||||
string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector2 vector)
|
||||
{
|
||||
// We don't use Vector2.TryParse() for now because for some reason it expects an input with 3 components
|
||||
// rather than 2.
|
||||
string cookedVector = CookVector(rawConsoleVector, 2, blankComponentFunc);
|
||||
|
||||
if (cookedVector == null)
|
||||
{
|
||||
vector = Vector3.Zero;
|
||||
vector = Vector2.Zero;
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] cookedComponents = cookedVector.Split(VectorSeparatorChars);
|
||||
|
||||
vector = new Vector2(float.Parse(cookedComponents[0]), float.Parse(cookedComponents[1]));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//return Vector2.TryParse(CookVector(rawConsoleVector, 2, blankComponentFunc), out vector);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a raw console vector into a vector that can be be parsed by the relevant OpenMetaverse.TryParse()
|
||||
/// </summary>
|
||||
/// <param name='rawConsoleVector'></param>
|
||||
/// <param name='dimensions'></param>
|
||||
/// <param name='blankComponentFunc'></param>
|
||||
/// <returns>null if conversion was not possible</returns>
|
||||
private static string CookVector(
|
||||
string rawConsoleVector, int dimensions, Func<string, string> blankComponentFunc)
|
||||
{
|
||||
List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
|
||||
|
||||
for (int i = components.Count; i < 3; i++)
|
||||
components.Add("");
|
||||
if (components.Count < 1 || components.Count > dimensions)
|
||||
return null;
|
||||
|
||||
List<string> semiDigestedComponents
|
||||
if (components.Count < dimensions)
|
||||
{
|
||||
if (blankComponentFunc == null)
|
||||
return null;
|
||||
else
|
||||
for (int i = components.Count; i < dimensions; i++)
|
||||
components.Add("");
|
||||
}
|
||||
|
||||
List<string> cookedComponents
|
||||
= components.ConvertAll<string>(
|
||||
c =>
|
||||
{
|
||||
@@ -283,11 +381,7 @@ namespace OpenSim.Framework.Console
|
||||
return c;
|
||||
});
|
||||
|
||||
string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray());
|
||||
|
||||
// m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector);
|
||||
|
||||
return Vector3.TryParse(semiDigestedConsoleVector, out vector);
|
||||
return string.Join(VectorSeparator, cookedComponents.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,11 @@ namespace OpenSim.Framework.Console
|
||||
// private readonly object m_syncRoot = new object();
|
||||
private const string LOGLEVEL_NONE = "(none)";
|
||||
|
||||
// Used to extract categories for colourization.
|
||||
private Regex m_categoryRegex
|
||||
= new Regex(
|
||||
@"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)", RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
|
||||
private int m_cursorYPosition = -1;
|
||||
private int m_cursorXPosition = 0;
|
||||
private StringBuilder m_commandLine = new StringBuilder();
|
||||
@@ -280,11 +285,8 @@ namespace OpenSim.Framework.Console
|
||||
string outText = text;
|
||||
|
||||
if (level != LOGLEVEL_NONE)
|
||||
{
|
||||
string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)";
|
||||
|
||||
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||
MatchCollection matches = RE.Matches(text);
|
||||
{
|
||||
MatchCollection matches = m_categoryRegex.Matches(text);
|
||||
|
||||
if (matches.Count == 1)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,9 @@ namespace OpenSim.Framework.Console
|
||||
/// </summary>
|
||||
public class MockConsole : ICommandConsole
|
||||
{
|
||||
#pragma warning disable 0067
|
||||
public event OnOutputDelegate OnOutput;
|
||||
#pragma warning restore 0067
|
||||
|
||||
private MockCommands m_commands = new MockCommands();
|
||||
|
||||
@@ -80,6 +82,7 @@ namespace OpenSim.Framework.Console
|
||||
public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) {}
|
||||
public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {}
|
||||
public string[] FindNextOption(string[] cmd, bool term) { return null; }
|
||||
public bool HasCommand(string cmd) { return false; }
|
||||
public string[] Resolve(string[] cmd) { return null; }
|
||||
public XmlElement GetXml(XmlDocument doc) { return null; }
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
@@ -111,5 +115,50 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public EstateBan() { }
|
||||
|
||||
public Dictionary<string, object> ToMap()
|
||||
{
|
||||
Dictionary<string, object> map = new Dictionary<string, object>();
|
||||
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (PropertyInfo p in properties)
|
||||
map[p.Name] = p.GetValue(this, null);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public EstateBan(Dictionary<string, object> map)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> kvp in map)
|
||||
{
|
||||
PropertyInfo p = this.GetType().GetProperty(kvp.Key, BindingFlags.Public | BindingFlags.Instance);
|
||||
if (p == null)
|
||||
continue;
|
||||
object value = p.GetValue(this, null);
|
||||
if (value is String)
|
||||
p.SetValue(this, map[p.Name], null);
|
||||
else if (value is UInt32)
|
||||
p.SetValue(this, UInt32.Parse((string)map[p.Name]), null);
|
||||
else if (value is Boolean)
|
||||
p.SetValue(this, Boolean.Parse((string)map[p.Name]), null);
|
||||
else if (value is UUID)
|
||||
p.SetValue(this, UUID.Parse((string)map[p.Name]), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// For debugging
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
Dictionary<string, object> map = ToMap();
|
||||
string result = string.Empty;
|
||||
foreach (KeyValuePair<string, object> kvp in map)
|
||||
result += string.Format("{0}: {1} {2}", kvp.Key, kvp.Value, Environment.NewLine);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
@@ -411,5 +412,119 @@ namespace OpenSim.Framework
|
||||
{
|
||||
return l_EstateGroups.Contains(groupID);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToMap()
|
||||
{
|
||||
Dictionary<string, object> map = new Dictionary<string, object>();
|
||||
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (PropertyInfo p in properties)
|
||||
{
|
||||
// EstateBans is a complex type, let's treat it as special
|
||||
if (p.Name == "EstateBans")
|
||||
continue;
|
||||
|
||||
object value = p.GetValue(this, null);
|
||||
if (value != null)
|
||||
{
|
||||
if (p.PropertyType.IsArray) // of UUIDs
|
||||
{
|
||||
if (((Array)value).Length > 0)
|
||||
{
|
||||
string[] args = new string[((Array)value).Length];
|
||||
int index = 0;
|
||||
foreach (object o in (Array)value)
|
||||
args[index++] = o.ToString();
|
||||
map[p.Name] = String.Join(",", args);
|
||||
}
|
||||
}
|
||||
else // simple types
|
||||
map[p.Name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// EstateBans are special
|
||||
if (EstateBans.Length > 0)
|
||||
{
|
||||
Dictionary<string, object> bans = new Dictionary<string, object>();
|
||||
int i = 0;
|
||||
foreach (EstateBan ban in EstateBans)
|
||||
bans["ban" + i++] = ban.ToMap();
|
||||
map["EstateBans"] = bans;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For debugging
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
Dictionary<string, object> map = ToMap();
|
||||
String result = String.Empty;
|
||||
|
||||
foreach (KeyValuePair<string, object> kvp in map)
|
||||
{
|
||||
if (kvp.Key == "EstateBans")
|
||||
{
|
||||
result += "EstateBans:" + Environment.NewLine;
|
||||
foreach (KeyValuePair<string, object> ban in (Dictionary<string, object>)kvp.Value)
|
||||
result += ban.Value.ToString();
|
||||
}
|
||||
else
|
||||
result += string.Format("{0}: {1} {2}", kvp.Key, kvp.Value.ToString(), Environment.NewLine);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public EstateSettings(Dictionary<string, object> map)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> kvp in map)
|
||||
{
|
||||
PropertyInfo p = this.GetType().GetProperty(kvp.Key, BindingFlags.Public | BindingFlags.Instance);
|
||||
if (p == null)
|
||||
continue;
|
||||
|
||||
// EstateBans is a complex type, let's treat it as special
|
||||
if (p.Name == "EstateBans")
|
||||
continue;
|
||||
|
||||
if (p.PropertyType.IsArray)
|
||||
{
|
||||
string[] elements = ((string)map[p.Name]).Split(new char[] { ',' });
|
||||
UUID[] uuids = new UUID[elements.Length];
|
||||
int i = 0;
|
||||
foreach (string e in elements)
|
||||
uuids[i++] = new UUID(e);
|
||||
p.SetValue(this, uuids, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
object value = p.GetValue(this, null);
|
||||
if (value is String)
|
||||
p.SetValue(this, map[p.Name], null);
|
||||
else if (value is UInt32)
|
||||
p.SetValue(this, UInt32.Parse((string)map[p.Name]), null);
|
||||
else if (value is Boolean)
|
||||
p.SetValue(this, Boolean.Parse((string)map[p.Name]), null);
|
||||
else if (value is UUID)
|
||||
p.SetValue(this, UUID.Parse((string)map[p.Name]), null);
|
||||
}
|
||||
}
|
||||
|
||||
// EstateBans are special
|
||||
if (map.ContainsKey("EstateBans"))
|
||||
{
|
||||
var banData = ((Dictionary<string, object>)map["EstateBans"]).Values;
|
||||
EstateBan[] bans = new EstateBan[banData.Count];
|
||||
int b = 0;
|
||||
foreach (Dictionary<string, object> ban in banData)
|
||||
bans[b++] = new EstateBan(ban);
|
||||
PropertyInfo bansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance);
|
||||
bansProperty.SetValue(this, bans, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,16 @@ namespace OpenSim.Framework
|
||||
string help, string longhelp, string descriptivehelp,
|
||||
CommandDelegate fn);
|
||||
|
||||
string[] FindNextOption(string[] cmd, bool term);
|
||||
/// <summary>
|
||||
/// Has the given command already been registered?
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <param name="command">Command.</param>
|
||||
bool HasCommand(string command);
|
||||
|
||||
string[] Resolve(string[] cmd);
|
||||
string[] FindNextOption(string[] command, bool term);
|
||||
|
||||
string[] Resolve(string[] command);
|
||||
|
||||
XmlElement GetXml(XmlDocument doc);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace OpenSim.Framework
|
||||
int GetParcelMaxPrimCount();
|
||||
int GetSimulatorMaxPrimCount();
|
||||
int GetPrimsFree();
|
||||
Dictionary<UUID, int> GetLandObjectOwners();
|
||||
|
||||
LandData LandData { get; set; }
|
||||
bool[,] LandBitmap { get; set; }
|
||||
|
||||
@@ -65,13 +65,18 @@ namespace OpenSim.Framework
|
||||
/// </remarks>
|
||||
AvatarAppearance Appearance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set if initial data about the scene (avatars, objects) has been sent to the client.
|
||||
/// </summary>
|
||||
bool SentInitialDataToClient { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Send initial scene data to the client controlling this agent
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This includes scene object data and the appearance data of other avatars.
|
||||
/// </remarks>
|
||||
void SendInitialDataToMe();
|
||||
void SendInitialDataToClient();
|
||||
|
||||
/// <summary>
|
||||
/// Direction in which the scene presence is looking.
|
||||
|
||||
@@ -35,6 +35,10 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public class InventoryItemBase : InventoryNodeBase, ICloneable
|
||||
{
|
||||
public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase";
|
||||
public static readonly sbyte SUITCASE_FOLDER_TYPE = 100;
|
||||
public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8;
|
||||
|
||||
/// <value>
|
||||
/// The inventory type of the item. This is slightly different from the asset type in some situations.
|
||||
/// </value>
|
||||
@@ -82,12 +86,15 @@ namespace OpenSim.Framework
|
||||
set
|
||||
{
|
||||
m_creatorId = value;
|
||||
|
||||
if ((m_creatorId == null) || !UUID.TryParse(m_creatorId, out m_creatorIdAsUuid))
|
||||
m_creatorIdAsUuid = UUID.Zero;
|
||||
}
|
||||
}
|
||||
protected string m_creatorId;
|
||||
|
||||
/// <value>
|
||||
/// The CreatorId expressed as a UUID.tely
|
||||
/// The CreatorId expressed as a UUID.
|
||||
/// </value>
|
||||
public UUID CreatorIdAsUuid
|
||||
{
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.8.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1.*")]
|
||||
|
||||
|
||||
@@ -82,6 +82,9 @@ namespace OpenSim.Framework.Monitoring
|
||||
// IRegionModuleBase.Initialize
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
IConfig cfg = source.Configs["Monitoring"];
|
||||
|
||||
if (cfg != null)
|
||||
@@ -141,19 +144,19 @@ namespace OpenSim.Framework.Monitoring
|
||||
processorPercentPerfCounter = new PerfCounterControl(tempPC);
|
||||
// A long time bug in mono is that CPU percent is reported as CPU percent idle. Windows reports CPU percent busy.
|
||||
tempStat = new Stat(tempName, tempName, "", "percent", CategoryServer, ContainerProcessor,
|
||||
StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter, Util.IsWindows() ? 1 : -1); },
|
||||
StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter); },
|
||||
StatVerbosity.Info);
|
||||
StatsManager.RegisterStat(tempStat);
|
||||
RegisteredStats.Add(tempName, tempStat);
|
||||
|
||||
MakeStat("TotalProcessorTime", null, "sec", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; });
|
||||
(s) => { s.Value = Math.Round(Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds, 3); });
|
||||
|
||||
MakeStat("UserProcessorTime", null, "sec", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; });
|
||||
(s) => { s.Value = Math.Round(Process.GetCurrentProcess().UserProcessorTime.TotalSeconds, 3); });
|
||||
|
||||
MakeStat("PrivilegedProcessorTime", null, "sec", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; });
|
||||
(s) => { s.Value = Math.Round(Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds, 3); });
|
||||
|
||||
MakeStat("Threads", null, "threads", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().Threads.Count; });
|
||||
@@ -253,11 +256,8 @@ namespace OpenSim.Framework.Monitoring
|
||||
// "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c
|
||||
// "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters
|
||||
private delegate double PerfCounterNextValue();
|
||||
|
||||
private void GetNextValue(Stat stat, PerfCounterControl perfControl)
|
||||
{
|
||||
GetNextValue(stat, perfControl, 1.0);
|
||||
}
|
||||
private void GetNextValue(Stat stat, PerfCounterControl perfControl, double factor)
|
||||
{
|
||||
if (Util.EnvironmentTickCountSubtract(perfControl.lastFetch) > performanceCounterSampleInterval)
|
||||
{
|
||||
@@ -265,16 +265,13 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
try
|
||||
{
|
||||
// Kludge for factor to run double duty. If -1, subtract the value from one
|
||||
if (factor == -1)
|
||||
stat.Value = 1 - perfControl.perfCounter.NextValue();
|
||||
else
|
||||
stat.Value = perfControl.perfCounter.NextValue() / factor;
|
||||
stat.Value = Math.Round(perfControl.perfCounter.NextValue(), 3);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("{0} Exception on NextValue fetching {1}: {2}", LogHeader, stat.Name, e);
|
||||
}
|
||||
|
||||
perfControl.lastFetch = Util.EnvironmentTickCount();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,8 @@ namespace OpenSim.Framework.Monitoring
|
||||
foreach (char c in DisallowedShortNameCharacters)
|
||||
{
|
||||
if (shortName.IndexOf(c) != -1)
|
||||
throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c));
|
||||
shortName = shortName.Replace(c, '#');
|
||||
// throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c));
|
||||
}
|
||||
|
||||
ShortName = shortName;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user