Compare commits
646 Commits
0.9.1.0-po
...
master
Author | SHA1 | Date |
---|---|---|
UbitUmarov | 4f00fb2659 | |
UbitUmarov | 87b55a0627 | |
UbitUmarov | 3b06891252 | |
UbitUmarov | 111c741f1b | |
UbitUmarov | 1c37f357b3 | |
UbitUmarov | c19a0cc21f | |
UbitUmarov | c575c211f9 | |
UbitUmarov | bd2476c61e | |
UbitUmarov | d52b794828 | |
UbitUmarov | cbc8974245 | |
UbitUmarov | e2982fbadc | |
UbitUmarov | c4a0b8fa3f | |
UbitUmarov | be5c2bb212 | |
UbitUmarov | 0c716cbd73 | |
UbitUmarov | e08ca7402c | |
UbitUmarov | d9a680703f | |
UbitUmarov | e0aff5e640 | |
UbitUmarov | bb56157c92 | |
UbitUmarov | 6fafb7462d | |
UbitUmarov | c077cfdd78 | |
UbitUmarov | c2af3a5474 | |
UbitUmarov | 25582af3dc | |
UbitUmarov | 03e3078a9f | |
UbitUmarov | 6e15cf41a4 | |
UbitUmarov | 53b9f87da6 | |
UbitUmarov | baa95b8707 | |
UbitUmarov | 730c864df8 | |
UbitUmarov | ce92ee1057 | |
UbitUmarov | 7a55f82f74 | |
UbitUmarov | 1f822c6077 | |
UbitUmarov | f7104a66a5 | |
UbitUmarov | 4176e1491e | |
UbitUmarov | 4bc74139a4 | |
UbitUmarov | 402186844c | |
UbitUmarov | 6a27f3fb20 | |
UbitUmarov | 6c5bf4ed25 | |
UbitUmarov | f32c0ead05 | |
UbitUmarov | b2068fd39f | |
UbitUmarov | ba972b50ed | |
UbitUmarov | fe7d9625aa | |
UbitUmarov | 6ba5b78851 | |
UbitUmarov | 541cb15751 | |
UbitUmarov | ebf5b69283 | |
UbitUmarov | 82ccf57533 | |
UbitUmarov | fe5e6d4189 | |
UbitUmarov | 01b4f83421 | |
UbitUmarov | f334c1206f | |
UbitUmarov | 107ece1ce0 | |
UbitUmarov | af6fa37cc2 | |
UbitUmarov | 28fcbc65f9 | |
UbitUmarov | e5c2bd505c | |
UbitUmarov | 5b596bb29e | |
UbitUmarov | c4f05016d7 | |
UbitUmarov | fb35f31078 | |
UbitUmarov | 7cf329c846 | |
UbitUmarov | 1c4300ff91 | |
UbitUmarov | 34fa6abc00 | |
UbitUmarov | d7fb822533 | |
UbitUmarov | 16cfb3deab | |
UbitUmarov | 27a81d4909 | |
UbitUmarov | a568b759bc | |
UbitUmarov | 71d8bcd90c | |
UbitUmarov | 86bd9ca255 | |
UbitUmarov | e2ffc17d1f | |
UbitUmarov | 73754670ca | |
UbitUmarov | b7750e52d6 | |
UbitUmarov | 63ae8a09c6 | |
UbitUmarov | 768f506a23 | |
UbitUmarov | 60da45b715 | |
UbitUmarov | 1d42d8ab6e | |
UbitUmarov | f3eb71113e | |
UbitUmarov | 7b3ac662dc | |
UbitUmarov | 16c18c0855 | |
UbitUmarov | eec92454b0 | |
UbitUmarov | 8fe2cd6c46 | |
UbitUmarov | 7b77609537 | |
UbitUmarov | 7da23b6714 | |
UbitUmarov | 53b0ee242d | |
UbitUmarov | 5b87347476 | |
UbitUmarov | e04af236f2 | |
UbitUmarov | 29bf9522e2 | |
UbitUmarov | bcacd2ff21 | |
UbitUmarov | 5b56a09cb2 | |
UbitUmarov | 17e7e9b354 | |
UbitUmarov | edf93abdbc | |
UbitUmarov | e3ecf0ddbe | |
UbitUmarov | d322248fd1 | |
UbitUmarov | dd2495be9d | |
UbitUmarov | 1b870131d4 | |
UbitUmarov | 362025be38 | |
UbitUmarov | 3c8b4423b1 | |
UbitUmarov | cca383b452 | |
UbitUmarov | f708b413a1 | |
UbitUmarov | 6cb2cb40cc | |
UbitUmarov | 8f79439558 | |
UbitUmarov | 44c90bf294 | |
UbitUmarov | 104f7f0eb2 | |
UbitUmarov | 369a2e1453 | |
UbitUmarov | e7807d4359 | |
UbitUmarov | e538628dec | |
UbitUmarov | 7a9e03876a | |
UbitUmarov | 24689f064c | |
UbitUmarov | 46dce3cedb | |
UbitUmarov | 70f867a518 | |
UbitUmarov | 24a0f0f6da | |
UbitUmarov | 833ae02121 | |
UbitUmarov | 00b2837d30 | |
UbitUmarov | 9ae867abd3 | |
UbitUmarov | 4329f5962a | |
UbitUmarov | b3ce8e9fc7 | |
UbitUmarov | 3a5d5fd50e | |
UbitUmarov | dfa69b1869 | |
UbitUmarov | d1c78564bb | |
UbitUmarov | d7089bcff2 | |
UbitUmarov | 05dc8594f0 | |
UbitUmarov | 1980c01eb8 | |
UbitUmarov | 9a18678fec | |
UbitUmarov | b37141182a | |
UbitUmarov | 3bf0f6c407 | |
UbitUmarov | e404d671c8 | |
UbitUmarov | d1ecccfaca | |
UbitUmarov | e407f69b2c | |
UbitUmarov | e8b9735f95 | |
UbitUmarov | 02ccbd0bbd | |
UbitUmarov | c6fcc33e49 | |
UbitUmarov | 13ed40d9f6 | |
UbitUmarov | 9ce70be5ce | |
UbitUmarov | 2179aa14e0 | |
UbitUmarov | efb2b67456 | |
UbitUmarov | fa0a87f1c0 | |
UbitUmarov | a61b5d5d38 | |
UbitUmarov | 8d2b502393 | |
UbitUmarov | e2be90caaf | |
UbitUmarov | 0d76635113 | |
UbitUmarov | bde4354c15 | |
UbitUmarov | fa0044fb6c | |
UbitUmarov | f4dfe2159c | |
UbitUmarov | 444a6b707b | |
UbitUmarov | 5b338fb31a | |
UbitUmarov | e1b234d9d0 | |
UbitUmarov | d3cb210080 | |
UbitUmarov | 351235f78e | |
UbitUmarov | 9c55c5bdb2 | |
UbitUmarov | 1a57abebfc | |
UbitUmarov | 775420c46a | |
UbitUmarov | b440a9534d | |
UbitUmarov | 38fc68ac0c | |
UbitUmarov | 7ef69edf33 | |
UbitUmarov | 7a07731371 | |
UbitUmarov | 84a3ff37ab | |
UbitUmarov | 301f28cfd4 | |
UbitUmarov | 2efa53af52 | |
UbitUmarov | 0a22bde6d1 | |
UbitUmarov | 3188db7041 | |
UbitUmarov | 06bdfc48d0 | |
UbitUmarov | 239c07ed9d | |
UbitUmarov | 8cebc84de7 | |
UbitUmarov | fde3727453 | |
UbitUmarov | 9b09bd255c | |
UbitUmarov | 9bd5310fe8 | |
UbitUmarov | 873b3b0af6 | |
UbitUmarov | 190acf093a | |
UbitUmarov | 43094592d5 | |
UbitUmarov | e0c49c42e3 | |
UbitUmarov | 41d9441512 | |
UbitUmarov | f0581ff1ff | |
UbitUmarov | 8ac70b6155 | |
UbitUmarov | 42b75021b6 | |
UbitUmarov | 5ac1fff43e | |
UbitUmarov | b541de034c | |
UbitUmarov | 7b8db526b3 | |
UbitUmarov | 9896224605 | |
UbitUmarov | 8f39405380 | |
UbitUmarov | 563d5d30ee | |
UbitUmarov | 182b266ec4 | |
UbitUmarov | d2dbe3f4d0 | |
UbitUmarov | 8a9ebe48ce | |
UbitUmarov | 0a48da85a3 | |
UbitUmarov | d460a3fc86 | |
UbitUmarov | 1c5b9e5af8 | |
UbitUmarov | 66eb8a2c2e | |
UbitUmarov | 5f52de2578 | |
UbitUmarov | cc4e14a88d | |
UbitUmarov | b598573f41 | |
UbitUmarov | 4679ede2f2 | |
UbitUmarov | f326cc8901 | |
UbitUmarov | 3c33d5c448 | |
UbitUmarov | 86d8f9963c | |
UbitUmarov | 8d8ead9776 | |
UbitUmarov | 6e0d82f584 | |
UbitUmarov | 35b0b77656 | |
UbitUmarov | 0bfacb7892 | |
UbitUmarov | fffac7d531 | |
UbitUmarov | 5167bd097b | |
UbitUmarov | 337832ecbe | |
UbitUmarov | 822fea4a99 | |
UbitUmarov | aca62392ac | |
UbitUmarov | 28b22a4fc1 | |
UbitUmarov | aca5728ab2 | |
UbitUmarov | e308ab8843 | |
UbitUmarov | 9ecee558b5 | |
UbitUmarov | 4fa8e20aab | |
UbitUmarov | fe72b54652 | |
UbitUmarov | 9ce52ed2fc | |
UbitUmarov | dc5a0244fc | |
UbitUmarov | cfe1285869 | |
UbitUmarov | 65ca238cd7 | |
UbitUmarov | baf5c61387 | |
UbitUmarov | 48892ad8a7 | |
UbitUmarov | 7098091616 | |
UbitUmarov | c0597e278b | |
UbitUmarov | 79bb22eaf6 | |
UbitUmarov | 214cf5d60b | |
UbitUmarov | 5848d3a6bb | |
UbitUmarov | 67bc086782 | |
UbitUmarov | 8b77162020 | |
UbitUmarov | dd55a3d19c | |
UbitUmarov | af1e20d054 | |
UbitUmarov | 4c7107dfda | |
UbitUmarov | f15c6be20c | |
UbitUmarov | a2c7a13065 | |
UbitUmarov | 51bc19f1ab | |
UbitUmarov | d613287a77 | |
UbitUmarov | c63fabe054 | |
UbitUmarov | 48df8869e8 | |
UbitUmarov | 6a4564869b | |
UbitUmarov | 7c0b3387dd | |
UbitUmarov | c40b297fc7 | |
UbitUmarov | 4bf4c76a64 | |
UbitUmarov | 8da733c485 | |
UbitUmarov | 713c222ec8 | |
UbitUmarov | 7f3bb9267a | |
UbitUmarov | 6d92b75452 | |
UbitUmarov | 2629d9d901 | |
UbitUmarov | c15869438c | |
UbitUmarov | aafc6579a1 | |
UbitUmarov | c1d69018bd | |
UbitUmarov | a367828a85 | |
UbitUmarov | ea11f1aeb8 | |
UbitUmarov | bcb9ab29d7 | |
UbitUmarov | fa5b4dc5d8 | |
UbitUmarov | 72c1c923f8 | |
UbitUmarov | c2c00c5d84 | |
UbitUmarov | f38c5d7ac2 | |
UbitUmarov | bf218f2cef | |
UbitUmarov | f70f0b5ffd | |
UbitUmarov | f0fc1f628f | |
UbitUmarov | 1908c095d3 | |
UbitUmarov | 58a4f45712 | |
UbitUmarov | 6c49f16132 | |
UbitUmarov | ac7187eada | |
UbitUmarov | d5baeb4690 | |
UbitUmarov | 1e8e59e635 | |
UbitUmarov | 41d7d2f2f4 | |
UbitUmarov | 0b0b5111df | |
UbitUmarov | 6d030e2f2b | |
UbitUmarov | 1ad3a256f2 | |
UbitUmarov | ab14241871 | |
UbitUmarov | 929fa3efbd | |
UbitUmarov | 5fa81a6ca9 | |
UbitUmarov | 22c28a0260 | |
UbitUmarov | 36d005e1cc | |
UbitUmarov | 003b109561 | |
UbitUmarov | b023914cc0 | |
UbitUmarov | 715c7a4825 | |
UbitUmarov | 52f50d2035 | |
UbitUmarov | 88a81a9ca4 | |
UbitUmarov | c289b83250 | |
UbitUmarov | 5da135a90b | |
UbitUmarov | ae15b75f79 | |
UbitUmarov | b0e1347cd0 | |
UbitUmarov | 693adf9ecf | |
UbitUmarov | 6c349e6534 | |
UbitUmarov | d42c7e5e32 | |
UbitUmarov | b069b668e4 | |
UbitUmarov | c39ffa4dd1 | |
UbitUmarov | 7b5934ea26 | |
UbitUmarov | 3a21d4de1e | |
UbitUmarov | 7a8a7c7168 | |
UbitUmarov | bff6be4f66 | |
UbitUmarov | f9e3c9adab | |
UbitUmarov | 3482259518 | |
UbitUmarov | 1f7286fb95 | |
UbitUmarov | 0b29bff512 | |
UbitUmarov | 1abc6149bb | |
UbitUmarov | d8b182afff | |
UbitUmarov | b6a02269f7 | |
UbitUmarov | dee822208a | |
UbitUmarov | 7e2ed9ee2b | |
UbitUmarov | bfcbdc8a93 | |
UbitUmarov | 5929e43c2c | |
UbitUmarov | 27ea249194 | |
UbitUmarov | b4fc5c33ec | |
UbitUmarov | 04b28f206a | |
UbitUmarov | 6d66770228 | |
UbitUmarov | b5067baa4a | |
UbitUmarov | 89dee19060 | |
UbitUmarov | fa844d7e6e | |
UbitUmarov | 0518b397a3 | |
UbitUmarov | a3cd0cbfcb | |
UbitUmarov | 9d08f8307e | |
UbitUmarov | 6ffb5bcf23 | |
UbitUmarov | 8526f938f7 | |
UbitUmarov | 8900d1139e | |
UbitUmarov | 6050eff683 | |
UbitUmarov | b68748507d | |
UbitUmarov | c07f4f3c41 | |
UbitUmarov | 05f098be56 | |
UbitUmarov | 473dba93e8 | |
UbitUmarov | e0418da6e1 | |
UbitUmarov | e63231887b | |
UbitUmarov | dcc2f764f2 | |
UbitUmarov | 70d2878d0a | |
UbitUmarov | cafe49d44b | |
UbitUmarov | d44baf20cd | |
UbitUmarov | 2d1900165b | |
UbitUmarov | 0348c01ce7 | |
UbitUmarov | 830b034b81 | |
UbitUmarov | 8fb4b2f4e3 | |
UbitUmarov | 5bde41b30f | |
UbitUmarov | 605a01fe6e | |
UbitUmarov | 99658309ce | |
UbitUmarov | ee77a6d80b | |
UbitUmarov | 80de74e127 | |
UbitUmarov | 7f2cfe734b | |
UbitUmarov | eae9928961 | |
UbitUmarov | 288dffcda1 | |
UbitUmarov | e48d2f2c1f | |
UbitUmarov | 23961abf8a | |
UbitUmarov | bac6890391 | |
UbitUmarov | 07caee4956 | |
UbitUmarov | 84cd4b4808 | |
UbitUmarov | 3d09ff57f0 | |
UbitUmarov | 7856192da6 | |
UbitUmarov | ba8d188a0d | |
UbitUmarov | 76019258e3 | |
UbitUmarov | 899620bc13 | |
UbitUmarov | f955482dfd | |
UbitUmarov | 8d2f90a8e2 | |
UbitUmarov | 9000240238 | |
UbitUmarov | ca5756a100 | |
UbitUmarov | f2a025bc41 | |
UbitUmarov | 6cd822fd83 | |
UbitUmarov | 7a24d8af52 | |
UbitUmarov | 9a5a811c7d | |
UbitUmarov | 426d83c535 | |
UbitUmarov | 46162e620a | |
UbitUmarov | 10988fe980 | |
UbitUmarov | 0fe51f34c2 | |
UbitUmarov | e818c570bb | |
UbitUmarov | 5a51553e7d | |
UbitUmarov | fefcda52f5 | |
UbitUmarov | 92518129ee | |
UbitUmarov | 212c25f906 | |
UbitUmarov | 6b6baa9e51 | |
UbitUmarov | 1475b83699 | |
UbitUmarov | 50b81258a9 | |
UbitUmarov | 43fdbf87d4 | |
UbitUmarov | c097f148dd | |
UbitUmarov | e2f84f0c1f | |
UbitUmarov | 4ab8da01bc | |
UbitUmarov | bdddedc550 | |
UbitUmarov | e859985cfa | |
UbitUmarov | 7572a60993 | |
UbitUmarov | a6abc3d2b6 | |
UbitUmarov | 944f3dd7ec | |
UbitUmarov | f20845c89e | |
UbitUmarov | 8baab939d2 | |
UbitUmarov | 920a26eeec | |
UbitUmarov | b419f71a68 | |
UbitUmarov | e0ba96055c | |
UbitUmarov | 745a469af8 | |
UbitUmarov | d1f1324a2d | |
UbitUmarov | bbc5d5bc2d | |
UbitUmarov | f95925e0fd | |
UbitUmarov | 7ce9f890b1 | |
UbitUmarov | 0d940df4e2 | |
UbitUmarov | 1c6d454691 | |
UbitUmarov | 6fea9dafaf | |
UbitUmarov | 50cd0ab982 | |
UbitUmarov | 0a1e1ae9e0 | |
UbitUmarov | 7ecc9408a9 | |
UbitUmarov | 05c77f9342 | |
UbitUmarov | c99014991b | |
UbitUmarov | 523d6dd2da | |
UbitUmarov | f976d10de2 | |
UbitUmarov | f0f067d05c | |
UbitUmarov | b4eb5d6cca | |
UbitUmarov | 29f59fe407 | |
UbitUmarov | 3989dbac31 | |
UbitUmarov | 0a4232430b | |
UbitUmarov | 50b8c90b42 | |
UbitUmarov | f1761a5b6c | |
UbitUmarov | 4af5dfa0d0 | |
UbitUmarov | 1e083c38ad | |
UbitUmarov | fe9df55410 | |
UbitUmarov | 67cd5efab3 | |
UbitUmarov | 650b051cdf | |
UbitUmarov | 817c2b3bb9 | |
UbitUmarov | e558dd3ac6 | |
UbitUmarov | ef49ac7049 | |
UbitUmarov | 2e66f8dbdf | |
UbitUmarov | 0958eceadd | |
UbitUmarov | 87646f340b | |
UbitUmarov | 1002987aea | |
UbitUmarov | 918f56d682 | |
UbitUmarov | 8e6fc69a11 | |
UbitUmarov | 0a4a3199f5 | |
UbitUmarov | f1204e2147 | |
UbitUmarov | 9ce4b8914b | |
UbitUmarov | 010f091dd4 | |
UbitUmarov | 9864d1abfc | |
UbitUmarov | f2c0957f5a | |
UbitUmarov | ac43124a93 | |
UbitUmarov | 59d3f9fa62 | |
UbitUmarov | 5401e323dc | |
UbitUmarov | cfef190424 | |
UbitUmarov | 63c5da539f | |
UbitUmarov | 5f76a62d29 | |
UbitUmarov | b292950b1c | |
UbitUmarov | beee52032e | |
UbitUmarov | c172adbaec | |
UbitUmarov | e4f7a1c07a | |
UbitUmarov | 033f6f889d | |
UbitUmarov | 2e9417bd01 | |
UbitUmarov | cf5630f2f7 | |
UbitUmarov | 3956fbe496 | |
UbitUmarov | 98de42eedc | |
UbitUmarov | 38b93a0f50 | |
UbitUmarov | abe26f39f6 | |
UbitUmarov | 1df06f459a | |
UbitUmarov | 8728e4cf2f | |
UbitUmarov | ad601c9502 | |
UbitUmarov | 20b974cff0 | |
UbitUmarov | ed34c00956 | |
UbitUmarov | d0ba9f84df | |
UbitUmarov | 248d56d3ad | |
UbitUmarov | 6684c35bb0 | |
UbitUmarov | 25b4a310f5 | |
UbitUmarov | c30cb8a9cf | |
UbitUmarov | be16cf9531 | |
UbitUmarov | 97cb6254ef | |
UbitUmarov | 904553cdb3 | |
UbitUmarov | d3b1465444 | |
UbitUmarov | cf948d56a1 | |
UbitUmarov | 7e9ce0929d | |
UbitUmarov | 693492a3f1 | |
UbitUmarov | dc225e348d | |
UbitUmarov | 71b5ca95e6 | |
UbitUmarov | e76006aff5 | |
UbitUmarov | 49386d34e5 | |
UbitUmarov | af7d09c6b5 | |
UbitUmarov | 4d67fdfa9d | |
UbitUmarov | 3707301c59 | |
UbitUmarov | 665037e366 | |
UbitUmarov | 22e201bb49 | |
UbitUmarov | 7ef657c415 | |
UbitUmarov | d1df9c9ee5 | |
UbitUmarov | 8c74e47557 | |
UbitUmarov | c2ca5a699d | |
UbitUmarov | ad5aff2d17 | |
UbitUmarov | 94f88e330b | |
UbitUmarov | ea8eeaa307 | |
UbitUmarov | 7d7fc8f06a | |
UbitUmarov | 20d77d3905 | |
UbitUmarov | 771381558e | |
UbitUmarov | 6dd5ea0c96 | |
UbitUmarov | 828a3bb7f8 | |
UbitUmarov | ca48bf4117 | |
UbitUmarov | c9137912c9 | |
UbitUmarov | ceb9289f13 | |
UbitUmarov | d47ce25b5b | |
UbitUmarov | 6cadcb8bdf | |
UbitUmarov | df2536c407 | |
UbitUmarov | 1de010e969 | |
UbitUmarov | 72d38b267e | |
UbitUmarov | 5f232077a7 | |
UbitUmarov | 270a3e3836 | |
UbitUmarov | c887446b7e | |
UbitUmarov | 60a924f3c6 | |
UbitUmarov | 0e6a7c3dac | |
UbitUmarov | 6c94f5d432 | |
UbitUmarov | 7c977f9e27 | |
UbitUmarov | d7671f3c01 | |
UbitUmarov | 8d8b5b756f | |
UbitUmarov | 6d2bb27ef7 | |
UbitUmarov | c8a95e21ee | |
UbitUmarov | b9cf2244a4 | |
UbitUmarov | c11249f1ca | |
UbitUmarov | 23aae75563 | |
UbitUmarov | e155ab7814 | |
UbitUmarov | 59414467e2 | |
UbitUmarov | 55333a5171 | |
UbitUmarov | a42085f1a9 | |
UbitUmarov | 20a08c9f41 | |
UbitUmarov | fa4602e048 | |
UbitUmarov | 0e7c19e181 | |
UbitUmarov | 75e5217fff | |
UbitUmarov | e1d5892f78 | |
UbitUmarov | f3238781cc | |
UbitUmarov | fb2380efd6 | |
UbitUmarov | 11c49c211c | |
UbitUmarov | c239269762 | |
UbitUmarov | ce72aa2eac | |
UbitUmarov | b97237b513 | |
UbitUmarov | 8cbe743440 | |
UbitUmarov | 68e7e65e2e | |
UbitUmarov | 9478e607db | |
UbitUmarov | 22227fa0b8 | |
UbitUmarov | c2ab11a51e | |
UbitUmarov | 169f161576 | |
UbitUmarov | 43fea6530f | |
UbitUmarov | c245ce3c25 | |
UbitUmarov | b2ef1545e5 | |
UbitUmarov | 88d91b68f7 | |
UbitUmarov | 8060d132b9 | |
UbitUmarov | 7a79a6ddfe | |
UbitUmarov | 4de3dc2860 | |
UbitUmarov | 18f2e25b23 | |
UbitUmarov | 3196d2fa6f | |
UbitUmarov | 662c41ddee | |
UbitUmarov | a22acd1c5c | |
UbitUmarov | 9a5844fdb9 | |
UbitUmarov | 441b4e01f6 | |
UbitUmarov | 941b65b44a | |
UbitUmarov | fdecf80016 | |
UbitUmarov | 016886b3c6 | |
UbitUmarov | f89afd2aa8 | |
UbitUmarov | fb1911d409 | |
UbitUmarov | 8075c1e363 | |
UbitUmarov | 53c9473100 | |
UbitUmarov | 76987fb647 | |
UbitUmarov | 8df27ba2a1 | |
UbitUmarov | 868c05fdf6 | |
UbitUmarov | 5bb96cf18e | |
UbitUmarov | 004cab9289 | |
UbitUmarov | 64c7e1de5b | |
UbitUmarov | 598ba5d6ae | |
UbitUmarov | f61b83b1ea | |
UbitUmarov | 2a38210fe9 | |
UbitUmarov | 33eabf1069 | |
UbitUmarov | da0ba17d1a | |
UbitUmarov | 59f41598db | |
UbitUmarov | 7adaede14a | |
UbitUmarov | 8db60ba3aa | |
UbitUmarov | 8cc02916ab | |
UbitUmarov | 3f601c9267 | |
UbitUmarov | 0bd102a397 | |
UbitUmarov | 0e1e247289 | |
UbitUmarov | b70d44eb7e | |
UbitUmarov | 80fe0c640b | |
UbitUmarov | 54370169bc | |
UbitUmarov | ad6499cc09 | |
UbitUmarov | ddef089eaa | |
UbitUmarov | f85e932f59 | |
UbitUmarov | ba174b777c | |
UbitUmarov | 28db80f100 | |
UbitUmarov | 8db2ddb07f | |
UbitUmarov | 550f64cb2d | |
UbitUmarov | 2b2b5d8bff | |
UbitUmarov | 5ad62558b3 | |
UbitUmarov | 1899a36105 | |
UbitUmarov | 62f3892cd7 | |
UbitUmarov | 6f5b7957a9 | |
UbitUmarov | f417a647db | |
UbitUmarov | c2cef470f5 | |
UbitUmarov | b9e74dd504 | |
UbitUmarov | 29a6c1d0c8 | |
UbitUmarov | ea7dd150b1 | |
UbitUmarov | d92ef598c5 | |
UbitUmarov | ac32188978 | |
UbitUmarov | 5dbcb7a99e | |
UbitUmarov | 42afa8429e | |
UbitUmarov | c54460b6f0 | |
UbitUmarov | d9d763c8f8 | |
UbitUmarov | 7bdc408cac | |
UbitUmarov | 066a6fbaa1 | |
UbitUmarov | 7516288634 | |
UbitUmarov | 60473ff44e | |
UbitUmarov | 8c21b30a51 | |
UbitUmarov | d400b2c545 | |
UbitUmarov | 449bd9beab | |
UbitUmarov | 052e4a060c | |
UbitUmarov | 5c5e4bd830 | |
UbitUmarov | b3db90db92 | |
UbitUmarov | bd15005d77 | |
UbitUmarov | e8d1493777 | |
UbitUmarov | 17e4b52171 | |
UbitUmarov | 9aa0f21ffa | |
UbitUmarov | 6e2b5ac238 | |
UbitUmarov | 14270e316a | |
UbitUmarov | 2a508edcb4 | |
UbitUmarov | 943d0935a6 | |
UbitUmarov | d5f918f945 | |
UbitUmarov | 9b7ad30ee1 | |
UbitUmarov | 647622bb02 | |
UbitUmarov | bd12d60e80 | |
UbitUmarov | 0cf3ec553a | |
UbitUmarov | 730a35eedc | |
UbitUmarov | bf0697d5f4 | |
UbitUmarov | 496a2228f5 | |
UbitUmarov | b5d2a6088c | |
UbitUmarov | 3708f504a6 | |
Diva Canto | 72362dd09c | |
Crista Lopes | 9fd2b239d9 | |
UbitUmarov | 7dd5c9ccad | |
UbitUmarov | 103ebac082 | |
UbitUmarov | 61f918cbda | |
UbitUmarov | cb97ab5c6f | |
UbitUmarov | 45625a02a2 | |
UbitUmarov | 31aef4e82b | |
Terry | 999a068172 | |
Terry | 2f79f463ea | |
UbitUmarov | eabf9a7c04 | |
UbitUmarov | d9d78c3423 | |
UbitUmarov | 5d2ffdc35b | |
UbitUmarov | 2828aa3e9b | |
UbitUmarov | 8fcecc93a6 | |
UbitUmarov | d10f11d310 | |
UbitUmarov | 9eb5fd4330 | |
UbitUmarov | 01832b3e3c | |
UbitUmarov | e87dfd48bf | |
UbitUmarov | 38a77a8bb5 | |
UbitUmarov | ee68085628 | |
UbitUmarov | 435c30c038 | |
UbitUmarov | b4d9f7ffe8 | |
UbitUmarov | f6ea22647d | |
UbitUmarov | 727216044b | |
UbitUmarov | 53339d2970 | |
UbitUmarov | 4b5a3308ad | |
UbitUmarov | ca4bb8c492 | |
UbitUmarov | bd9f6ae3f0 | |
UbitUmarov | 8ed0680bb9 | |
UbitUmarov | 926e4ea95e | |
UbitUmarov | 11a357d7fa | |
UbitUmarov | 040c8d5e9a | |
UbitUmarov | 21f86c453d | |
UbitUmarov | bae7b21e87 | |
UbitUmarov | f2cf3b201b | |
UbitUmarov | 26b5affb04 | |
UbitUmarov | 3236e24c74 | |
UbitUmarov | 5a3ba2afbb | |
UbitUmarov | 9d6a1e01f9 | |
UbitUmarov | defa235859 | |
UbitUmarov | 4797f8210c | |
UbitUmarov | b073d2ae6b |
|
@ -185,15 +185,18 @@ what it is today.
|
|||
* SpotOn3D
|
||||
* Stefan_Boom / stoehr
|
||||
* Steven Zielinski (MOSES)
|
||||
* Stolen Ruby
|
||||
* Strawberry Fride
|
||||
* Talun
|
||||
* TechplexEngineer (Blake Bourque)
|
||||
* TBG Renfold
|
||||
* Terry Ford
|
||||
* tglion
|
||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||
* TomDataWorks
|
||||
* TomTheDragon (muckwaddle)
|
||||
* tyre
|
||||
* uriesk
|
||||
* Vegaslon <vegaslon@gmail.com>
|
||||
* Vincent Sylvester
|
||||
* VikingErik
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace OpenSim.Groups
|
|||
|
||||
m_debugEnabled = verbose;
|
||||
|
||||
MainConsole.Instance.Output("{0} verbose logging set to {1}", null, Name, m_debugEnabled);
|
||||
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -599,13 +599,16 @@ namespace OpenSim.Groups
|
|||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
|
||||
|
||||
UUID fromAgent = new UUID(msg.fromAgentID);
|
||||
// Force? open the group session dialog???
|
||||
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
|
||||
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||
if (eq != null)
|
||||
{
|
||||
eq.ChatterboxInvitation(
|
||||
GroupID
|
||||
, groupInfo.GroupName
|
||||
, new UUID(msg.fromAgentID)
|
||||
, fromAgent
|
||||
, msg.message
|
||||
, AgentID
|
||||
, msg.fromAgentName
|
||||
|
@ -620,15 +623,10 @@ namespace OpenSim.Groups
|
|||
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
|
||||
);
|
||||
|
||||
eq.ChatterBoxSessionAgentListUpdates(
|
||||
new UUID(GroupID)
|
||||
, AgentID
|
||||
, new UUID(msg.toAgentID)
|
||||
, false //canVoiceChat
|
||||
, false //isModerator
|
||||
, false //text mute
|
||||
, true // Enter
|
||||
);
|
||||
var update = new GroupChatListAgentUpdateData(AgentID);
|
||||
var updates = new List<GroupChatListAgentUpdateData> { update };
|
||||
eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -663,15 +661,12 @@ namespace OpenSim.Groups
|
|||
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
|
||||
|
||||
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||
queue.ChatterBoxSessionAgentListUpdates(
|
||||
GroupID
|
||||
, AgentID
|
||||
, new UUID(im.toAgentID)
|
||||
, false //canVoiceChat
|
||||
, false //isModerator
|
||||
, false //text mute
|
||||
, true
|
||||
);
|
||||
if (queue != null)
|
||||
{
|
||||
var update = new GroupChatListAgentUpdateData(AgentID);
|
||||
var updates = new List<GroupChatListAgentUpdateData> { update };
|
||||
queue.ChatterBoxSessionAgentListUpdates(GroupID, remoteClient.AgentId, updates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,11 +708,7 @@ namespace OpenSim.Groups
|
|||
bodyMap.Add("session_info", sessionMap);
|
||||
|
||||
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||
|
||||
if (queue != null)
|
||||
{
|
||||
queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
|
||||
}
|
||||
queue?.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
|
||||
}
|
||||
|
||||
private void DebugGridInstantMessage(GridInstantMessage im)
|
||||
|
|
|
@ -38,7 +38,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
|
||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Groups
|
|||
|
||||
m_debugEnabled = verbose;
|
||||
|
||||
MainConsole.Instance.Output("{0} verbose logging set to {1}", null, Name, m_debugEnabled);
|
||||
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -233,7 +233,7 @@ namespace OpenSim.Groups
|
|||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
|
||||
client.OnRequestAvatarProperties += OnRequestAvatarProperties;
|
||||
//client.OnRequestAvatarProperties += OnRequestAvatarProperties;
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,7 +261,7 @@ namespace OpenSim.Groups
|
|||
// Used for Notices and Group Invites/Accept/Reject
|
||||
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
|
||||
}
|
||||
|
||||
/*
|
||||
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
@ -269,7 +269,7 @@ namespace OpenSim.Groups
|
|||
GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
|
||||
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
|
||||
}
|
||||
|
||||
*/
|
||||
private void OnClientClosed(UUID AgentId, Scene scene)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
@ -281,7 +281,7 @@ namespace OpenSim.Groups
|
|||
if (client != null)
|
||||
{
|
||||
client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
|
||||
client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
|
||||
//client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
|
||||
// make child possible not called?
|
||||
client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
|
||||
client.OnInstantMessage -= OnInstantMessage;
|
||||
|
@ -344,14 +344,24 @@ namespace OpenSim.Groups
|
|||
|
||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[Groups]: OnInstantMessage called");
|
||||
|
||||
if(remoteClient == null || !remoteClient.IsActive || remoteClient.AgentId == UUID.Zero)
|
||||
return;
|
||||
|
||||
Scene scene = (Scene)remoteClient.Scene;
|
||||
if (scene == null)
|
||||
return;
|
||||
|
||||
string remoteAgentIDstr = remoteClient.AgentId.ToString();
|
||||
|
||||
//m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
|
||||
// Group invitations
|
||||
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
||||
{
|
||||
UUID inviteID = new UUID(im.imSessionID);
|
||||
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
|
||||
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(remoteAgentIDstr, inviteID);
|
||||
|
||||
if (inviteInfo == null)
|
||||
{
|
||||
|
@ -374,7 +384,7 @@ namespace OpenSim.Groups
|
|||
|
||||
// and the sessionid is the role
|
||||
string reason = string.Empty;
|
||||
if (!m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
|
||||
if (!m_groupData.AddAgentToGroup(remoteAgentIDstr, invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
|
||||
remoteClient.SendAgentAlertMessage("Unable to add you to the group: " + reason, false);
|
||||
else
|
||||
{
|
||||
|
@ -401,104 +411,155 @@ namespace OpenSim.Groups
|
|||
}
|
||||
}
|
||||
|
||||
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
|
||||
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
|
||||
}
|
||||
|
||||
// Reject
|
||||
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[Groups]: Received a reject invite notice.");
|
||||
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[Groups]: Received a reject invite notice.");
|
||||
|
||||
m_groupData.RemoveAgentFromGroup(GetRequestingAgentIDStr(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID);
|
||||
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
|
||||
m_groupData.RemoveAgentFromGroup(remoteAgentIDstr, inviteInfo.AgentID, inviteInfo.GroupID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Group notices
|
||||
if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
|
||||
else if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
|
||||
{
|
||||
if (!m_groupNoticesEnabled)
|
||||
return;
|
||||
|
||||
UUID GroupID = new UUID(im.toAgentID);
|
||||
GroupMembershipData grpMemberData = m_groupData.GetAgentGroupMembership(remoteAgentIDstr, remoteAgentIDstr, GroupID);
|
||||
if (grpMemberData == null)
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Group membership not found", false);
|
||||
return;
|
||||
}
|
||||
|
||||
UUID GroupID = new UUID(im.toAgentID);
|
||||
if (m_groupData.GetGroupRecord(GetRequestingAgentIDStr(remoteClient), GroupID, null) != null)
|
||||
if ((grpMemberData.GroupPowers & (ulong)GroupPowers.SendNotices) == 0)
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("No permission to send notice to group", false);
|
||||
return;
|
||||
}
|
||||
|
||||
int index = im.message.IndexOf('|');
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
string Subject = im.message.Substring(0, index);
|
||||
string Message = im.message.Substring(index + 1);
|
||||
|
||||
UUID NoticeID = UUID.Random();
|
||||
string Subject = im.message.Substring(0, im.message.IndexOf('|'));
|
||||
string Message = im.message.Substring(Subject.Length + 1);
|
||||
|
||||
InventoryItemBase item = null;
|
||||
bool hasAttachment = false;
|
||||
|
||||
if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
|
||||
{
|
||||
hasAttachment = true;
|
||||
string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
|
||||
binBucket = binBucket.Remove(0, 14).Trim();
|
||||
|
||||
OSD binBucketOSD = OSDParser.DeserializeLLSDXml(binBucket);
|
||||
if (binBucketOSD is OSDMap)
|
||||
UUID itemID = UUID.Zero;
|
||||
UUID ownerID = UUID.Zero;
|
||||
try
|
||||
{
|
||||
OSDMap binBucketMap = (OSDMap)binBucketOSD;
|
||||
string binBucket = Utils.BytesToString(im.binaryBucket);
|
||||
binBucket = binBucket.Substring(15); // remove extra LLSD pre header
|
||||
|
||||
UUID itemID = binBucketMap["item_id"].AsUUID();
|
||||
UUID ownerID = binBucketMap["owner_id"].AsUUID();
|
||||
item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
|
||||
OSDMap binBucketMAP = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
|
||||
itemID = binBucketMAP["item_id"].AsUUID();
|
||||
ownerID = binBucketMAP["owner_id"].AsUUID();
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
|
||||
catch
|
||||
{
|
||||
m_log.DebugFormat("[GROUPS]: failed to decode group notice bucket");
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
|
||||
if (itemID != UUID.Zero && ownerID != UUID.Zero)
|
||||
{
|
||||
item = scene.InventoryService.GetItem(ownerID, itemID);
|
||||
if(item != null)
|
||||
{
|
||||
if ((item.CurrentPermissions & (uint)(PermissionMask.Transfer | PermissionMask.Copy)) !=
|
||||
(uint)(PermissionMask.Transfer | PermissionMask.Copy))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Item must be have Copy and Transfer rights to attach to group notice", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
hasAttachment = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_groupData.AddGroupNotice(remoteAgentIDstr, GroupID, NoticeID, im.fromAgentName, Subject, Message,
|
||||
hasAttachment,
|
||||
(byte)(item == null ? 0 : item.AssetType),
|
||||
item == null ? null : item.Name,
|
||||
item == null ? UUID.Zero : item.ID,
|
||||
item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
|
||||
{
|
||||
if (OnNewGroupNotice != null)
|
||||
{
|
||||
OnNewGroupNotice(GroupID, NoticeID);
|
||||
}
|
||||
OnNewGroupNotice?.Invoke(GroupID, NoticeID);
|
||||
|
||||
// Send notice out to everyone that wants notices
|
||||
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
|
||||
foreach (GroupMembersData member in m_groupData.GetGroupMembers(remoteAgentIDstr, GroupID))
|
||||
{
|
||||
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)InstantMessageDialog.GroupNotice);
|
||||
if (member.AcceptNotices)
|
||||
{
|
||||
// Build notice IIM, one of reach, because the sending may be async
|
||||
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
|
||||
msg.toAgentID = member.AgentID.Guid;
|
||||
OutgoingInstantMessage(msg, member.AgentID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted)
|
||||
{
|
||||
if (im.binaryBucket.Length < 16) // Invalid
|
||||
if (!m_groupNoticesEnabled)
|
||||
return;
|
||||
|
||||
//// 16 bytes are the UUID. Maybe.
|
||||
// UUID folderID = new UUID(im.binaryBucket, 0);
|
||||
UUID noticeID = new UUID(im.imSessionID);
|
||||
|
||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);
|
||||
if (notice != null)
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[xmlGROUPS]: Accepted notice {0} for {1}", noticeID, remoteClient.AgentId);
|
||||
|
||||
if (noticeID == UUID.Zero)
|
||||
return;
|
||||
|
||||
UUID folderID = UUID.Zero;
|
||||
try
|
||||
{
|
||||
if (im.binaryBucket != null && im.binaryBucket.Length >= 16)
|
||||
folderID = new UUID(im.binaryBucket, 0);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.DebugFormat("[xmlGROUPS]: GroupNoticeInventoryAccepted failed to decode target folder");
|
||||
return;
|
||||
}
|
||||
|
||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
|
||||
if (notice == null)
|
||||
{
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
|
||||
noticeID, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
string tmp;
|
||||
UUID giver = new UUID(im.toAgentID);
|
||||
string tmp = string.Empty;
|
||||
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, out message);
|
||||
|
||||
string message = "Could not find group notice attached item";
|
||||
InventoryItemBase itemCopy = scene.GiveInventoryItem(remoteClient.AgentId,
|
||||
giver, notice.noticeData.AttachmentItemID, folderID, out message);
|
||||
|
||||
if (itemCopy == null)
|
||||
{
|
||||
|
@ -508,14 +569,79 @@ namespace OpenSim.Groups
|
|||
|
||||
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
||||
}
|
||||
|
||||
else if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryDeclined)
|
||||
{
|
||||
if (!m_groupNoticesEnabled)
|
||||
return;
|
||||
|
||||
UUID noticeID = new UUID(im.imSessionID);
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS]: Accepted notice {0} for {1}", noticeID, remoteAgentIDstr);
|
||||
|
||||
if (noticeID == UUID.Zero)
|
||||
return;
|
||||
|
||||
UUID remoteAgentID = remoteClient.AgentId;
|
||||
|
||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
|
||||
if (notice == null)
|
||||
{
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
|
||||
noticeID, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
string giver = notice.noticeData.AttachmentOwnerID;
|
||||
UUID attachmentUUID = notice.noticeData.AttachmentItemID;
|
||||
|
||||
if (attachmentUUID == null ||
|
||||
attachmentUUID == UUID.Zero ||
|
||||
giver == null ||
|
||||
giver == UUID.Zero.ToString()
|
||||
)
|
||||
return;
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[xmlGroups]: Deny inventory from {0} to {1}", giver, remoteAgentIDstr);
|
||||
|
||||
string message = String.Empty;
|
||||
|
||||
InventoryItemBase itemCopy = scene.InventoryService.GetItem(remoteAgentID, attachmentUUID);
|
||||
if (itemCopy == null)
|
||||
return;
|
||||
|
||||
InventoryFolderBase trash = scene.InventoryService.GetFolderForType(remoteAgentID, FolderType.Trash);
|
||||
if (trash == null)
|
||||
{
|
||||
m_log.DebugFormat("[GROUPS]: failed to find trash folder for {0} ", remoteAgentID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemCopy.Folder == trash.ID || remoteAgentIDstr == notice.noticeData.AttachmentOwnerID)
|
||||
return;
|
||||
|
||||
itemCopy.Folder = trash.ID;
|
||||
scene.InventoryService.MoveItems(itemCopy.Owner, new List<InventoryItemBase>() { itemCopy });
|
||||
|
||||
if (itemCopy == null)
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(message, false);
|
||||
return;
|
||||
}
|
||||
|
||||
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
||||
}
|
||||
|
||||
|
||||
// Interop, received special 210 code for ejecting a group member
|
||||
// this only works within the comms servers domain, and won't work hypergrid
|
||||
// TODO:FIXME: Use a presense server of some kind to find out where the
|
||||
// client actually is, and try contacting that region directly to notify them,
|
||||
// or provide the notification via xmlrpc update queue
|
||||
if ((im.dialog == 210))
|
||||
else if ((im.dialog == 210))
|
||||
{
|
||||
// This is sent from the region that the ejectee was ejected from
|
||||
// if it's being delivered here, then the ejectee is here
|
||||
|
@ -949,6 +1075,7 @@ namespace OpenSim.Groups
|
|||
bucket = new byte[19 + name.Length];
|
||||
bucket[0] = 1; // has attachment?
|
||||
bucket[1] = info.noticeData.AttachmentType; // attachment type
|
||||
info.GroupID.ToBytes(bucket, 2);
|
||||
name.CopyTo(bucket, 18);
|
||||
}
|
||||
else
|
||||
|
@ -959,7 +1086,6 @@ namespace OpenSim.Groups
|
|||
bucket[18] = 0; // null terminated
|
||||
}
|
||||
|
||||
info.GroupID.ToBytes(bucket, 2);
|
||||
msg.binaryBucket = bucket;
|
||||
}
|
||||
else
|
||||
|
@ -1208,7 +1334,7 @@ namespace OpenSim.Groups
|
|||
|
||||
public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
|
||||
{
|
||||
return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query);
|
||||
return m_groupData.FindGroups(remoteClient.AgentId.ToString(), query);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -246,9 +246,9 @@ namespace OpenSim.Groups
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
|
||||
{
|
||||
return m_LocalGroupsConnector.FindGroups(AgentUUI(RequestingAgentID), search);
|
||||
return m_LocalGroupsConnector.FindGroups(RequestingAgentIDstr, search);
|
||||
}
|
||||
|
||||
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Groups
|
|||
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
|
||||
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
|
||||
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
|
||||
List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search);
|
||||
List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search);
|
||||
List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID);
|
||||
|
||||
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason);
|
||||
|
|
|
@ -173,9 +173,9 @@ namespace OpenSim.Groups
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
|
||||
{
|
||||
return m_GroupsService.FindGroups(RequestingAgentID, search);
|
||||
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
|
||||
}
|
||||
|
||||
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace OpenSim.Groups
|
|||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
}
|
||||
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string query)
|
||||
{
|
||||
List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
|
||||
if (string.IsNullOrEmpty(query))
|
||||
|
@ -161,7 +161,7 @@ namespace OpenSim.Groups
|
|||
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
sendData["Query"] = query;
|
||||
sendData["RequestingAgentID"] = RequestingAgentID;
|
||||
sendData["RequestingAgentID"] = RequestingAgentIDstr;
|
||||
|
||||
Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);
|
||||
|
||||
|
|
|
@ -192,10 +192,10 @@ namespace OpenSim.Groups
|
|||
});
|
||||
}
|
||||
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
|
||||
{
|
||||
// TODO!
|
||||
return m_GroupsService.FindGroups(RequestingAgentID, search);
|
||||
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
|
||||
}
|
||||
|
||||
public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace OpenSim.Groups
|
|||
GroupPowers.LandDeed |
|
||||
GroupPowers.LandDivideJoin |
|
||||
GroupPowers.LandEdit |
|
||||
GroupPowers.AllowEnvironment |
|
||||
GroupPowers.LandEjectAndFreeze |
|
||||
GroupPowers.LandGardening |
|
||||
GroupPowers.LandManageAllowed |
|
||||
|
|
|
@ -110,10 +110,9 @@ namespace OpenSim.OfflineIM
|
|||
{
|
||||
m_serializer.Serialize(writer, im);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
OfflineIMData data = new OfflineIMData();
|
||||
data.PrincipalID = principalID;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
@ -49,9 +50,9 @@ namespace OpenSim.Framework.Capabilities
|
|||
/// </summary>
|
||||
public delegate IClientAPI GetClientDelegate(UUID agentID);
|
||||
|
||||
public class Caps
|
||||
public class Caps : IDisposable
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_httpListenerHostName;
|
||||
private uint m_httpListenPort;
|
||||
|
@ -64,8 +65,8 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
private CapsHandlers m_capsHandlers;
|
||||
|
||||
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
|
||||
= new Dictionary<string, PollServiceEventArgs>();
|
||||
private ConcurrentDictionary<string, PollServiceEventArgs> m_pollServiceHandlers
|
||||
= new ConcurrentDictionary<string, PollServiceEventArgs>();
|
||||
|
||||
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
|
||||
|
||||
|
@ -125,7 +126,9 @@ namespace OpenSim.Framework.Capabilities
|
|||
None = 0,
|
||||
SentSeeds = 1,
|
||||
|
||||
ObjectAnim = 0x10
|
||||
ObjectAnim = 0x100,
|
||||
WLEnv = 0x200,
|
||||
AdvEnv = 0x400
|
||||
}
|
||||
|
||||
public CapsFlags Flags { get; set;}
|
||||
|
@ -163,6 +166,23 @@ namespace OpenSim.Framework.Capabilities
|
|||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void Dispose(bool disposing)
|
||||
{
|
||||
Flags = CapsFlags.None;
|
||||
if (m_capsActive != null)
|
||||
{
|
||||
DeregisterHandlers();
|
||||
m_capsActive.Dispose();
|
||||
m_capsActive = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a handler. This allows modules to register handlers.
|
||||
/// </summary>
|
||||
|
@ -174,15 +194,27 @@ namespace OpenSim.Framework.Capabilities
|
|||
m_capsHandlers[capName] = handler;
|
||||
}
|
||||
|
||||
public void RegisterSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
|
||||
{
|
||||
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
|
||||
m_capsHandlers.AddSimpleHandler(capName, handler, addToListener);
|
||||
}
|
||||
|
||||
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
|
||||
// capName, pollServiceHandler.Url, m_agentID, m_regionName);
|
||||
|
||||
m_pollServiceHandlers.Add(capName, pollServiceHandler);
|
||||
if(!m_pollServiceHandlers.TryAdd(capName, pollServiceHandler))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[CAPS]: Handler with name {0} already registered (ulr {1}, agent {2}, region {3}",
|
||||
capName, pollServiceHandler.Url, m_agentID, m_regionName);
|
||||
return;
|
||||
}
|
||||
|
||||
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
|
||||
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler);
|
||||
|
||||
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
||||
// string protocol = "http";
|
||||
|
@ -222,7 +254,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
|
||||
{
|
||||
m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
|
||||
m_httpListener.RemovePollServiceHTTPHandler(handler.Url);
|
||||
}
|
||||
m_pollServiceHandlers.Clear();
|
||||
}
|
||||
|
@ -263,9 +295,6 @@ namespace OpenSim.Framework.Capabilities
|
|||
port = MainServer.Instance.SSLPort;
|
||||
protocol = "https";
|
||||
}
|
||||
//
|
||||
// caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||
|
||||
caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +308,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
caps[kvp.Key] = kvp.Value;
|
||||
}
|
||||
|
||||
Flags |= CapsFlags.SentSeeds;
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
|
@ -40,6 +41,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
public class CapsHandlers
|
||||
{
|
||||
private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
|
||||
private ConcurrentDictionary<string, ISimpleStreamHandler> m_capsSimpleHandlers = new ConcurrentDictionary<string, ISimpleStreamHandler>();
|
||||
private IHttpServer m_httpListener;
|
||||
private string m_httpListenerHostName;
|
||||
private uint m_httpListenerPort;
|
||||
|
@ -72,18 +74,36 @@ namespace OpenSim.Framework.Capabilities
|
|||
public void Remove(string capsName)
|
||||
{
|
||||
lock (m_capsHandlers)
|
||||
{
|
||||
if(m_capsHandlers.ContainsKey(capsName))
|
||||
{
|
||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
|
||||
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[capsName].Path);
|
||||
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
|
||||
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[capsName].Path);
|
||||
m_capsHandlers.Remove(capsName);
|
||||
}
|
||||
}
|
||||
if(m_capsSimpleHandlers.TryRemove(capsName, out ISimpleStreamHandler hdr))
|
||||
{
|
||||
m_httpListener.RemoveSimpleStreamHandler(hdr.Path);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
|
||||
{
|
||||
if(ContainsCap(capName))
|
||||
Remove(capName);
|
||||
if(m_capsSimpleHandlers.TryAdd(capName, handler) && addToListener)
|
||||
m_httpListener.AddSimpleStreamHandler(handler);
|
||||
}
|
||||
|
||||
public bool ContainsCap(string cap)
|
||||
{
|
||||
lock (m_capsHandlers)
|
||||
return m_capsHandlers.ContainsKey(cap);
|
||||
if (m_capsHandlers.ContainsKey(cap))
|
||||
return true;
|
||||
return m_capsSimpleHandlers.ContainsKey(cap);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -110,6 +130,9 @@ namespace OpenSim.Framework.Capabilities
|
|||
if (m_capsHandlers.ContainsKey(idx))
|
||||
{
|
||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
|
||||
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[idx].Path);
|
||||
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[idx].Path);
|
||||
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[idx].Path);
|
||||
m_capsHandlers.Remove(idx);
|
||||
}
|
||||
|
||||
|
@ -131,8 +154,9 @@ namespace OpenSim.Framework.Capabilities
|
|||
{
|
||||
lock (m_capsHandlers)
|
||||
{
|
||||
string[] __keys = new string[m_capsHandlers.Keys.Count];
|
||||
string[] __keys = new string[m_capsHandlers.Keys.Count + m_capsSimpleHandlers.Keys.Count];
|
||||
m_capsHandlers.Keys.CopyTo(__keys, 0);
|
||||
m_capsSimpleHandlers.Keys.CopyTo(__keys, m_capsHandlers.Keys.Count);
|
||||
return __keys;
|
||||
}
|
||||
}
|
||||
|
@ -146,24 +170,39 @@ namespace OpenSim.Framework.Capabilities
|
|||
public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
|
||||
{
|
||||
Hashtable caps = new Hashtable();
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_useSSL)
|
||||
protocol = "https://";
|
||||
|
||||
string protocol = m_useSSL ? "https://" : "http://";
|
||||
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
|
||||
|
||||
if (requestedCaps == null)
|
||||
{
|
||||
lock (m_capsHandlers)
|
||||
{
|
||||
foreach (KeyValuePair<string, ISimpleStreamHandler> kvp in m_capsSimpleHandlers)
|
||||
caps[kvp.Key] = baseUrl + kvp.Value.Path;
|
||||
foreach (KeyValuePair<string, IRequestHandler> kvp in m_capsHandlers)
|
||||
caps[kvp.Key] = baseUrl + kvp.Value.Path;
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
|
||||
lock (m_capsHandlers)
|
||||
{
|
||||
foreach (string capsName in m_capsHandlers.Keys)
|
||||
for(int i = 0; i < requestedCaps.Count; ++i)
|
||||
{
|
||||
string capsName = requestedCaps[i];
|
||||
if (excludeSeed && "SEED" == capsName)
|
||||
continue;
|
||||
|
||||
if (requestedCaps != null && !requestedCaps.Contains(capsName))
|
||||
if (m_capsSimpleHandlers.TryGetValue(capsName, out ISimpleStreamHandler shdr))
|
||||
{
|
||||
caps[capsName] = baseUrl + shdr.Path;
|
||||
continue;
|
||||
|
||||
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
|
||||
}
|
||||
if (m_capsHandlers.TryGetValue(capsName, out IRequestHandler chdr))
|
||||
{
|
||||
caps[capsName] = baseUrl + chdr.Path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,116 +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.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
//using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class AvatarPickerSearchHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private IPeople m_PeopleService;
|
||||
|
||||
public AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_PeopleService = peopleService;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// Try to parse the texture ID from the request URL
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string names = query.GetOne("names");
|
||||
string psize = query.GetOne("page_size");
|
||||
string pnumber = query.GetOne("page");
|
||||
|
||||
if (m_PeopleService == null)
|
||||
return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
|
||||
|
||||
if (string.IsNullOrEmpty(names) || names.Length < 3)
|
||||
return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);
|
||||
|
||||
m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);
|
||||
|
||||
int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
|
||||
int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
|
||||
|
||||
// Full content request
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
//httpResponse.ContentLength = ??;
|
||||
httpResponse.ContentType = "application/llsd+xml";
|
||||
|
||||
List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);
|
||||
|
||||
LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
|
||||
osdReply.next_page_url = httpRequest.RawUrl;
|
||||
foreach (UserData u in users)
|
||||
osdReply.agents.Array.Add(ConvertUserData(u));
|
||||
|
||||
string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
|
||||
return System.Text.Encoding.UTF8.GetBytes(reply);
|
||||
}
|
||||
|
||||
private LLSDPerson ConvertUserData(UserData user)
|
||||
{
|
||||
LLSDPerson p = new LLSDPerson();
|
||||
p.legacy_first_name = user.FirstName;
|
||||
p.legacy_last_name = user.LastName;
|
||||
p.display_name = user.FirstName + " " + user.LastName;
|
||||
if (user.LastName.StartsWith("@"))
|
||||
p.username = user.FirstName.ToLower() + user.LastName.ToLower();
|
||||
else
|
||||
p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
|
||||
p.id = user.Id;
|
||||
p.is_display_name_default = false;
|
||||
return p;
|
||||
}
|
||||
|
||||
private byte[] FailureResponse(string names, int statuscode, IOSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Error("[AVATAR PICKER SEARCH]: Error searching for " + names);
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return System.Text.Encoding.UTF8.GetBytes(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
@ -37,10 +38,10 @@ using OpenMetaverse;
|
|||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
|
@ -49,10 +50,10 @@ namespace OpenSim.Capabilities.Handlers
|
|||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static byte[] EmptyResponse = Util.UTF8NBGetbytes("<llsd><map><key>folders</key><array /></map></llsd>");
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
private IScene m_Scene;
|
||||
// private object m_fetchLock = new Object();
|
||||
|
||||
public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s)
|
||||
{
|
||||
|
@ -61,52 +62,86 @@ namespace OpenSim.Capabilities.Handlers
|
|||
m_Scene = s;
|
||||
}
|
||||
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
public void FetchInventoryDescendentsRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, ExpiringKey<UUID> BadRequests)
|
||||
{
|
||||
//m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
List<LLSDFetchInventoryDescendents> folders = null;
|
||||
List<UUID> bad_folders = new List<UUID>();
|
||||
try
|
||||
{
|
||||
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
|
||||
}
|
||||
catch (LLSD.LLSDParseException e)
|
||||
OSDArray foldersrequested = null;
|
||||
OSD tmp = OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||
OSDMap map = (OSDMap)tmp;
|
||||
if(map.TryGetValue("folders", out tmp) && tmp is OSDArray)
|
||||
foldersrequested = tmp as OSDArray;
|
||||
|
||||
if (foldersrequested == null || foldersrequested.Count == 0)
|
||||
{
|
||||
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
|
||||
m_log.Error("Request: " + request);
|
||||
httpResponse.RawBuffer = EmptyResponse;
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList foldersrequested = (ArrayList)hash["folders"];
|
||||
hash.Clear();
|
||||
|
||||
List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>();
|
||||
folders = new List<LLSDFetchInventoryDescendents>(foldersrequested.Count);
|
||||
for (int i = 0; i < foldersrequested.Count; i++)
|
||||
{
|
||||
Hashtable inventoryhash = (Hashtable)foldersrequested[i];
|
||||
OSDMap mfolder = foldersrequested[i] as OSDMap;
|
||||
UUID id = mfolder["folder_id"].AsUUID();
|
||||
if(BadRequests.ContainsKey(id))
|
||||
{
|
||||
bad_folders.Add(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
|
||||
|
||||
try
|
||||
{
|
||||
LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest);
|
||||
llsdRequest.folder_id = id;
|
||||
llsdRequest.owner_id = mfolder["owner_id"].AsUUID();
|
||||
llsdRequest.sort_order = mfolder["sort_order"].AsInteger();
|
||||
llsdRequest.fetch_folders = mfolder["fetch_folders"].AsBoolean();
|
||||
llsdRequest.fetch_items = mfolder["fetch_items"].AsBoolean();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
|
||||
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e.Message);
|
||||
continue;
|
||||
}
|
||||
|
||||
folders.Add(llsdRequest);
|
||||
}
|
||||
}
|
||||
foldersrequested = null;
|
||||
tmp = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[FETCH INV DESC]: fail parsing request: {0}", e.Message);
|
||||
httpResponse.RawBuffer = EmptyResponse;
|
||||
return;
|
||||
}
|
||||
|
||||
foldersrequested.Clear();
|
||||
|
||||
if(folders.Count == 0)
|
||||
return "<llsd><map><key>folders</key><array /></map></llsd>";
|
||||
|
||||
List<UUID> bad_folders = new List<UUID>();
|
||||
if (folders == null || folders.Count == 0)
|
||||
{
|
||||
if(bad_folders.Count == 0)
|
||||
{
|
||||
httpResponse.RawBuffer = EmptyResponse;
|
||||
return;
|
||||
}
|
||||
StringBuilder sb = osStringBuilderCache.Acquire();
|
||||
sb.Append("<llsd><map><key>folders</key><array /></map><map><key>bad_folders</key><array>");
|
||||
foreach (UUID bad in bad_folders)
|
||||
{
|
||||
sb.Append("<map><key>folder_id</key><uuid>");
|
||||
sb.Append(bad.ToString());
|
||||
sb.Append("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
}
|
||||
sb.Append("</array></map></llsd>");
|
||||
httpResponse.RawBuffer = Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
|
||||
}
|
||||
|
||||
int total_folders = 0;
|
||||
int total_items = 0;
|
||||
|
||||
List<InventoryCollection> invcollSet = Fetch(folders, bad_folders, ref total_folders, ref total_items);
|
||||
//m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);
|
||||
|
||||
|
@ -122,12 +157,12 @@ namespace OpenSim.Capabilities.Handlers
|
|||
StringBuilder lastresponse = new StringBuilder(mem);
|
||||
lastresponse.Append("<llsd>");
|
||||
|
||||
if(invcollSetCount > 0)
|
||||
if (invcollSetCount > 0)
|
||||
{
|
||||
lastresponse.Append("<map><key>folders</key><array>");
|
||||
int i = 0;
|
||||
InventoryCollection thiscoll;
|
||||
for(i = 0; i < invcollSetCount; i++)
|
||||
for (i = 0; i < invcollSetCount; i++)
|
||||
{
|
||||
thiscoll = invcollSet[i];
|
||||
invcollSet[i] = null;
|
||||
|
@ -137,7 +172,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
LLSDxmlEncode.AddElem("descendents", thiscoll.Descendents, lastresponse);
|
||||
LLSDxmlEncode.AddElem("folder_id", thiscoll.FolderID, lastresponse);
|
||||
|
||||
if(thiscoll.Folders == null || thiscoll.Folders.Count == 0)
|
||||
if (thiscoll.Folders == null || thiscoll.Folders.Count == 0)
|
||||
LLSDxmlEncode.AddEmptyArray("categories", lastresponse);
|
||||
else
|
||||
{
|
||||
|
@ -158,7 +193,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
LLSDxmlEncode.AddEndArray(lastresponse);
|
||||
}
|
||||
|
||||
if(thiscoll.Items == null || thiscoll.Items.Count == 0)
|
||||
if (thiscoll.Items == null || thiscoll.Items.Count == 0)
|
||||
LLSDxmlEncode.AddEmptyArray("items", lastresponse);
|
||||
else
|
||||
{
|
||||
|
@ -186,11 +221,12 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
|
||||
//m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders));
|
||||
if(bad_folders.Count > 0)
|
||||
if (bad_folders.Count > 0)
|
||||
{
|
||||
lastresponse.Append("<map><key>bad_folders</key><array>");
|
||||
foreach (UUID bad in bad_folders)
|
||||
{
|
||||
BadRequests.Add(bad);
|
||||
lastresponse.Append("<map><key>folder_id</key><uuid>");
|
||||
lastresponse.Append(bad.ToString());
|
||||
lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
|
@ -199,7 +235,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
lastresponse.Append("</llsd>");
|
||||
|
||||
return lastresponse.ToString();
|
||||
httpResponse.RawBuffer = Util.UTF8NBGetbytes(lastresponse.ToString());
|
||||
}
|
||||
|
||||
private void AddLibraryFolders(List<LLSDFetchInventoryDescendents> libFolders, List<InventoryCollection> result, ref int total_folders, ref int total_items)
|
||||
|
@ -389,7 +425,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
if (linked != null)
|
||||
{
|
||||
List<InventoryItemBase> linkedItems = new List<InventoryItemBase>();
|
||||
List<InventoryItemBase> linkedItems = new List<InventoryItemBase>(linked.Length);
|
||||
// check for broken
|
||||
foreach (InventoryItemBase linkedItem in linked)
|
||||
{
|
||||
|
|
|
@ -29,9 +29,12 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
|
@ -67,16 +70,16 @@ namespace OpenSim.Capabilities.Handlers
|
|||
m_LibraryService =
|
||||
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
|
||||
|
||||
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/,
|
||||
webFetchHandler.FetchInventoryDescendentsRequest,
|
||||
"FetchInvDescendents",
|
||||
null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
ExpiringKey<UUID> m_badRequests = new ExpiringKey<UUID>(30000);
|
||||
|
||||
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
|
||||
ISimpleStreamHandler reqHandler
|
||||
= new SimpleStreamHandler("/CAPS/WebFetchInvDesc/", delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
webFetchHandler.FetchInventoryDescendentsRequest(httpRequest, httpResponse, m_badRequests);
|
||||
});
|
||||
|
||||
server.AddSimpleStreamHandler(reqHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
|
@ -105,7 +105,62 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
return LLSDxmlEncode.End(lsl);;
|
||||
return LLSDxmlEncode.End(lsl);
|
||||
}
|
||||
|
||||
public void FetchInventorySimpleRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap requestmap, ExpiringKey<UUID> BadRequests)
|
||||
{
|
||||
//m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);
|
||||
|
||||
if(BadRequests == null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
||||
|
||||
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
||||
int i = 0;
|
||||
foreach (OSDMap osdItemId in itemsRequested)
|
||||
{
|
||||
UUID id = osdItemId["item_id"].AsUUID();
|
||||
if(!BadRequests.ContainsKey(id))
|
||||
itemIDs[i++] = id;
|
||||
}
|
||||
|
||||
InventoryItemBase[] items = null;
|
||||
try
|
||||
{
|
||||
// badrequests still not filled
|
||||
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
|
||||
}
|
||||
catch{ }
|
||||
|
||||
StringBuilder lsl = LLSDxmlEncode.Start(4096);
|
||||
LLSDxmlEncode.AddMap(lsl);
|
||||
|
||||
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
||||
|
||||
if (items == null || items.Length == 0)
|
||||
{
|
||||
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSDxmlEncode.AddArray("items", lsl);
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
if (item != null)
|
||||
item.ToLLSDxml(lsl, 0xff);
|
||||
}
|
||||
LLSDxmlEncode.AddEndArray(lsl);
|
||||
}
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
|
@ -127,6 +127,19 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
Console.WriteLine("Number of descendents: " + m_rootDescendents);
|
||||
}
|
||||
|
||||
private string dorequest(FetchInvDescHandler handler, string request)
|
||||
{
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
using(ExpiringKey<UUID> bad = new ExpiringKey<UUID>(5000)) // bad but this is test
|
||||
using (MemoryStream ms = new MemoryStream(Utils.StringToBytes(request), false))
|
||||
{
|
||||
req.InputStream = ms;
|
||||
handler.FetchInventoryDescendentsRequest(req, resp, bad);
|
||||
}
|
||||
return Util.UTF8.GetString(resp.RawBuffer);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_001_SimpleFolder()
|
||||
{
|
||||
|
@ -135,8 +148,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
Init();
|
||||
|
||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
|
||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||
request += m_rootFolderID;
|
||||
|
@ -144,7 +155,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
request += m_userID.ToString();
|
||||
request += "</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||
|
||||
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
string llsdresponse = dorequest(handler, request);
|
||||
|
||||
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
||||
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
|
||||
|
@ -161,8 +172,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
TestHelpers.InMethod();
|
||||
|
||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
|
||||
string request = "<llsd><map><key>folders</key><array>";
|
||||
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||
|
@ -173,7 +182,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map>";
|
||||
request += "</array></map></llsd>";
|
||||
|
||||
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
string llsdresponse = dorequest(handler, request);
|
||||
Console.WriteLine(llsdresponse);
|
||||
|
||||
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
|
||||
|
@ -191,14 +200,12 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
TestHelpers.InMethod();
|
||||
|
||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
|
||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||
request += "f0000000-0000-0000-0000-00000000000f";
|
||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||
|
||||
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
string llsdresponse = dorequest(handler, request);
|
||||
Console.WriteLine(llsdresponse);
|
||||
|
||||
string descendents = "descendents</key><integer>2</integer>";
|
||||
|
@ -235,8 +242,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
TestHelpers.InMethod();
|
||||
|
||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
|
||||
string request = "<llsd><map><key>folders</key><array>";
|
||||
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||
|
@ -253,7 +258,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
|
||||
request += "</array></map></llsd>";
|
||||
|
||||
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
string llsdresponse = dorequest(handler, request);
|
||||
Console.WriteLine(llsdresponse);
|
||||
|
||||
string root_folder = "<key>folder_id</key><uuid>" + m_rootFolderID + "</uuid>";
|
||||
|
@ -276,14 +281,12 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
|||
Init();
|
||||
|
||||
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
|
||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||
request += UUID.Zero;
|
||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||
|
||||
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
string llsdresponse = dorequest(handler, request);
|
||||
|
||||
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
||||
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
|
@ -68,7 +66,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
{"jpeg_id", AssetType.ImageJPEG},
|
||||
{"animatn_id", AssetType.Animation},
|
||||
{"gesture_id", AssetType.Gesture},
|
||||
{"mesh_id", AssetType.Mesh}
|
||||
{"mesh_id", AssetType.Mesh},
|
||||
{"settings_id", AssetType.Settings}
|
||||
};
|
||||
|
||||
private IAssetService m_assetService;
|
||||
|
@ -78,82 +77,68 @@ namespace OpenSim.Capabilities.Handlers
|
|||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public Hashtable Handle(Hashtable request)
|
||||
public void Handle(OSHttpRequest req, OSHttpResponse response)
|
||||
{
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["int_bytes"] = 0;
|
||||
response.ContentType = "text/plain";
|
||||
|
||||
if (m_assetService == null)
|
||||
{
|
||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.ServiceUnavailable;
|
||||
responsedata["str_response_string"] = "The asset service is unavailable";
|
||||
responsedata["keepalive"] = false;
|
||||
return responsedata;
|
||||
response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
|
||||
response.KeepAlive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.BadRequest;
|
||||
response.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||
|
||||
string[] queries = null;
|
||||
if(request.Contains("querystringkeys"))
|
||||
queries = (string[])request["querystringkeys"];
|
||||
|
||||
if(queries == null || queries.Length == 0)
|
||||
return responsedata;
|
||||
|
||||
string query = queries[0];
|
||||
if(!queryTypes.ContainsKey(query))
|
||||
{
|
||||
m_log.Warn("[GETASSET]: Unknown type: " + query);
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
AssetType type = queryTypes[query];
|
||||
var queries = req.QueryAsDictionary;
|
||||
if(queries.Count == 0)
|
||||
return;
|
||||
|
||||
AssetType type = AssetType.Unknown;
|
||||
string assetStr = string.Empty;
|
||||
if (request.ContainsKey(query))
|
||||
assetStr = request[query].ToString();
|
||||
foreach (KeyValuePair<string,string> kvp in queries)
|
||||
{
|
||||
if (queryTypes.ContainsKey(kvp.Key))
|
||||
{
|
||||
type = queryTypes[kvp.Key];
|
||||
assetStr = kvp.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(type == AssetType.Unknown)
|
||||
{
|
||||
//m_log.Warn("[GETASSET]: Unknown type: " + query);
|
||||
m_log.Warn("[GETASSET]: Unknown type");
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(assetStr))
|
||||
return responsedata;
|
||||
return;
|
||||
|
||||
UUID assetID = UUID.Zero;
|
||||
if(!UUID.TryParse(assetStr, out assetID))
|
||||
return responsedata;
|
||||
return;
|
||||
|
||||
AssetBase asset = m_assetService.Get(assetID.ToString());
|
||||
if(asset == null)
|
||||
{
|
||||
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
|
||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
||||
responsedata["str_response_string"] = "Asset not found.";
|
||||
return responsedata;
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
if (asset.Type != (sbyte)type)
|
||||
{
|
||||
responsedata["str_response_string"] = "Got wrong asset type";
|
||||
return responsedata;
|
||||
}
|
||||
return;
|
||||
|
||||
if(type == AssetType.Mesh || type == AssetType.Texture)
|
||||
responsedata["throttle"] = true;
|
||||
int len = asset.Data.Length;
|
||||
|
||||
responsedata["content_type"] = asset.Metadata.ContentType;
|
||||
responsedata["bin_response_data"] = asset.Data;
|
||||
responsedata["int_bytes"] = asset.Data.Length;
|
||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
||||
|
||||
string range = String.Empty;
|
||||
if (((Hashtable)request["headers"])["range"] != null)
|
||||
range = (string)((Hashtable)request["headers"])["range"];
|
||||
else if (((Hashtable)request["headers"])["Range"] != null)
|
||||
range = (string)((Hashtable)request["headers"])["Range"];
|
||||
else
|
||||
return responsedata; // full asset
|
||||
|
||||
if (String.IsNullOrEmpty(range))
|
||||
return responsedata; // full asset
|
||||
string range = null;
|
||||
if (req.Headers["Range"] != null)
|
||||
range = req.Headers["Range"];
|
||||
else if (req.Headers["range"] != null)
|
||||
range = req.Headers["range"];
|
||||
|
||||
// range request
|
||||
int start, end;
|
||||
|
@ -163,8 +148,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
// sending back the last byte instead of an error status
|
||||
if (start >= asset.Data.Length)
|
||||
{
|
||||
responsedata["str_response_string"] = "This range doesnt exist.";
|
||||
return responsedata;
|
||||
response.StatusCode = (int)HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
return;
|
||||
}
|
||||
|
||||
if (end == -1)
|
||||
|
@ -173,20 +158,33 @@ namespace OpenSim.Capabilities.Handlers
|
|||
end = Utils.Clamp(end, 0, asset.Data.Length - 1);
|
||||
|
||||
start = Utils.Clamp(start, 0, end);
|
||||
int len = end - start + 1;
|
||||
len = end - start + 1;
|
||||
|
||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
Hashtable headers = new Hashtable();
|
||||
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length);
|
||||
responsedata["headers"] = headers;
|
||||
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
responsedata["bin_start"] = start;
|
||||
responsedata["int_bytes"] = len;
|
||||
return responsedata;
|
||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length));
|
||||
response.StatusCode = (int)HttpStatusCode.PartialContent;
|
||||
response.RawBufferStart = start;
|
||||
}
|
||||
else
|
||||
response.StatusCode = (int)HttpStatusCode.OK;
|
||||
|
||||
m_log.Warn("[GETASSETS]: Failed to parse a range, sending full asset: " + assetStr);
|
||||
return responsedata;
|
||||
response.ContentType = asset.Metadata.ContentType;
|
||||
response.RawBuffer = asset.Data;
|
||||
response.RawBufferLen = len;
|
||||
if (type == AssetType.Mesh || type == AssetType.Texture)
|
||||
{
|
||||
if(len > 8196)
|
||||
{
|
||||
//if(type == AssetType.Texture && ((asset.Flags & AssetFlags.AvatarBake)!= 0))
|
||||
// responsedata["prio"] = 1;
|
||||
//else
|
||||
response.Priority = 2;
|
||||
}
|
||||
else
|
||||
response.Priority = 1;
|
||||
}
|
||||
else
|
||||
response.Priority = -1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,117 +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;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetDisplayNamesHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
protected IUserManagement m_UserManagement;
|
||||
|
||||
public GetDisplayNamesHandler(string path, IUserManagement umService, string name, string description)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_UserManagement = umService;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[GET_DISPLAY_NAMES]: called {0}", httpRequest.Url.Query);
|
||||
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string[] ids = query.GetValues("ids");
|
||||
|
||||
if (m_UserManagement == null)
|
||||
{
|
||||
m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids, UUID.Zero);
|
||||
|
||||
OSDMap osdReply = new OSDMap();
|
||||
OSDArray agents = new OSDArray();
|
||||
|
||||
osdReply["agents"] = agents;
|
||||
foreach (KeyValuePair<UUID,string> kvp in names)
|
||||
{
|
||||
if (string.IsNullOrEmpty(kvp.Value))
|
||||
continue;
|
||||
if(kvp.Key == UUID.Zero)
|
||||
continue;
|
||||
|
||||
string[] parts = kvp.Value.Split(new char[] {' '});
|
||||
OSDMap osdname = new OSDMap();
|
||||
if(parts[0] == "Unknown")
|
||||
{
|
||||
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
|
||||
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
|
||||
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
|
||||
}
|
||||
osdname["display_name"] = OSD.FromString(kvp.Value);
|
||||
osdname["legacy_first_name"] = parts[0];
|
||||
osdname["legacy_last_name"] = parts[1];
|
||||
osdname["username"] = OSD.FromString(kvp.Value);
|
||||
osdname["id"] = OSD.FromUUID(kvp.Key);
|
||||
osdname["is_display_name_default"] = OSD.FromBoolean(true);
|
||||
|
||||
agents.Add(osdname);
|
||||
}
|
||||
|
||||
// Full content request
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
//httpResponse.ContentLength = ??;
|
||||
httpResponse.ContentType = "application/llsd+xml";
|
||||
|
||||
string reply = OSDParser.SerializeLLSDXmlString(osdReply);
|
||||
return System.Text.Encoding.UTF8.GetBytes(reply);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +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 Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetDisplayNamesServerConnector : ServiceConnector
|
||||
{
|
||||
private IUserManagement m_UserManagement;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public GetDisplayNamesServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string umService = serverConfig.GetString("AssetService", String.Empty);
|
||||
|
||||
if (umService == String.Empty)
|
||||
throw new Exception("No AssetService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_UserManagement =
|
||||
ServerUtils.LoadPlugin<IUserManagement>(umService, args);
|
||||
|
||||
if (m_UserManagement == null)
|
||||
throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
|
||||
|
||||
server.AddStreamHandler(
|
||||
new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
IRequestHandler reqHandler
|
||||
= new RestHTTPHandler(
|
||||
"GET",
|
||||
"/CAPS/" + UUID.Random(),
|
||||
"/" + UUID.Random(),
|
||||
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
|
||||
"GetMesh",
|
||||
null);
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.Drawing;
|
|||
using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
@ -136,8 +137,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
{
|
||||
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;
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Moved;
|
||||
httpResponse.AddHeader("Location:", textureUrl);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -238,8 +239,9 @@ namespace OpenSim.Capabilities.Handlers
|
|||
response.ContentLength = len;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
||||
|
||||
response.Body.Write(texture.Data, start, len);
|
||||
response.RawBuffer = texture.Data;
|
||||
response.RawBufferStart = start;
|
||||
response.RawBufferLen = len;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -257,17 +259,19 @@ namespace OpenSim.Capabilities.Handlers
|
|||
response.ContentType = texture.Metadata.ContentType;
|
||||
else
|
||||
response.ContentType = "image/" + format;
|
||||
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||
response.RawBuffer = texture.Data;
|
||||
response.RawBufferStart = 0;
|
||||
response.RawBufferLen = texture.Data.Length;
|
||||
}
|
||||
|
||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
||||
// m_log.WarnFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
// else
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
||||
// m_log.WarnFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
// else
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
string rurl = serverConfig.GetString("GetTextureRedirectURL");
|
||||
;
|
||||
server.AddStreamHandler(
|
||||
new GetTextureRobustHandler("/CAPS/GetTexture/", m_AssetService, "GetTexture", null, rurl));
|
||||
new GetTextureRobustHandler("/CAPS/GetTexture", m_AssetService, "GetTexture", null, rurl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,171 +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.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class UploadBakedTextureHandler
|
||||
{
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Caps m_HostCapsObj;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
public UploadBakedTextureHandler(Caps caps, IAssetService assetService)
|
||||
{
|
||||
m_HostCapsObj = caps;
|
||||
m_assetService = assetService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle a request from the client for a Uri to upload a baked texture.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <returns>The upload response if the request is successful, null otherwise.</returns>
|
||||
public string UploadBakedTexture(
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
BakedTextureUploader uploader =
|
||||
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
|
||||
uploader.OnUpLoad += BakedTextureUploaded;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler(
|
||||
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
|
||||
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a baked texture has been successfully uploaded by a client.
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="data"></param>
|
||||
private void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||
{
|
||||
m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
|
||||
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
||||
asset.Data = data;
|
||||
asset.Temporary = true;
|
||||
asset.Local = true;
|
||||
m_assetService.Store(asset);
|
||||
}
|
||||
}
|
||||
|
||||
class BakedTextureUploader
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event Action<UUID, byte[]> OnUpLoad;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID newAssetID;
|
||||
private IHttpServer httpListener;
|
||||
private UUID AgentId = UUID.Zero;
|
||||
|
||||
public BakedTextureUploader(string path, IHttpServer httpServer, UUID uUID)
|
||||
{
|
||||
newAssetID = UUID.Random();
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
AgentId = uUID;
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle raw uploaded baked texture data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
|
||||
|
||||
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
|
||||
// on another thread which might send out avatar updates before the asset has been put into the asset
|
||||
// service.
|
||||
if (handlerUpLoad != null)
|
||||
handlerUpLoad(newAssetID, data);
|
||||
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = UUID.Zero;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,76 +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 Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class UploadBakedTextureServerConnector : ServiceConnector
|
||||
{
|
||||
private IAssetService m_AssetService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string assetService = serverConfig.GetString("AssetService", String.Empty);
|
||||
|
||||
if (assetService == String.Empty)
|
||||
throw new Exception("No AssetService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_AssetService =
|
||||
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
// NEED TO FIX THIS
|
||||
OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
|
||||
server.AddStreamHandler(new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/UploadBakedTexture/",
|
||||
new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture,
|
||||
"UploadBakedTexture",
|
||||
"Upload Baked Texture Capability"));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +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 OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDItemUpdate
|
||||
{
|
||||
public UUID item_id;
|
||||
|
||||
public LLSDItemUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,51 +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.Collections;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDParcelVoiceInfoResponse
|
||||
{
|
||||
public int parcel_local_id;
|
||||
public string region_name;
|
||||
public Hashtable voice_credentials;
|
||||
|
||||
public LLSDParcelVoiceInfoResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
|
||||
{
|
||||
region_name = region;
|
||||
parcel_local_id = localID;
|
||||
voice_credentials = creds;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +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 OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDTaskScriptUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// The item containing the script to update
|
||||
/// </summary>
|
||||
public UUID item_id;
|
||||
|
||||
/// <summary>
|
||||
/// The task containing the script
|
||||
/// </summary>
|
||||
public UUID task_id;
|
||||
|
||||
/// <summary>
|
||||
/// Signals whether the script is currently active
|
||||
/// </summary>
|
||||
public int is_script_running;
|
||||
}
|
||||
}
|
|
@ -1,57 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDVoiceAccountResponse
|
||||
{
|
||||
public string username;
|
||||
public string password;
|
||||
public string voice_sip_uri_hostname;
|
||||
public string voice_account_server_name;
|
||||
|
||||
public LLSDVoiceAccountResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public LLSDVoiceAccountResponse(string user, string pass)
|
||||
{
|
||||
username = user;
|
||||
password = pass;
|
||||
}
|
||||
|
||||
public LLSDVoiceAccountResponse(string user, string pass, string sipUriHost, string accountServer)
|
||||
{
|
||||
username = user;
|
||||
password = pass;
|
||||
voice_sip_uri_hostname = sipUriHost;
|
||||
voice_account_server_name = accountServer;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -80,7 +80,7 @@ namespace OpenSim.ConsoleClient
|
|||
while (m_Server.Running)
|
||||
{
|
||||
System.Threading.Thread.Sleep(500);
|
||||
// MainConsole.Instance.Prompt();
|
||||
MainConsole.Instance.Prompt();
|
||||
}
|
||||
|
||||
if (pidFile != String.Empty)
|
||||
|
|
|
@ -71,6 +71,8 @@ namespace OpenSim.Data
|
|||
{
|
||||
RegionData Get(UUID regionID, UUID ScopeID);
|
||||
List<RegionData> Get(string regionName, UUID ScopeID);
|
||||
RegionData GetSpecific(string regionName, UUID ScopeID);
|
||||
|
||||
RegionData Get(int x, int y, UUID ScopeID);
|
||||
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
|
||||
|
||||
|
|
|
@ -81,17 +81,15 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
}
|
||||
|
||||
public RegionData Get(int posX, int posY, UUID scopeID)
|
||||
public RegionData GetSpecific(string regionName, UUID scopeID)
|
||||
{
|
||||
/* fixed size regions
|
||||
string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
|
||||
string command = "select * from `" + m_Realm + "` where regionName = ?regionName";
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?posX", posX.ToString());
|
||||
cmd.Parameters.AddWithValue("?posY", posY.ToString());
|
||||
cmd.Parameters.AddWithValue("?regionName", regionName);
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
List<RegionData> ret = RunCommand(cmd);
|
||||
|
@ -100,8 +98,11 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
return ret[0];
|
||||
}
|
||||
*/
|
||||
// extend database search for maximum region size area
|
||||
|
||||
}
|
||||
|
||||
public RegionData Get(int posX, int posY, UUID scopeID)
|
||||
{
|
||||
string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
|
|
@ -29,16 +29,13 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Data.MySQL
|
||||
{
|
||||
|
@ -130,10 +127,6 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
// Eligibility check
|
||||
//
|
||||
// PrimFlags.Temporary is not used in OpenSim code and cannot
|
||||
// be guaranteed to always be clear. Don't check it.
|
||||
// if ((flags & (uint)PrimFlags.Temporary) != 0)
|
||||
// return;
|
||||
if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
|
||||
return;
|
||||
|
||||
|
@ -154,16 +147,15 @@ namespace OpenSim.Data.MySQL
|
|||
"Name, Text, Description, " +
|
||||
"SitName, TouchName, ObjectFlags, " +
|
||||
"OwnerMask, NextOwnerMask, GroupMask, " +
|
||||
"EveryoneMask, BaseMask, PositionX, " +
|
||||
"PositionY, PositionZ, GroupPositionX, " +
|
||||
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
||||
"VelocityY, VelocityZ, AngularVelocityX, " +
|
||||
"AngularVelocityY, AngularVelocityZ, " +
|
||||
"AccelerationX, AccelerationY, " +
|
||||
"AccelerationZ, RotationX, " +
|
||||
"RotationY, RotationZ, " +
|
||||
"RotationW, SitTargetOffsetX, " +
|
||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||
"EveryoneMask, BaseMask, " +
|
||||
"PositionX, PositionY, PositionZ, " +
|
||||
"GroupPositionX, GroupPositionY, GroupPositionZ, " +
|
||||
"VelocityX, VelocityY, VelocityZ, " +
|
||||
"AngularVelocityX, AngularVelocityY, AngularVelocityZ, " +
|
||||
"AccelerationX, AccelerationY, AccelerationZ, " +
|
||||
"standtargetx, standtargety, standtargetz, " +
|
||||
"RotationX, RotationY, RotationZ, RotationW, " +
|
||||
"SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||
"SitTargetOrientW, SitTargetOrientX, " +
|
||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||
"RegionUUID, CreatorID, " +
|
||||
|
@ -189,20 +181,19 @@ namespace OpenSim.Data.MySQL
|
|||
"AttachedPosY, AttachedPosZ, " +
|
||||
"PhysicsShapeType, Density, GravityModifier, " +
|
||||
"Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
|
||||
"RotationAxisLocks, sopanims" +
|
||||
"RotationAxisLocks, sopanims, sitactrange, pseudocrc" +
|
||||
") values (" + "?UUID, " +
|
||||
"?CreationDate, ?Name, ?Text, " +
|
||||
"?Description, ?SitName, ?TouchName, " +
|
||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
||||
"?PositionX, ?PositionY, ?PositionZ, " +
|
||||
"?GroupPositionX, ?GroupPositionY, " +
|
||||
"?GroupPositionZ, ?VelocityX, " +
|
||||
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
||||
"?AngularVelocityY, ?AngularVelocityZ, " +
|
||||
"?AccelerationX, ?AccelerationY, " +
|
||||
"?AccelerationZ, ?RotationX, " +
|
||||
"?RotationY, ?RotationZ, " +
|
||||
"?GroupPositionX, ?GroupPositionY, ?GroupPositionZ, " +
|
||||
"?VelocityX, ?VelocityY, ?VelocityZ, "+
|
||||
"?AngularVelocityX, ?AngularVelocityY, ?AngularVelocityZ, " +
|
||||
"?AccelerationX, ?AccelerationY, ?AccelerationZ, " +
|
||||
"?standtargetx, ?standtargety, ?standtargetz, " +
|
||||
"?RotationX, ?RotationY, ?RotationZ, " +
|
||||
"?RotationW, ?SitTargetOffsetX, " +
|
||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||
|
@ -226,7 +217,7 @@ namespace OpenSim.Data.MySQL
|
|||
"?AttachedPosY, ?AttachedPosZ, " +
|
||||
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
|
||||
"?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
|
||||
"?RotationAxisLocks, ?sopanims)";
|
||||
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
|
@ -830,7 +821,7 @@ namespace OpenSim.Data.MySQL
|
|||
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
|
||||
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
|
||||
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
|
||||
"SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
|
||||
"SeeAVs, AnyAVSounds, GroupAVSounds, environment) values (" +
|
||||
"?UUID, ?RegionUUID, " +
|
||||
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
|
||||
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
|
||||
|
@ -842,7 +833,7 @@ namespace OpenSim.Data.MySQL
|
|||
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
|
||||
"?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
|
||||
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " +
|
||||
"?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)";
|
||||
"?SeeAVs, ?AnyAVSounds, ?GroupAVSounds, ?environment)";
|
||||
|
||||
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
|
||||
|
||||
|
@ -869,107 +860,6 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
}
|
||||
|
||||
public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
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());
|
||||
|
||||
using(IDataReader result = ExecuteReader(cmd))
|
||||
{
|
||||
if(!result.Read())
|
||||
{
|
||||
//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;
|
||||
}
|
||||
}
|
||||
}
|
||||
dbcon.Close();
|
||||
}
|
||||
|
||||
return nWP;
|
||||
}
|
||||
|
||||
public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
RegionSettings rs = null;
|
||||
|
@ -1015,127 +905,6 @@ namespace OpenSim.Data.MySQL
|
|||
return rs;
|
||||
}
|
||||
|
||||
public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "
|
||||
+ "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "
|
||||
+ "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "
|
||||
+ "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "
|
||||
+ "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "
|
||||
+ "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "
|
||||
+ "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "
|
||||
+ "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "
|
||||
+ "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "
|
||||
+ "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "
|
||||
+ "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "
|
||||
+ "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "
|
||||
+ "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "
|
||||
+ "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "
|
||||
+ "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "
|
||||
+ "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "
|
||||
+ "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "
|
||||
+ "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "
|
||||
+ "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "
|
||||
+ "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "
|
||||
+ "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "
|
||||
+ "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "
|
||||
+ "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "
|
||||
+ "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "
|
||||
+ "?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);
|
||||
}
|
||||
dbcon.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
dbcon.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region RegionEnvironmentSettings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
|
@ -1231,7 +1000,7 @@ namespace OpenSim.Data.MySQL
|
|||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, block_search, casino, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"TelehubObject, parcel_tile_ID, cacheID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||
|
@ -1248,7 +1017,7 @@ namespace OpenSim.Data.MySQL
|
|||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, ?block_search, ?casino, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
"?TelehubObject, ?ParcelImageID, ?cacheID)";
|
||||
|
||||
FillRegionSettingsCommand(cmd, rs);
|
||||
ExecuteNonQuery(cmd);
|
||||
|
@ -1352,49 +1121,57 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
// Vectors
|
||||
prim.OffsetPosition = new Vector3(
|
||||
(float)(double)row["PositionX"],
|
||||
(float)(double)row["PositionY"],
|
||||
(float)(double)row["PositionZ"]
|
||||
(float)row["PositionX"],
|
||||
(float)row["PositionY"],
|
||||
(float)row["PositionZ"]
|
||||
);
|
||||
prim.GroupPosition = new Vector3(
|
||||
(float)(double)row["GroupPositionX"],
|
||||
(float)(double)row["GroupPositionY"],
|
||||
(float)(double)row["GroupPositionZ"]
|
||||
(float)row["GroupPositionX"],
|
||||
(float)row["GroupPositionY"],
|
||||
(float)row["GroupPositionZ"]
|
||||
);
|
||||
prim.Velocity = new Vector3(
|
||||
(float)(double)row["VelocityX"],
|
||||
(float)(double)row["VelocityY"],
|
||||
(float)(double)row["VelocityZ"]
|
||||
(float)row["VelocityX"],
|
||||
(float)row["VelocityY"],
|
||||
(float)row["VelocityZ"]
|
||||
);
|
||||
prim.AngularVelocity = new Vector3(
|
||||
(float)(double)row["AngularVelocityX"],
|
||||
(float)(double)row["AngularVelocityY"],
|
||||
(float)(double)row["AngularVelocityZ"]
|
||||
(float)row["AngularVelocityX"],
|
||||
(float)row["AngularVelocityY"],
|
||||
(float)row["AngularVelocityZ"]
|
||||
);
|
||||
prim.Acceleration = new Vector3(
|
||||
(float)(double)row["AccelerationX"],
|
||||
(float)(double)row["AccelerationY"],
|
||||
(float)(double)row["AccelerationZ"]
|
||||
(float)row["AccelerationX"],
|
||||
(float)row["AccelerationY"],
|
||||
(float)row["AccelerationZ"]
|
||||
);
|
||||
// quaternions
|
||||
prim.RotationOffset = new Quaternion(
|
||||
(float)(double)row["RotationX"],
|
||||
(float)(double)row["RotationY"],
|
||||
(float)(double)row["RotationZ"],
|
||||
(float)(double)row["RotationW"]
|
||||
(float)row["RotationX"],
|
||||
(float)row["RotationY"],
|
||||
(float)row["RotationZ"],
|
||||
(float)row["RotationW"]
|
||||
);
|
||||
prim.SitTargetPositionLL = new Vector3(
|
||||
(float)(double)row["SitTargetOffsetX"],
|
||||
(float)(double)row["SitTargetOffsetY"],
|
||||
(float)(double)row["SitTargetOffsetZ"]
|
||||
(float)row["SitTargetOffsetX"],
|
||||
(float)row["SitTargetOffsetY"],
|
||||
(float)row["SitTargetOffsetZ"]
|
||||
);
|
||||
prim.SitTargetOrientationLL = new Quaternion(
|
||||
(float)(double)row["SitTargetOrientX"],
|
||||
(float)(double)row["SitTargetOrientY"],
|
||||
(float)(double)row["SitTargetOrientZ"],
|
||||
(float)(double)row["SitTargetOrientW"]
|
||||
(float)row["SitTargetOrientX"],
|
||||
(float)row["SitTargetOrientY"],
|
||||
(float)row["SitTargetOrientZ"],
|
||||
(float)row["SitTargetOrientW"]
|
||||
);
|
||||
|
||||
prim.StandOffset = new Vector3(
|
||||
(float)row["standtargetx"],
|
||||
(float)row["standtargety"],
|
||||
(float)row["standtargetz"]
|
||||
);
|
||||
|
||||
prim.SitActiveRange = (float)row["sitactrange"];
|
||||
|
||||
prim.PayPrice[0] = (int)row["PayPrice"];
|
||||
prim.PayPrice[1] = (int)row["PayButton1"];
|
||||
prim.PayPrice[2] = (int)row["PayButton2"];
|
||||
|
@ -1402,7 +1179,7 @@ namespace OpenSim.Data.MySQL
|
|||
prim.PayPrice[4] = (int)row["PayButton4"];
|
||||
|
||||
prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString());
|
||||
prim.SoundGain = (float)(double)row["LoopedSoundGain"];
|
||||
prim.SoundGain = (float)row["LoopedSoundGain"];
|
||||
if (prim.Sound != UUID.Zero)
|
||||
prim.SoundFlags = 1; // If it's persisted at all, it's looped
|
||||
else
|
||||
|
@ -1414,21 +1191,21 @@ namespace OpenSim.Data.MySQL
|
|||
prim.ParticleSystem = (byte[])row["ParticleSystem"];
|
||||
|
||||
prim.AngularVelocity = new Vector3(
|
||||
(float)(double)row["OmegaX"],
|
||||
(float)(double)row["OmegaY"],
|
||||
(float)(double)row["OmegaZ"]
|
||||
(float)row["OmegaX"],
|
||||
(float)row["OmegaY"],
|
||||
(float)row["OmegaZ"]
|
||||
);
|
||||
|
||||
prim.SetCameraEyeOffset(new Vector3(
|
||||
(float)(double)row["CameraEyeOffsetX"],
|
||||
(float)(double)row["CameraEyeOffsetY"],
|
||||
(float)(double)row["CameraEyeOffsetZ"]
|
||||
(float)row["CameraEyeOffsetX"],
|
||||
(float)row["CameraEyeOffsetY"],
|
||||
(float)row["CameraEyeOffsetZ"]
|
||||
));
|
||||
|
||||
prim.SetCameraAtOffset(new Vector3(
|
||||
(float)(double)row["CameraAtOffsetX"],
|
||||
(float)(double)row["CameraAtOffsetY"],
|
||||
(float)(double)row["CameraAtOffsetZ"]
|
||||
(float)row["CameraAtOffsetX"],
|
||||
(float)row["CameraAtOffsetY"],
|
||||
(float)row["CameraAtOffsetZ"]
|
||||
));
|
||||
|
||||
prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0);
|
||||
|
@ -1457,9 +1234,9 @@ namespace OpenSim.Data.MySQL
|
|||
if (!(row["AttachedPosX"] is System.DBNull))
|
||||
{
|
||||
prim.AttachedPos = new Vector3(
|
||||
(float)(double)row["AttachedPosX"],
|
||||
(float)(double)row["AttachedPosY"],
|
||||
(float)(double)row["AttachedPosZ"]
|
||||
(float)row["AttachedPosX"],
|
||||
(float)row["AttachedPosY"],
|
||||
(float)row["AttachedPosZ"]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1482,10 +1259,10 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
|
||||
prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
|
||||
prim.Density = (float)(double)row["Density"];
|
||||
prim.GravityModifier = (float)(double)row["GravityModifier"];
|
||||
prim.Friction = (float)(double)row["Friction"];
|
||||
prim.Restitution = (float)(double)row["Restitution"];
|
||||
prim.Density = (float)row["Density"];
|
||||
prim.GravityModifier = (float)row["GravityModifier"];
|
||||
prim.Friction = (float)row["Friction"];
|
||||
prim.Restitution = (float)row["Restitution"];
|
||||
prim.RotationAxisLocks = (byte)Convert.ToInt32(row["RotationAxisLocks"].ToString());
|
||||
|
||||
SOPVehicle vehicle = null;
|
||||
|
@ -1515,6 +1292,12 @@ namespace OpenSim.Data.MySQL
|
|||
prim.Animations = null;
|
||||
}
|
||||
|
||||
prim.SitActiveRange = (float)row["sitactrange"];
|
||||
|
||||
int pseudocrc = (int)row["pseudocrc"];
|
||||
if(pseudocrc != 0)
|
||||
prim.PseudoCRC = pseudocrc;
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
||||
|
@ -1619,6 +1402,10 @@ namespace OpenSim.Data.MySQL
|
|||
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
|
||||
newSettings.Casino = Convert.ToBoolean(row["casino"]);
|
||||
|
||||
if (!(row["cacheID"] is DBNull))
|
||||
newSettings.CacheID = DBGuid.FromDB(row["cacheID"]);
|
||||
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
|
@ -1702,6 +1489,34 @@ namespace OpenSim.Data.MySQL
|
|||
if (!(row["GroupAVSounds"] is System.DBNull))
|
||||
newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false;
|
||||
|
||||
if (row["environment"] is DBNull)
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
string env = (string)row["environment"];
|
||||
if(string.IsNullOrEmpty(env))
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
|
||||
newData.Environment = VEnv;
|
||||
newData.EnvironmentVersion = VEnv.version;
|
||||
}
|
||||
catch
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
@ -1756,38 +1571,43 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask);
|
||||
cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask);
|
||||
// vectors
|
||||
cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X);
|
||||
cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y);
|
||||
cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z);
|
||||
cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X);
|
||||
cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y);
|
||||
cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z);
|
||||
cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X);
|
||||
cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y);
|
||||
cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z);
|
||||
cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X);
|
||||
cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y);
|
||||
cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z);
|
||||
cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X);
|
||||
cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y);
|
||||
cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z);
|
||||
cmd.Parameters.AddWithValue("PositionX", prim.OffsetPosition.X);
|
||||
cmd.Parameters.AddWithValue("PositionY", prim.OffsetPosition.Y);
|
||||
cmd.Parameters.AddWithValue("PositionZ", prim.OffsetPosition.Z);
|
||||
cmd.Parameters.AddWithValue("GroupPositionX", prim.GroupPosition.X);
|
||||
cmd.Parameters.AddWithValue("GroupPositionY", prim.GroupPosition.Y);
|
||||
cmd.Parameters.AddWithValue("GroupPositionZ", prim.GroupPosition.Z);
|
||||
cmd.Parameters.AddWithValue("VelocityX", prim.Velocity.X);
|
||||
cmd.Parameters.AddWithValue("VelocityY", prim.Velocity.Y);
|
||||
cmd.Parameters.AddWithValue("VelocityZ", prim.Velocity.Z);
|
||||
cmd.Parameters.AddWithValue("AngularVelocityX", prim.AngularVelocity.X);
|
||||
cmd.Parameters.AddWithValue("AngularVelocityY", prim.AngularVelocity.Y);
|
||||
cmd.Parameters.AddWithValue("AngularVelocityZ", prim.AngularVelocity.Z);
|
||||
cmd.Parameters.AddWithValue("AccelerationX", prim.Acceleration.X);
|
||||
cmd.Parameters.AddWithValue("AccelerationY", prim.Acceleration.Y);
|
||||
cmd.Parameters.AddWithValue("AccelerationZ", prim.Acceleration.Z);
|
||||
|
||||
cmd.Parameters.AddWithValue("standtargetx", prim.StandOffset.X);
|
||||
cmd.Parameters.AddWithValue("standtargety", prim.StandOffset.Y);
|
||||
cmd.Parameters.AddWithValue("standtargetz", prim.StandOffset.Z);
|
||||
|
||||
// quaternions
|
||||
cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X);
|
||||
cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y);
|
||||
cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z);
|
||||
cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W);
|
||||
cmd.Parameters.AddWithValue("RotationX", prim.RotationOffset.X);
|
||||
cmd.Parameters.AddWithValue("RotationY", prim.RotationOffset.Y);
|
||||
cmd.Parameters.AddWithValue("RotationZ", prim.RotationOffset.Z);
|
||||
cmd.Parameters.AddWithValue("RotationW", prim.RotationOffset.W);
|
||||
|
||||
// Sit target
|
||||
Vector3 sitTargetPos = prim.SitTargetPositionLL;
|
||||
cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X);
|
||||
cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y);
|
||||
cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z);
|
||||
cmd.Parameters.AddWithValue("SitTargetOffsetX", sitTargetPos.X);
|
||||
cmd.Parameters.AddWithValue("SitTargetOffsetY", sitTargetPos.Y);
|
||||
cmd.Parameters.AddWithValue("SitTargetOffsetZ", sitTargetPos.Z);
|
||||
|
||||
Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientW", sitTargetOrient.W);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientX", sitTargetOrient.X);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientY", sitTargetOrient.Y);
|
||||
cmd.Parameters.AddWithValue("SitTargetOrientZ", sitTargetOrient.Z);
|
||||
|
||||
cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]);
|
||||
cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]);
|
||||
|
@ -1798,7 +1618,7 @@ namespace OpenSim.Data.MySQL
|
|||
if ((prim.SoundFlags & 1) != 0) // Looped
|
||||
{
|
||||
cmd.Parameters.AddWithValue("LoopedSound", prim.Sound.ToString());
|
||||
cmd.Parameters.AddWithValue("LoopedSoundGain", prim.SoundGain);
|
||||
cmd.Parameters.AddWithValue("LoopedSoundGain", (float)prim.SoundGain);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1809,17 +1629,17 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation);
|
||||
cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem);
|
||||
|
||||
cmd.Parameters.AddWithValue("OmegaX", (double)prim.AngularVelocity.X);
|
||||
cmd.Parameters.AddWithValue("OmegaY", (double)prim.AngularVelocity.Y);
|
||||
cmd.Parameters.AddWithValue("OmegaZ", (double)prim.AngularVelocity.Z);
|
||||
cmd.Parameters.AddWithValue("OmegaX", prim.AngularVelocity.X);
|
||||
cmd.Parameters.AddWithValue("OmegaY", prim.AngularVelocity.Y);
|
||||
cmd.Parameters.AddWithValue("OmegaZ", prim.AngularVelocity.Z);
|
||||
|
||||
cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X);
|
||||
cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y);
|
||||
cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z);
|
||||
cmd.Parameters.AddWithValue("CameraEyeOffsetX", prim.GetCameraEyeOffset().X);
|
||||
cmd.Parameters.AddWithValue("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y);
|
||||
cmd.Parameters.AddWithValue("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z);
|
||||
|
||||
cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X);
|
||||
cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y);
|
||||
cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z);
|
||||
cmd.Parameters.AddWithValue("CameraAtOffsetX", prim.GetCameraAtOffset().X);
|
||||
cmd.Parameters.AddWithValue("CameraAtOffsetY", prim.GetCameraAtOffset().Y);
|
||||
cmd.Parameters.AddWithValue("CameraAtOffsetZ", prim.GetCameraAtOffset().Z);
|
||||
|
||||
if (prim.GetForceMouselook())
|
||||
cmd.Parameters.AddWithValue("ForceMouselook", 1);
|
||||
|
@ -1863,9 +1683,9 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
|
||||
if (prim.AttachedPos != null)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("AttachedPosX", (double)prim.AttachedPos.X);
|
||||
cmd.Parameters.AddWithValue("AttachedPosY", (double)prim.AttachedPos.Y);
|
||||
cmd.Parameters.AddWithValue("AttachedPosZ", (double)prim.AttachedPos.Z);
|
||||
cmd.Parameters.AddWithValue("AttachedPosX", prim.AttachedPos.X);
|
||||
cmd.Parameters.AddWithValue("AttachedPosY", prim.AttachedPos.Y);
|
||||
cmd.Parameters.AddWithValue("AttachedPosZ", prim.AttachedPos.Z);
|
||||
}
|
||||
|
||||
if (prim.KeyframeMotion != null)
|
||||
|
@ -1889,16 +1709,19 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("DynAttrs", null);
|
||||
|
||||
cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
|
||||
cmd.Parameters.AddWithValue("Density", (double)prim.Density);
|
||||
cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
|
||||
cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
|
||||
cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution);
|
||||
cmd.Parameters.AddWithValue("Density", prim.Density);
|
||||
cmd.Parameters.AddWithValue("GravityModifier", prim.GravityModifier);
|
||||
cmd.Parameters.AddWithValue("Friction", prim.Friction);
|
||||
cmd.Parameters.AddWithValue("Restitution", prim.Restitution);
|
||||
cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks);
|
||||
|
||||
if (prim.Animations!= null)
|
||||
cmd.Parameters.AddWithValue("sopanims", prim.SerializeAnimations());
|
||||
else
|
||||
cmd.Parameters.AddWithValue("sopanims", null);
|
||||
|
||||
cmd.Parameters.AddWithValue("sitactrange", prim.SitActiveRange);
|
||||
cmd.Parameters.AddWithValue("pseudocrc", prim.PseudoCRC);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1982,6 +1805,7 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
|
||||
cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
|
||||
cmd.Parameters.AddWithValue("cacheID", settings.CacheID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2039,7 +1863,19 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0);
|
||||
cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0);
|
||||
cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0);
|
||||
|
||||
if (land.Environment == null)
|
||||
cmd.Parameters.AddWithValue("environment", "");
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.Parameters.AddWithValue("environment", ViewerEnvironment.ToOSDString(land.Environment));
|
||||
}
|
||||
catch
|
||||
{
|
||||
cmd.Parameters.AddWithValue("environment", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -76,3 +76,8 @@ ALTER TABLE `estateban`
|
|||
ADD COLUMN `banTime` int(11) NOT NULL DEFAULT 0;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 36
|
||||
BEGIN;
|
||||
ALTER TABLE `estate_settings`
|
||||
ADD COLUMN `AllowEnviromentOverride` tinyint(4) NOT NULL DEFAULT '0';
|
||||
COMMIT;
|
||||
|
|
|
@ -16,3 +16,9 @@ CREATE TABLE `hg_traveling_data` (
|
|||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 2 # --------------------------
|
||||
|
||||
ALTER TABLE `hg_traveling_data` MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
|
|
@ -474,3 +474,79 @@ BEGIN;
|
|||
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 59 #----- Add standtarget and sit range
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims`
|
||||
ADD COLUMN `standtargetx` float DEFAULT '0.0',
|
||||
ADD COLUMN `standtargety` float DEFAULT '0.0',
|
||||
ADD COLUMN `standtargetz` float DEFAULT '0.0',
|
||||
ADD COLUMN `sitactrange` float DEFAULT '0.0';
|
||||
COMMIT;
|
||||
|
||||
:VERSION 60 #----- don't store float on double
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims`
|
||||
MODIFY `PositionX` float DEFAULT '0.0',
|
||||
MODIFY `PositionY` float DEFAULT '0.0',
|
||||
MODIFY `PositionZ` float DEFAULT '0.0',
|
||||
MODIFY `GroupPositionX` float DEFAULT '0.0',
|
||||
MODIFY `GroupPositionY` float DEFAULT '0.0',
|
||||
MODIFY `GroupPositionZ` float DEFAULT '0.0',
|
||||
MODIFY `VelocityX` float DEFAULT '0.0',
|
||||
MODIFY `VelocityY` float DEFAULT '0.0',
|
||||
MODIFY `VelocityZ` float DEFAULT '0.0',
|
||||
MODIFY `AngularVelocityX` float DEFAULT '0.0',
|
||||
MODIFY `AngularVelocityY` float DEFAULT '0.0',
|
||||
MODIFY `AngularVelocityZ` float DEFAULT '0.0',
|
||||
MODIFY `AccelerationX` float DEFAULT '0.0',
|
||||
MODIFY `AccelerationY` float DEFAULT '0.0',
|
||||
MODIFY `AccelerationZ` float DEFAULT '0.0',
|
||||
MODIFY `RotationX` float DEFAULT '0.0',
|
||||
MODIFY `RotationY` float DEFAULT '0.0',
|
||||
MODIFY `RotationZ` float DEFAULT '0.0',
|
||||
MODIFY `RotationW` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOffsetX` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOffsetY` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOffsetZ` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOrientX` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOrientY` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOrientZ` float DEFAULT '0.0',
|
||||
MODIFY `SitTargetOrientW` float DEFAULT '0.0',
|
||||
MODIFY `OmegaX` float DEFAULT '0.0',
|
||||
MODIFY `OmegaY` float DEFAULT '0.0',
|
||||
MODIFY `OmegaZ` float DEFAULT '0.0',
|
||||
MODIFY `CameraEyeOffsetX` float DEFAULT '0.0',
|
||||
MODIFY `CameraEyeOffsetY` float DEFAULT '0.0',
|
||||
MODIFY `CameraEyeOffsetZ` float DEFAULT '0.0',
|
||||
MODIFY `CameraAtOffsetX` float DEFAULT '0.0',
|
||||
MODIFY `CameraAtOffsetY` float DEFAULT '0.0',
|
||||
MODIFY `CameraAtOffsetZ` float DEFAULT '0.0',
|
||||
MODIFY `Density` float DEFAULT '1000.0',
|
||||
MODIFY `GravityModifier` float DEFAULT '1.0',
|
||||
MODIFY `Friction` float DEFAULT '0.6',
|
||||
MODIFY `Restitution` float DEFAULT '0.5',
|
||||
MODIFY `AttachedPosX` float DEFAULT '0',
|
||||
MODIFY `AttachedPosY` float DEFAULT '0',
|
||||
MODIFY `AttachedPosZ` float DEFAULT '0',
|
||||
MODIFY `LoopedSoundGain` float DEFAULT '0';
|
||||
COMMIT;
|
||||
|
||||
:VERSION 61 #----- Add pseudo CRC and region cache id
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims` ADD COLUMN `pseudocrc` int DEFAULT '0';
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` char(36) DEFAULT NULL;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 62 #----- increase size of environment settings
|
||||
BEGIN;
|
||||
ALTER TABLE `regionenvironment` MODIFY `llsd_settings` MEDIUMTEXT;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 63 #----- parcel environment store
|
||||
BEGIN;
|
||||
ALTER TABLE `land` ADD COLUMN `environment` MEDIUMTEXT default NULL;
|
||||
COMMIT;
|
||||
|
||||
|
|
|
@ -118,6 +118,6 @@ COMMIT;
|
|||
|
||||
ALTER TABLE `os_groups_invites`
|
||||
|
||||
MODIFY `TMStamp` timestamp NOT NULL, default CURRENT_TIMESTAMP;
|
||||
MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -68,12 +68,34 @@ namespace OpenSim.Data.Null
|
|||
|
||||
private delegate bool Matcher(string value);
|
||||
|
||||
public RegionData GetSpecific(string regionName, UUID scopeID)
|
||||
{
|
||||
if (m_useStaticInstance && Instance != this)
|
||||
return Instance.GetSpecific(regionName, scopeID);
|
||||
|
||||
string cleanName = regionName.ToLower();
|
||||
Matcher queryMatch;
|
||||
queryMatch = delegate (string s) { return s.Equals(cleanName); };
|
||||
|
||||
lock (m_regionData)
|
||||
{
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
|
||||
if (queryMatch(r.RegionName.ToLower()))
|
||||
return(r);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<RegionData> Get(string regionName, UUID scopeID)
|
||||
{
|
||||
if (m_useStaticInstance && Instance != this)
|
||||
return Instance.Get(regionName, scopeID);
|
||||
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID);
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID);
|
||||
|
||||
string cleanName = regionName.ToLower();
|
||||
|
||||
|
|
|
@ -114,6 +114,27 @@ namespace OpenSim.Data.PGSQL
|
|||
}
|
||||
}
|
||||
|
||||
public RegionData GetSpecific(string regionName, UUID scopeID)
|
||||
{
|
||||
string sql = "select * from " + m_Realm + " where lower(\"regionName\") = lower(:regionName) ";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " and \"ScopeID\" = :scopeID";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("regionName", regionName));
|
||||
if (scopeID != UUID.Zero)
|
||||
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
|
||||
conn.Open();
|
||||
List<RegionData> ret = RunCommand(cmd);
|
||||
if (ret.Count == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
}
|
||||
|
||||
public RegionData Get(int posX, int posY, UUID scopeID)
|
||||
{
|
||||
// extend database search for maximum region size area
|
||||
|
|
|
@ -354,7 +354,9 @@ namespace OpenSim.Data.PGSQL
|
|||
""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
|
||||
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
|
||||
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
|
||||
""PhysInertia"" = :PhysInertia
|
||||
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
|
||||
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc
|
||||
|
||||
WHERE ""UUID"" = :UUID ;
|
||||
|
||||
INSERT INTO
|
||||
|
@ -368,7 +370,8 @@ namespace OpenSim.Data.PGSQL
|
|||
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
|
||||
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
|
||||
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
|
||||
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia""
|
||||
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
|
||||
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc""
|
||||
) Select
|
||||
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
|
||||
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
|
||||
|
@ -379,7 +382,8 @@ namespace OpenSim.Data.PGSQL
|
|||
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
|
||||
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
|
||||
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
|
||||
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia
|
||||
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
|
||||
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc
|
||||
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
|
||||
";
|
||||
|
||||
|
@ -766,13 +770,14 @@ namespace OpenSim.Data.PGSQL
|
|||
(""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"",
|
||||
""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"",
|
||||
""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"",
|
||||
""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"")
|
||||
""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"",
|
||||
""environment"")
|
||||
VALUES
|
||||
(:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice,
|
||||
:GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice,
|
||||
:SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell,
|
||||
:MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint,
|
||||
:AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint)";
|
||||
:AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint,:environment)";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
|
@ -821,477 +826,6 @@ namespace OpenSim.Data.PGSQL
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
string sql = @"select * from regionwindlight where ""region_id"" = :regionID";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID.ToString() ));
|
||||
conn.Open();
|
||||
using (NpgsqlDataReader result = cmd.ExecuteReader())
|
||||
{
|
||||
if (!result.Read())
|
||||
{
|
||||
//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;
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
string sql = @"delete from regionwindlight where ""region_id"" = :region_id";
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
conn.Open();
|
||||
cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID.ToString()));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
string sql = @"select region_id from regionwindlight where ""region_id"" = :region_id limit 1;";
|
||||
bool exists = false;
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
|
||||
NpgsqlDataReader dr = cmd.ExecuteReader();
|
||||
exists = dr.Read();
|
||||
}
|
||||
}
|
||||
if (exists)
|
||||
{
|
||||
RemoveRegionWindlightSettings(wl.regionID);
|
||||
}
|
||||
|
||||
// sql insert
|
||||
sql = @"INSERT INTO regionwindlight
|
||||
(region_id
|
||||
,water_color_r
|
||||
,water_color_g
|
||||
,water_color_b
|
||||
,water_fog_density_exponent
|
||||
,underwater_fog_modifier
|
||||
,reflection_wavelet_scale_1
|
||||
,reflection_wavelet_scale_2
|
||||
,reflection_wavelet_scale_3
|
||||
,fresnel_scale
|
||||
,fresnel_offset
|
||||
,refract_scale_above
|
||||
,refract_scale_below
|
||||
,blur_multiplier
|
||||
,big_wave_direction_x
|
||||
,big_wave_direction_y
|
||||
,little_wave_direction_x
|
||||
,little_wave_direction_y
|
||||
,normal_map_texture
|
||||
,horizon_r
|
||||
,horizon_g
|
||||
,horizon_b
|
||||
,horizon_i
|
||||
,haze_horizon
|
||||
,blue_density_r
|
||||
,blue_density_g
|
||||
,blue_density_b
|
||||
,blue_density_i
|
||||
,haze_density
|
||||
,density_multiplier
|
||||
,distance_multiplier
|
||||
,max_altitude
|
||||
,sun_moon_color_r
|
||||
,sun_moon_color_g
|
||||
,sun_moon_color_b
|
||||
,sun_moon_color_i
|
||||
,sun_moon_position
|
||||
,ambient_r
|
||||
,ambient_g
|
||||
,ambient_b
|
||||
,ambient_i
|
||||
,east_angle
|
||||
,sun_glow_focus
|
||||
,sun_glow_size
|
||||
,scene_gamma
|
||||
,star_brightness
|
||||
,cloud_color_r
|
||||
,cloud_color_g
|
||||
,cloud_color_b
|
||||
,cloud_color_i
|
||||
,cloud_x
|
||||
,cloud_y
|
||||
,cloud_density
|
||||
,cloud_coverage
|
||||
,cloud_scale
|
||||
,cloud_detail_x
|
||||
,cloud_detail_y
|
||||
,cloud_detail_density
|
||||
,cloud_scroll_x
|
||||
,cloud_scroll_x_lock
|
||||
,cloud_scroll_y
|
||||
,cloud_scroll_y_lock
|
||||
,draw_classic_clouds)
|
||||
VALUES
|
||||
(:region_id
|
||||
,:water_color_r
|
||||
,:water_color_g
|
||||
,:water_color_b
|
||||
,:water_fog_density_exponent
|
||||
,:underwater_fog_modifier
|
||||
,:reflection_wavelet_scale_1
|
||||
,:reflection_wavelet_scale_2
|
||||
,:reflection_wavelet_scale_3
|
||||
,:fresnel_scale
|
||||
,:fresnel_offset
|
||||
,:refract_scale_above
|
||||
,:refract_scale_below
|
||||
,:blur_multiplier
|
||||
,:big_wave_direction_x
|
||||
,:big_wave_direction_y
|
||||
,:little_wave_direction_x
|
||||
,:little_wave_direction_y
|
||||
,:normal_map_texture
|
||||
,:horizon_r
|
||||
,:horizon_g
|
||||
,:horizon_b
|
||||
,:horizon_i
|
||||
,:haze_horizon
|
||||
,:blue_density_r
|
||||
,:blue_density_g
|
||||
,:blue_density_b
|
||||
,:blue_density_i
|
||||
,:haze_density
|
||||
,:density_multiplier
|
||||
,:distance_multiplier
|
||||
,:max_altitude
|
||||
,:sun_moon_color_r
|
||||
,:sun_moon_color_g
|
||||
,:sun_moon_color_b
|
||||
,:sun_moon_color_i
|
||||
,:sun_moon_position
|
||||
,:ambient_r
|
||||
,:ambient_g
|
||||
,:ambient_b
|
||||
,:ambient_i
|
||||
,:east_angle
|
||||
,:sun_glow_focus
|
||||
,:sun_glow_size
|
||||
,:scene_gamma
|
||||
,:star_brightness
|
||||
,:cloud_color_r
|
||||
,:cloud_color_g
|
||||
,:cloud_color_b
|
||||
,:cloud_color_i
|
||||
,:cloud_x
|
||||
,:cloud_y
|
||||
,:cloud_density
|
||||
,:cloud_coverage
|
||||
,:cloud_scale
|
||||
,:cloud_detail_x
|
||||
,:cloud_detail_y
|
||||
,:cloud_detail_density
|
||||
,:cloud_scroll_x
|
||||
,:cloud_scroll_x_lock
|
||||
,:cloud_scroll_y
|
||||
,:cloud_scroll_y_lock
|
||||
,:draw_classic_clouds);";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString()));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture.ToString()));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
#region update
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // sql update
|
||||
// sql = @"UPDATE [OpenSim].[dbo].[regionwindlight]
|
||||
// SET [region_id] = @region_id
|
||||
// ,[water_color_r] = @water_color_r
|
||||
// ,[water_color_g] = @water_color_g
|
||||
// ,[water_color_b] = @water_color_b
|
||||
// ,[water_fog_density_exponent] = @water_fog_density_exponent
|
||||
// ,[underwater_fog_modifier] = @underwater_fog_modifier
|
||||
// ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1
|
||||
// ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2
|
||||
// ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3
|
||||
// ,[fresnel_scale] = @fresnel_scale
|
||||
// ,[fresnel_offset] = @fresnel_offset
|
||||
// ,[refract_scale_above] = @refract_scale_above
|
||||
// ,[refract_scale_below] = @refract_scale_below
|
||||
// ,[blur_multiplier] = @blur_multiplier
|
||||
// ,[big_wave_direction_x] = @big_wave_direction_x
|
||||
// ,[big_wave_direction_y] = @big_wave_direction_y
|
||||
// ,[little_wave_direction_x] = @little_wave_direction_x
|
||||
// ,[little_wave_direction_y] = @little_wave_direction_y
|
||||
// ,[normal_map_texture] = @normal_map_texture
|
||||
// ,[horizon_r] = @horizon_r
|
||||
// ,[horizon_g] = @horizon_g
|
||||
// ,[horizon_b] = @horizon_b
|
||||
// ,[horizon_i] = @horizon_i
|
||||
// ,[haze_horizon] = @haze_horizon
|
||||
// ,[blue_density_r] = @blue_density_r
|
||||
// ,[blue_density_g] = @blue_density_g
|
||||
// ,[blue_density_b] = @blue_density_b
|
||||
// ,[blue_density_i] = @blue_density_i
|
||||
// ,[haze_density] = @haze_density
|
||||
// ,[density_multiplier] = @density_multiplier
|
||||
// ,[distance_multiplier] = @distance_multiplier
|
||||
// ,[max_altitude] = @max_altitude
|
||||
// ,[sun_moon_color_r] = @sun_moon_color_r
|
||||
// ,[sun_moon_color_g] = @sun_moon_color_g
|
||||
// ,[sun_moon_color_b] = @sun_moon_color_b
|
||||
// ,[sun_moon_color_i] = @sun_moon_color_i
|
||||
// ,[sun_moon_position] = @sun_moon_position
|
||||
// ,[ambient_r] = @ambient_r
|
||||
// ,[ambient_g] = @ambient_g
|
||||
// ,[ambient_b] = @ambient_b
|
||||
// ,[ambient_i] = @ambient_i
|
||||
// ,[east_angle] = @east_angle
|
||||
// ,[sun_glow_focus] = @sun_glow_focus
|
||||
// ,[sun_glow_size] = @sun_glow_size
|
||||
// ,[scene_gamma] = @scene_gamma
|
||||
// ,[star_brightness] = @star_brightness
|
||||
// ,[cloud_color_r] = @cloud_color_r
|
||||
// ,[cloud_color_g] = @cloud_color_g
|
||||
// ,[cloud_color_b] = @cloud_color_b
|
||||
// ,[cloud_color_i] = @cloud_color_i
|
||||
// ,[cloud_x] = @cloud_x
|
||||
// ,[cloud_y] = @cloud_y
|
||||
// ,[cloud_density] = @cloud_density
|
||||
// ,[cloud_coverage] = @cloud_coverage
|
||||
// ,[cloud_scale] = @cloud_scale
|
||||
// ,[cloud_detail_x] = @cloud_detail_x
|
||||
// ,[cloud_detail_y] = @cloud_detail_y
|
||||
// ,[cloud_detail_density] = @cloud_detail_density
|
||||
// ,[cloud_scroll_x] = @cloud_scroll_x
|
||||
// ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock
|
||||
// ,[cloud_scroll_y] = @cloud_scroll_y
|
||||
// ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock
|
||||
// ,[draw_classic_clouds] = @draw_classic_clouds
|
||||
// WHERE region_id = @region_id";
|
||||
// using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
// {
|
||||
// conn.Open();
|
||||
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
// {
|
||||
// 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);
|
||||
|
||||
// cmd.ExecuteNonQuery();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
|
@ -1432,7 +966,7 @@ namespace OpenSim.Data.PGSQL
|
|||
,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
|
||||
,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
|
||||
""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID,
|
||||
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
|
||||
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID, ""cacheID"" = :cacheID
|
||||
WHERE ""regionUUID"" = :regionUUID";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
|
@ -1547,6 +1081,8 @@ namespace OpenSim.Data.PGSQL
|
|||
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
|
||||
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
|
||||
|
||||
if (!(row["cacheID"] is DBNull))
|
||||
newSettings.CacheID = new UUID((Guid)row["cacheID"]);
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
|
@ -1602,7 +1138,6 @@ namespace OpenSim.Data.PGSQL
|
|||
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
|
||||
newData.Dwell = Convert.ToSingle(row["Dwell"]);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
newData.UserLocation =
|
||||
|
@ -1632,6 +1167,35 @@ namespace OpenSim.Data.PGSQL
|
|||
newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
|
||||
newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
|
||||
|
||||
if (row["environment"] is DBNull)
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
string env = (string)row["environment"];
|
||||
if (string.IsNullOrEmpty(env))
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
|
||||
newData.Environment = VEnv;
|
||||
newData.EnvironmentVersion = VEnv.version;
|
||||
}
|
||||
catch
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
@ -1728,12 +1292,20 @@ namespace OpenSim.Data.PGSQL
|
|||
Convert.ToSingle(primRow["SitTargetOffsetY"]),
|
||||
Convert.ToSingle(primRow["SitTargetOffsetZ"]));
|
||||
|
||||
|
||||
prim.SitTargetOrientationLL = new Quaternion(
|
||||
Convert.ToSingle(primRow["SitTargetOrientX"]),
|
||||
Convert.ToSingle(primRow["SitTargetOrientY"]),
|
||||
Convert.ToSingle(primRow["SitTargetOrientZ"]),
|
||||
Convert.ToSingle(primRow["SitTargetOrientW"]));
|
||||
|
||||
prim.StandOffset = new Vector3(
|
||||
Convert.ToSingle(primRow["standtargetx"]),
|
||||
Convert.ToSingle(primRow["standtargety"]),
|
||||
Convert.ToSingle(primRow["standtargetz"]));
|
||||
|
||||
prim.SitActiveRange = Convert.ToSingle(primRow["sitactrange"]);
|
||||
|
||||
prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
|
||||
prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
|
||||
prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
|
||||
|
@ -1822,6 +1394,10 @@ namespace OpenSim.Data.PGSQL
|
|||
pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
|
||||
prim.PhysicsInertia = pdata;
|
||||
|
||||
int pseudocrc = Convert.ToInt32(primRow["pseudocrc"]);
|
||||
if(pseudocrc != 0)
|
||||
prim.PseudoCRC = pseudocrc;
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
||||
|
@ -2008,6 +1584,8 @@ namespace OpenSim.Data.PGSQL
|
|||
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
|
||||
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
|
||||
|
||||
parameters.Add(_Database.CreateParameter("cacheID", settings.CacheID));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
||||
|
@ -2069,6 +1647,20 @@ namespace OpenSim.Data.PGSQL
|
|||
parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds));
|
||||
parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds));
|
||||
|
||||
if (land.Environment == null)
|
||||
parameters.Add(_Database.CreateParameter("environment", ""));
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
parameters.Add(_Database.CreateParameter("environment", ViewerEnvironment.ToOSDString(land.Environment)));
|
||||
}
|
||||
catch
|
||||
{
|
||||
parameters.Add(_Database.CreateParameter("environment", ""));
|
||||
}
|
||||
}
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
||||
|
@ -2162,6 +1754,13 @@ namespace OpenSim.Data.PGSQL
|
|||
parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
|
||||
parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
|
||||
|
||||
Vector3 standTargetPos = prim.StandOffset;
|
||||
parameters.Add(_Database.CreateParameter("standtargetx", standTargetPos.X));
|
||||
parameters.Add(_Database.CreateParameter("standtargety", standTargetPos.Y));
|
||||
parameters.Add(_Database.CreateParameter("standtargetz", standTargetPos.Z));
|
||||
|
||||
parameters.Add(_Database.CreateParameter("sitactrange", prim.SitActiveRange));
|
||||
|
||||
parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
|
||||
parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
|
||||
parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
|
||||
|
@ -2260,6 +1859,8 @@ namespace OpenSim.Data.PGSQL
|
|||
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
|
||||
parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
|
||||
|
||||
parameters.Add(_Database.CreateParameter("pseudocrc", prim.PseudoCRC));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
@ -133,3 +133,9 @@ ALTER TABLE "public"."estateban"
|
|||
ADD COLUMN "banningUUID" uuid NOT NULL,
|
||||
ADD COLUMN "banTime" int4 NOT NULL DEFAULT 0;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 15
|
||||
BEGIN TRANSACTION;
|
||||
ALTER TABLE "public"."estate_settings"
|
||||
ADD COLUMN "AllowEnviromentOverride" bool NOT NULL;
|
||||
COMMIT;
|
|
@ -1232,3 +1232,26 @@ BEGIN TRANSACTION;
|
|||
|
||||
ALTER TABLE prims ADD "Vehicle" TEXT;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 49 #----- Add standtarget and sit range
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims`
|
||||
ADD COLUMN `standtargetx` real DEFAULT '0.0',
|
||||
ADD COLUMN `standtargety` real DEFAULT '0.0',
|
||||
ADD COLUMN `standtargetz` real DEFAULT '0.0',
|
||||
ADD COLUMN `sitactrange` real DEFAULT '0.0';
|
||||
COMMIT;
|
||||
|
||||
|
||||
:VERSION 50 #----- Add pseudo CRC and region cache id
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims` ADD COLUMN `pseudocrc` integer DEFAULT '0';
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` uuid DEFAULT NULL;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 51 #----- parcel environment store
|
||||
BEGIN;
|
||||
ALTER TABLE `land` ADD COLUMN `environment` varchar default NULL;
|
||||
COMMIT;
|
|
@ -74,4 +74,10 @@ ALTER TABLE `estateban` ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '0
|
|||
ALTER TABLE `estateban` ADD COLUMN `banTime` integer NOT NULL DEFAULT 0;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 12
|
||||
BEGIN;
|
||||
ALTER TABLE `estate_settings`
|
||||
ADD COLUMN `AllowEnviromentOverride` tinyint not null default 0;
|
||||
COMMIT;
|
||||
|
||||
|
||||
|
|
|
@ -377,3 +377,25 @@ COMMIT;
|
|||
BEGIN;
|
||||
ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 37 #----- Add standtarget and sit range
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims` ADD COLUMN `standtargetx` float NOT NULL DEFAULT '0.0';
|
||||
ALTER TABLE `prims` ADD COLUMN `standtargety` float NOT NULL DEFAULT '0.0';
|
||||
ALTER TABLE `prims` ADD COLUMN `standtargetz` float NOT NULL DEFAULT '0.0';
|
||||
ALTER TABLE `prims` ADD COLUMN `sitactrange` float NOT NULL DEFAULT '0.0';
|
||||
COMMIT;
|
||||
|
||||
|
||||
:VERSION 38 #----- Add pseudo CRC and region cache id
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `prims` ADD COLUMN `pseudocrc` integer DEFAULT '0';
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` char(36) DEFAULT NULL;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 39 #----- parcel environment store
|
||||
BEGIN;
|
||||
ALTER TABLE `land` ADD COLUMN `environment` TEXT default NULL;
|
||||
COMMIT;
|
||||
|
|
|
@ -186,13 +186,10 @@ namespace OpenSim.Data.SQLite
|
|||
private void DoCreate(EstateSettings es)
|
||||
{
|
||||
List<string> names = new List<string>(FieldList);
|
||||
|
||||
IDataReader r = null;
|
||||
names.Remove("EstateID");
|
||||
|
||||
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||
{
|
||||
names.Remove("EstateID");
|
||||
|
||||
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
|
||||
|
||||
cmd.CommandText = sql;
|
||||
|
@ -217,17 +214,12 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
r = cmd.ExecuteReader();
|
||||
}
|
||||
|
||||
using(IDataReader r = cmd.ExecuteReader())
|
||||
{
|
||||
r.Read();
|
||||
|
||||
es.EstateID = Convert.ToUInt32(r["id"]);
|
||||
|
||||
r.Close();
|
||||
|
||||
es.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreEstateSettings(EstateSettings es)
|
||||
|
@ -240,11 +232,10 @@ namespace OpenSim.Data.SQLite
|
|||
foreach (string f in fields)
|
||||
terms.Add(f+" = :"+f);
|
||||
|
||||
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
|
||||
|
||||
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = sql;
|
||||
cmd.CommandText = "update estate_settings set " + String.Join(", ", terms.ToArray()) + " where EstateID = :EstateID"; ;
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
||||
|
||||
foreach (string name in FieldList)
|
||||
{
|
||||
|
@ -472,8 +463,8 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
public bool LinkRegion(UUID regionID, int estateID)
|
||||
{
|
||||
SqliteTransaction transaction = m_connection.BeginTransaction();
|
||||
|
||||
using(SqliteTransaction transaction = m_connection.BeginTransaction())
|
||||
{
|
||||
// Delete any existing estate mapping for this region.
|
||||
using(SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||
{
|
||||
|
@ -503,6 +494,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<UUID> GetRegions(int estateID)
|
||||
{
|
||||
|
|
|
@ -429,75 +429,6 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load windlight settings from region storage
|
||||
/// </summary>
|
||||
/// <param name="regionUUID">RegionID</param>
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData wl = null;
|
||||
|
||||
lock (ds)
|
||||
{
|
||||
DataTable windlightTable = ds.Tables["regionwindlight"];
|
||||
DataRow windlightRow = windlightTable.Rows.Find(regionUUID.ToString());
|
||||
if (windlightRow == null)
|
||||
{
|
||||
wl = new RegionLightShareData();
|
||||
wl.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(wl);
|
||||
return wl;
|
||||
}
|
||||
wl = buildRegionWindlight(windlightRow);
|
||||
return wl;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove windlight settings from region storage
|
||||
/// </summary>
|
||||
/// <param name="regionID">RegionID</param>
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable windlightTable = ds.Tables["regionwindlight"];
|
||||
DataRow windlightRow = windlightTable.Rows.Find(regionID.ToString());
|
||||
|
||||
if (windlightRow != null)
|
||||
{
|
||||
windlightRow.Delete();
|
||||
}
|
||||
}
|
||||
Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an windlight into region storage
|
||||
/// </summary>
|
||||
/// <param name="wl">RegionLightShareData</param>
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable windlightTable = ds.Tables["regionwindlight"];
|
||||
DataRow windlightRow = windlightTable.Rows.Find(wl.regionID.ToString());
|
||||
|
||||
if (windlightRow == null)
|
||||
{
|
||||
windlightRow = windlightTable.NewRow();
|
||||
fillRegionWindlightRow(windlightRow, wl);
|
||||
windlightTable.Rows.Add(windlightRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
fillRegionWindlightRow(windlightRow, wl);
|
||||
}
|
||||
|
||||
Commit();
|
||||
}
|
||||
}
|
||||
|
||||
#region Region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
|
@ -626,10 +557,13 @@ namespace OpenSim.Data.SQLite
|
|||
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
||||
addPrim(prim, obj.UUID, regionUUID);
|
||||
}
|
||||
primDa.Update(ds, "prims");
|
||||
shapeDa.Update(ds, "primshapes");
|
||||
itemsDa.Update(ds, "primitems");
|
||||
ds.AcceptChanges();
|
||||
}
|
||||
|
||||
Commit();
|
||||
// m_log.Info("[Dump of prims]: " + ds.GetXml());
|
||||
// m_log.Info("[Dump of prims]: " + ds.GetXml());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1057,12 +991,9 @@ namespace OpenSim.Data.SQLite
|
|||
if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
|
||||
rowsToDelete.Add(rowToCheck);
|
||||
}
|
||||
for (int iter = 0; iter < rowsToDelete.Count; iter++)
|
||||
{
|
||||
for (int iter = 0; iter < rowsToDelete.Count; ++iter)
|
||||
rowsToDelete[iter].Delete();
|
||||
landaccesslist.Rows.Remove(rowsToDelete[iter]);
|
||||
}
|
||||
rowsToDelete.Clear();
|
||||
|
||||
foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList)
|
||||
{
|
||||
DataRow newAccessRow = landaccesslist.NewRow();
|
||||
|
@ -1312,6 +1243,21 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
createCol(prims, "KeyframeMotion", typeof(Byte[]));
|
||||
|
||||
createCol(prims, "PassTouches", typeof(bool));
|
||||
createCol(prims, "PassCollisions", typeof(bool));
|
||||
createCol(prims, "Vehicle", typeof(string));
|
||||
|
||||
createCol(prims, "RotationAxisLocks", typeof(byte));
|
||||
|
||||
createCol(prims, "PhysInertia", typeof(string));
|
||||
|
||||
createCol(prims, "standtargetx", typeof(float));
|
||||
createCol(prims, "standtargety", typeof(float));
|
||||
createCol(prims, "standtargetz", typeof(float));
|
||||
createCol(prims, "sitactrange", typeof(float));
|
||||
|
||||
createCol(prims, "pseudocrc", typeof(int));
|
||||
|
||||
// Add in contraints
|
||||
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
|
||||
|
||||
|
@ -1354,6 +1300,7 @@ namespace OpenSim.Data.SQLite
|
|||
createCol(shapes, "ProfileCurve", typeof(Int32));
|
||||
createCol(shapes, "ProfileHollow", typeof(Int32));
|
||||
createCol(shapes, "State", typeof(Int32));
|
||||
createCol(shapes, "LastAttachPoint", typeof(Int32));
|
||||
// text TODO: this isn't right, but I'm not sure the right
|
||||
// way to specify this as a blob atm
|
||||
createCol(shapes, "Texture", typeof(Byte[]));
|
||||
|
@ -1455,6 +1402,7 @@ namespace OpenSim.Data.SQLite
|
|||
createCol(land, "SeeAVs", typeof(Boolean));
|
||||
createCol(land, "AnyAVSounds", typeof(Boolean));
|
||||
createCol(land, "GroupAVSounds", typeof(Boolean));
|
||||
createCol(land, "environment", typeof(string));
|
||||
|
||||
land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
|
||||
|
||||
|
@ -1519,6 +1467,9 @@ namespace OpenSim.Data.SQLite
|
|||
createCol(regionsettings, "map_tile_ID", typeof(String));
|
||||
createCol(regionsettings, "TelehubObject", typeof(String));
|
||||
createCol(regionsettings, "parcel_tile_ID", typeof(String));
|
||||
createCol(regionsettings, "block_search", typeof(Boolean));
|
||||
createCol(regionsettings, "casino", typeof(Boolean));
|
||||
createCol(regionsettings, "cacheID", typeof(string));
|
||||
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
|
||||
return regionsettings;
|
||||
}
|
||||
|
@ -1724,14 +1675,18 @@ namespace OpenSim.Data.SQLite
|
|||
Convert.ToSingle(row["SitTargetOffsetY"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetZ"]));
|
||||
prim.SitTargetOrientationLL = new Quaternion(
|
||||
Convert.ToSingle(
|
||||
row["SitTargetOrientX"]),
|
||||
Convert.ToSingle(
|
||||
row["SitTargetOrientY"]),
|
||||
Convert.ToSingle(
|
||||
row["SitTargetOrientZ"]),
|
||||
Convert.ToSingle(
|
||||
row["SitTargetOrientW"]));
|
||||
Convert.ToSingle(row["SitTargetOrientX"]),
|
||||
Convert.ToSingle(row["SitTargetOrientY"]),
|
||||
Convert.ToSingle(row["SitTargetOrientZ"]),
|
||||
Convert.ToSingle(row["SitTargetOrientW"]));
|
||||
|
||||
prim.StandOffset = new Vector3(
|
||||
Convert.ToSingle(row["standtargetx"]),
|
||||
Convert.ToSingle(row["standtargety"]),
|
||||
Convert.ToSingle(row["standtargetz"])
|
||||
);
|
||||
|
||||
prim.SitActiveRange = Convert.ToSingle(row["sitactrange"]);
|
||||
|
||||
prim.ClickAction = Convert.ToByte(row["ClickAction"]);
|
||||
prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
|
||||
|
@ -1851,6 +1806,10 @@ namespace OpenSim.Data.SQLite
|
|||
pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
|
||||
prim.PhysicsInertia = pdata;
|
||||
|
||||
int pseudocrc = Convert.ToInt32(row["pseudocrc"]);
|
||||
if(pseudocrc != 0)
|
||||
prim.PseudoCRC = pseudocrc;
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
||||
|
@ -1962,6 +1921,36 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
|
||||
|
||||
if (row["environment"] is DBNull)
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
string env = (string)row["environment"];
|
||||
if (string.IsNullOrEmpty(env))
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
|
||||
newData.Environment = VEnv;
|
||||
newData.EnvironmentVersion = VEnv.version;
|
||||
}
|
||||
catch
|
||||
{
|
||||
newData.Environment = null;
|
||||
newData.EnvironmentVersion = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
@ -2014,86 +2003,12 @@ namespace OpenSim.Data.SQLite
|
|||
newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
|
||||
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
|
||||
newSettings.Casino = Convert.ToBoolean(row["casino"]);
|
||||
if (!(row["cacheID"] is System.DBNull))
|
||||
newSettings.CacheID = new UUID((String)row["cacheID"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a windlight entry from the persisted data.
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns>RegionLightShareData</returns>
|
||||
private RegionLightShareData buildRegionWindlight(DataRow row)
|
||||
{
|
||||
RegionLightShareData windlight = new RegionLightShareData();
|
||||
|
||||
windlight.regionID = new UUID((string)row["region_id"]);
|
||||
windlight.waterColor.X = Convert.ToSingle(row["water_color_r"]);
|
||||
windlight.waterColor.Y = Convert.ToSingle(row["water_color_g"]);
|
||||
windlight.waterColor.Z = Convert.ToSingle(row["water_color_b"]);
|
||||
//windlight.waterColor.W = Convert.ToSingle(row["water_color_i"]); //not implemented
|
||||
windlight.waterFogDensityExponent = Convert.ToSingle(row["water_fog_density_exponent"]);
|
||||
windlight.underwaterFogModifier = Convert.ToSingle(row["underwater_fog_modifier"]);
|
||||
windlight.reflectionWaveletScale.X = Convert.ToSingle(row["reflection_wavelet_scale_1"]);
|
||||
windlight.reflectionWaveletScale.Y = Convert.ToSingle(row["reflection_wavelet_scale_2"]);
|
||||
windlight.reflectionWaveletScale.Z = Convert.ToSingle(row["reflection_wavelet_scale_3"]);
|
||||
windlight.fresnelScale = Convert.ToSingle(row["fresnel_scale"]);
|
||||
windlight.fresnelOffset = Convert.ToSingle(row["fresnel_offset"]);
|
||||
windlight.refractScaleAbove = Convert.ToSingle(row["refract_scale_above"]);
|
||||
windlight.refractScaleBelow = Convert.ToSingle(row["refract_scale_below"]);
|
||||
windlight.blurMultiplier = Convert.ToSingle(row["blur_multiplier"]);
|
||||
windlight.bigWaveDirection.X = Convert.ToSingle(row["big_wave_direction_x"]);
|
||||
windlight.bigWaveDirection.Y = Convert.ToSingle(row["big_wave_direction_y"]);
|
||||
windlight.littleWaveDirection.X = Convert.ToSingle(row["little_wave_direction_x"]);
|
||||
windlight.littleWaveDirection.Y = Convert.ToSingle(row["little_wave_direction_y"]);
|
||||
windlight.normalMapTexture = new UUID((string)row["normal_map_texture"]);
|
||||
windlight.horizon.X = Convert.ToSingle(row["horizon_r"]);
|
||||
windlight.horizon.Y = Convert.ToSingle(row["horizon_g"]);
|
||||
windlight.horizon.Z = Convert.ToSingle(row["horizon_b"]);
|
||||
windlight.horizon.W = Convert.ToSingle(row["horizon_i"]);
|
||||
windlight.hazeHorizon = Convert.ToSingle(row["haze_horizon"]);
|
||||
windlight.blueDensity.X = Convert.ToSingle(row["blue_density_r"]);
|
||||
windlight.blueDensity.Y = Convert.ToSingle(row["blue_density_g"]);
|
||||
windlight.blueDensity.Z = Convert.ToSingle(row["blue_density_b"]);
|
||||
windlight.blueDensity.W = Convert.ToSingle(row["blue_density_i"]);
|
||||
windlight.hazeDensity = Convert.ToSingle(row["haze_density"]);
|
||||
windlight.densityMultiplier = Convert.ToSingle(row["density_multiplier"]);
|
||||
windlight.distanceMultiplier = Convert.ToSingle(row["distance_multiplier"]);
|
||||
windlight.maxAltitude = Convert.ToUInt16(row["max_altitude"]);
|
||||
windlight.sunMoonColor.X = Convert.ToSingle(row["sun_moon_color_r"]);
|
||||
windlight.sunMoonColor.Y = Convert.ToSingle(row["sun_moon_color_g"]);
|
||||
windlight.sunMoonColor.Z = Convert.ToSingle(row["sun_moon_color_b"]);
|
||||
windlight.sunMoonColor.W = Convert.ToSingle(row["sun_moon_color_i"]);
|
||||
windlight.sunMoonPosition = Convert.ToSingle(row["sun_moon_position"]);
|
||||
windlight.ambient.X = Convert.ToSingle(row["ambient_r"]);
|
||||
windlight.ambient.Y = Convert.ToSingle(row["ambient_g"]);
|
||||
windlight.ambient.Z = Convert.ToSingle(row["ambient_b"]);
|
||||
windlight.ambient.W = Convert.ToSingle(row["ambient_i"]);
|
||||
windlight.eastAngle = Convert.ToSingle(row["east_angle"]);
|
||||
windlight.sunGlowFocus = Convert.ToSingle(row["sun_glow_focus"]);
|
||||
windlight.sunGlowSize = Convert.ToSingle(row["sun_glow_size"]);
|
||||
windlight.sceneGamma = Convert.ToSingle(row["scene_gamma"]);
|
||||
windlight.starBrightness = Convert.ToSingle(row["star_brightness"]);
|
||||
windlight.cloudColor.X = Convert.ToSingle(row["cloud_color_r"]);
|
||||
windlight.cloudColor.Y = Convert.ToSingle(row["cloud_color_g"]);
|
||||
windlight.cloudColor.Z = Convert.ToSingle(row["cloud_color_b"]);
|
||||
windlight.cloudColor.W = Convert.ToSingle(row["cloud_color_i"]);
|
||||
windlight.cloudXYDensity.X = Convert.ToSingle(row["cloud_x"]);
|
||||
windlight.cloudXYDensity.Y = Convert.ToSingle(row["cloud_y"]);
|
||||
windlight.cloudXYDensity.Z = Convert.ToSingle(row["cloud_density"]);
|
||||
windlight.cloudCoverage = Convert.ToSingle(row["cloud_coverage"]);
|
||||
windlight.cloudScale = Convert.ToSingle(row["cloud_scale"]);
|
||||
windlight.cloudDetailXYDensity.X = Convert.ToSingle(row["cloud_detail_x"]);
|
||||
windlight.cloudDetailXYDensity.Y = Convert.ToSingle(row["cloud_detail_y"]);
|
||||
windlight.cloudDetailXYDensity.Z = Convert.ToSingle(row["cloud_detail_density"]);
|
||||
windlight.cloudScrollX = Convert.ToSingle(row["cloud_scroll_x"]);
|
||||
windlight.cloudScrollXLock = Convert.ToBoolean(row["cloud_scroll_x_lock"]);
|
||||
windlight.cloudScrollY = Convert.ToSingle(row["cloud_scroll_y"]);
|
||||
windlight.cloudScrollYLock = Convert.ToBoolean(row["cloud_scroll_y_lock"]);
|
||||
windlight.drawClassicClouds = Convert.ToBoolean(row["draw_classic_clouds"]);
|
||||
|
||||
return windlight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a land access entry from the persisted data.
|
||||
/// </summary>
|
||||
|
@ -2174,6 +2089,14 @@ namespace OpenSim.Data.SQLite
|
|||
row["SitTargetOrientX"] = sitTargetOrient.X;
|
||||
row["SitTargetOrientY"] = sitTargetOrient.Y;
|
||||
row["SitTargetOrientZ"] = sitTargetOrient.Z;
|
||||
|
||||
Vector3 standTarget = prim.StandOffset;
|
||||
row["standtargetx"] = standTarget.X;
|
||||
row["standtargety"] = standTarget.Y;
|
||||
row["standtargetz"] = standTarget.Z;
|
||||
|
||||
row["sitactrange"] = prim.SitActiveRange;
|
||||
|
||||
row["ColorR"] = Convert.ToInt32(prim.Color.R);
|
||||
row["ColorG"] = Convert.ToInt32(prim.Color.G);
|
||||
row["ColorB"] = Convert.ToInt32(prim.Color.B);
|
||||
|
@ -2199,7 +2122,6 @@ namespace OpenSim.Data.SQLite
|
|||
row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
|
||||
row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
|
||||
|
||||
|
||||
if ((prim.SoundFlags & 1) != 0) // Looped
|
||||
{
|
||||
row["LoopedSound"] = prim.Sound.ToString();
|
||||
|
@ -2279,6 +2201,7 @@ namespace OpenSim.Data.SQLite
|
|||
else
|
||||
row["PhysInertia"] = String.Empty;
|
||||
|
||||
row["pseudocrc"] = prim.PseudoCRC;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2366,6 +2289,20 @@ namespace OpenSim.Data.SQLite
|
|||
row["AnyAVSounds"] = land.AnyAVSounds;
|
||||
row["GroupAVSounds"] = land.GroupAVSounds;
|
||||
|
||||
if (land.Environment == null)
|
||||
row["environment"] = "";
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
row["environment"] = ViewerEnvironment.ToOSDString(land.Environment);
|
||||
}
|
||||
catch
|
||||
{
|
||||
row["environment"] = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2426,79 +2363,7 @@ namespace OpenSim.Data.SQLite
|
|||
row["parcel_tile_ID"] = settings.ParcelImageID.ToString();
|
||||
row["block_search"] = settings.GodBlockSearch;
|
||||
row["casino"] = settings.Casino;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="windlight"></param>
|
||||
private static void fillRegionWindlightRow(DataRow row, RegionLightShareData windlight)
|
||||
{
|
||||
row["region_id"] = windlight.regionID.ToString();
|
||||
row["water_color_r"] = windlight.waterColor.X;
|
||||
row["water_color_g"] = windlight.waterColor.Y;
|
||||
row["water_color_b"] = windlight.waterColor.Z;
|
||||
row["water_color_i"] = 1; //windlight.waterColor.W; //not implemented
|
||||
row["water_fog_density_exponent"] = windlight.waterFogDensityExponent;
|
||||
row["underwater_fog_modifier"] = windlight.underwaterFogModifier;
|
||||
row["reflection_wavelet_scale_1"] = windlight.reflectionWaveletScale.X;
|
||||
row["reflection_wavelet_scale_2"] = windlight.reflectionWaveletScale.Y;
|
||||
row["reflection_wavelet_scale_3"] = windlight.reflectionWaveletScale.Z;
|
||||
row["fresnel_scale"] = windlight.fresnelScale;
|
||||
row["fresnel_offset"] = windlight.fresnelOffset;
|
||||
row["refract_scale_above"] = windlight.refractScaleAbove;
|
||||
row["refract_scale_below"] = windlight.refractScaleBelow;
|
||||
row["blur_multiplier"] = windlight.blurMultiplier;
|
||||
row["big_wave_direction_x"] = windlight.bigWaveDirection.X;
|
||||
row["big_wave_direction_y"] = windlight.bigWaveDirection.Y;
|
||||
row["little_wave_direction_x"] = windlight.littleWaveDirection.X;
|
||||
row["little_wave_direction_y"] = windlight.littleWaveDirection.Y;
|
||||
row["normal_map_texture"] = windlight.normalMapTexture.ToString();
|
||||
row["horizon_r"] = windlight.horizon.X;
|
||||
row["horizon_g"] = windlight.horizon.Y;
|
||||
row["horizon_b"] = windlight.horizon.Z;
|
||||
row["horizon_i"] = windlight.horizon.W;
|
||||
row["haze_horizon"] = windlight.hazeHorizon;
|
||||
row["blue_density_r"] = windlight.blueDensity.X;
|
||||
row["blue_density_g"] = windlight.blueDensity.Y;
|
||||
row["blue_density_b"] = windlight.blueDensity.Z;
|
||||
row["blue_density_i"] = windlight.blueDensity.W;
|
||||
row["haze_density"] = windlight.hazeDensity;
|
||||
row["density_multiplier"] = windlight.densityMultiplier;
|
||||
row["distance_multiplier"] = windlight.distanceMultiplier;
|
||||
row["max_altitude"] = windlight.maxAltitude;
|
||||
row["sun_moon_color_r"] = windlight.sunMoonColor.X;
|
||||
row["sun_moon_color_g"] = windlight.sunMoonColor.Y;
|
||||
row["sun_moon_color_b"] = windlight.sunMoonColor.Z;
|
||||
row["sun_moon_color_i"] = windlight.sunMoonColor.W;
|
||||
row["sun_moon_position"] = windlight.sunMoonPosition;
|
||||
row["ambient_r"] = windlight.ambient.X;
|
||||
row["ambient_g"] = windlight.ambient.Y;
|
||||
row["ambient_b"] = windlight.ambient.Z;
|
||||
row["ambient_i"] = windlight.ambient.W;
|
||||
row["east_angle"] = windlight.eastAngle;
|
||||
row["sun_glow_focus"] = windlight.sunGlowFocus;
|
||||
row["sun_glow_size"] = windlight.sunGlowSize;
|
||||
row["scene_gamma"] = windlight.sceneGamma;
|
||||
row["star_brightness"] = windlight.starBrightness;
|
||||
row["cloud_color_r"] = windlight.cloudColor.X;
|
||||
row["cloud_color_g"] = windlight.cloudColor.Y;
|
||||
row["cloud_color_b"] = windlight.cloudColor.Z;
|
||||
row["cloud_color_i"] = windlight.cloudColor.W;
|
||||
row["cloud_x"] = windlight.cloudXYDensity.X;
|
||||
row["cloud_y"] = windlight.cloudXYDensity.Y;
|
||||
row["cloud_density"] = windlight.cloudXYDensity.Z;
|
||||
row["cloud_coverage"] = windlight.cloudCoverage;
|
||||
row["cloud_scale"] = windlight.cloudScale;
|
||||
row["cloud_detail_x"] = windlight.cloudDetailXYDensity.X;
|
||||
row["cloud_detail_y"] = windlight.cloudDetailXYDensity.Y;
|
||||
row["cloud_detail_density"] = windlight.cloudDetailXYDensity.Z;
|
||||
row["cloud_scroll_x"] = windlight.cloudScrollX;
|
||||
row["cloud_scroll_x_lock"] = windlight.cloudScrollXLock;
|
||||
row["cloud_scroll_y"] = windlight.cloudScrollY;
|
||||
row["cloud_scroll_y_lock"] = windlight.cloudScrollYLock;
|
||||
row["draw_classic_clouds"] = windlight.drawClassicClouds;
|
||||
row["cacheID"] = settings.CacheID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -495,10 +495,6 @@ namespace OpenSim.Data.Tests
|
|||
Assert.AreEqual(pricePerMeter, estateSettings.PricePerMeter);
|
||||
Assert.AreEqual(redirectGridX, estateSettings.RedirectGridX);
|
||||
Assert.AreEqual(redirectGridY, estateSettings.RedirectGridY);
|
||||
Assert.AreEqual(useGlobalTime, estateSettings.UseGlobalTime);
|
||||
Assert.AreEqual(fixedSun, estateSettings.FixedSun);
|
||||
|
||||
DataTestUtil.AssertDoubleEqualsWithTolerance(sunPosition, estateSettings.SunPosition);
|
||||
|
||||
Assert.AreEqual(allowVoice, estateSettings.AllowVoice);
|
||||
Assert.AreEqual(allowDirectTeleport, estateSettings.AllowDirectTeleport);
|
||||
|
|
|
@ -269,12 +269,12 @@ namespace OpenSim.Data.Tests
|
|||
random.NextBytes(partsys);
|
||||
DateTime expires = new DateTime(2008, 12, 20);
|
||||
DateTime rezzed = new DateTime(2009, 07, 15);
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
|
||||
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 groupos = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 offset = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Quaternion rotoff = new Quaternion(random.Next(1),random.Next(1),random.Next(1),random.Next(1));
|
||||
Vector3 velocity = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 angvelo = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 accel = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
string description = name;
|
||||
Color color = Color.FromArgb(255, 165, 50, 100);
|
||||
string text = "All Your Base Are Belong to Us";
|
||||
|
@ -289,7 +289,7 @@ namespace OpenSim.Data.Tests
|
|||
pbshap.ProfileBegin = ushort.MaxValue;
|
||||
pbshap.ProfileEnd = ushort.MaxValue;
|
||||
pbshap.ProfileHollow = ushort.MaxValue;
|
||||
Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 scale = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
|
||||
RegionInfo regionInfo = new RegionInfo();
|
||||
regionInfo.RegionID = region3;
|
||||
|
@ -378,9 +378,9 @@ namespace OpenSim.Data.Tests
|
|||
SceneObjectPart p = sogs[0].RootPart;
|
||||
Assert.That(regionh,Is.EqualTo(p.RegionHandle), "Assert.That(regionh,Is.EqualTo(p.RegionHandle))");
|
||||
//Assert.That(localid,Is.EqualTo(p.LocalId), "Assert.That(localid,Is.EqualTo(p.LocalId))");
|
||||
Assert.That(groupos,Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))");
|
||||
Assert.That(groupos, Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))");
|
||||
Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))");
|
||||
Assert.That(rotoff,Is.EqualTo(p.RotationOffset), "Assert.That(rotoff,Is.EqualTo(p.RotationOffset))");
|
||||
Assert.That(rotoff, Is.EqualTo(p.RotationOffset), "Assert.That(rotoff,Is.EqualTo(p.RotationOffset))");
|
||||
Assert.That(uuid,Is.EqualTo(p.UUID), "Assert.That(uuid,Is.EqualTo(p.UUID))");
|
||||
Assert.That(creator,Is.EqualTo(p.CreatorID), "Assert.That(creator,Is.EqualTo(p.CreatorID))");
|
||||
//Assert.That(iserial,Is.EqualTo(p.InventorySerial), "Assert.That(iserial,Is.EqualTo(p.InventorySerial))");
|
||||
|
@ -443,12 +443,12 @@ namespace OpenSim.Data.Tests
|
|||
random.NextBytes(partsys);
|
||||
DateTime expires = new DateTime(2010, 12, 20);
|
||||
DateTime rezzed = new DateTime(2005, 07, 15);
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
|
||||
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 groupos = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 offset = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Quaternion rotoff = new Quaternion(random.Next(100000),random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 velocity = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 angvelo = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 accel = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
string description = name;
|
||||
Color color = Color.FromArgb(255, 255, 255, 0);
|
||||
string text = "What You Say?{]\vz~";
|
||||
|
@ -536,12 +536,12 @@ namespace OpenSim.Data.Tests
|
|||
{
|
||||
UUID tmp = UUID.Random();
|
||||
SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
|
||||
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 groupos = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 offset = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Quaternion rotoff = new Quaternion(random.Next(100000),random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 velocity = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 angvelo = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
Vector3 accel = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
|
||||
|
||||
sop.GroupPosition = groupos;
|
||||
sop.RotationOffset = rotoff;
|
||||
|
@ -869,7 +869,6 @@ namespace OpenSim.Data.Tests
|
|||
double terrainlower = random.Next();
|
||||
Vector3 sunvector = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
|
||||
UUID terimgid = UUID.Random();
|
||||
double sunpos = random.Next();
|
||||
UUID cov = UUID.Random();
|
||||
|
||||
RegionSettings r1 = db.LoadRegionSettings(region1);
|
||||
|
@ -903,10 +902,8 @@ namespace OpenSim.Data.Tests
|
|||
r1.TerrainLowerLimit = terrainlower;
|
||||
r1.UseEstateSun = false;
|
||||
r1.Sandbox = true;
|
||||
r1.SunVector = sunvector;
|
||||
r1.TerrainImageID = terimgid;
|
||||
r1.FixedSun = true;
|
||||
r1.SunPosition = sunpos;
|
||||
r1.Covenant = cov;
|
||||
|
||||
db.StoreRegionSettings(r1);
|
||||
|
@ -941,12 +938,8 @@ namespace OpenSim.Data.Tests
|
|||
Assert.That(r1a.WaterHeight,Is.EqualTo(waterh), "Assert.That(r1a.WaterHeight,Is.EqualTo(waterh))");
|
||||
Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise), "Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise))");
|
||||
Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower), "Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower))");
|
||||
Assert.That(r1a.UseEstateSun,Is.False);
|
||||
Assert.That(r1a.Sandbox,Is.True);
|
||||
Assert.That(r1a.SunVector,Is.EqualTo(sunvector), "Assert.That(r1a.SunVector,Is.EqualTo(sunvector))");
|
||||
//Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
|
||||
Assert.That(r1a.FixedSun,Is.True);
|
||||
Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))");
|
||||
Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
|
||||
}
|
||||
|
||||
|
@ -970,7 +963,7 @@ namespace OpenSim.Data.Tests
|
|||
db.StoreTerrain(t1, region1);
|
||||
|
||||
// store terrain is async
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(500);
|
||||
|
||||
Assert.That(db.LoadTerrain(zero), Is.Null);
|
||||
Assert.That(db.LoadTerrain(region1), Is.Not.Null);
|
||||
|
@ -1000,7 +993,7 @@ namespace OpenSim.Data.Tests
|
|||
db.StoreTerrain(baseterrain2, region1);
|
||||
|
||||
// store terrain is async
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(500);
|
||||
|
||||
double[,] t1 = db.LoadTerrain(region1);
|
||||
Assert.That(CompareTerrain(t1, baseterrain1), Is.False);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
|
@ -41,26 +42,18 @@ namespace OpenSim.Framework
|
|||
/// <remarks>
|
||||
/// We lock this for operations both on this dictionary and on m_agentCircuitsByUUID
|
||||
/// </remarks>
|
||||
private Dictionary<uint, AgentCircuitData> m_agentCircuits = new Dictionary<uint, AgentCircuitData>();
|
||||
private ConcurrentDictionary<uint, AgentCircuitData> m_agentCircuits = new ConcurrentDictionary<uint, AgentCircuitData>();
|
||||
|
||||
/// <summary>
|
||||
/// Agent circuits indexed by agent UUID.
|
||||
/// </summary>
|
||||
private Dictionary<UUID, AgentCircuitData> m_agentCircuitsByUUID = new Dictionary<UUID, AgentCircuitData>();
|
||||
private ConcurrentDictionary<UUID, AgentCircuitData> m_agentCircuitsByUUID = new ConcurrentDictionary<UUID, AgentCircuitData>();
|
||||
|
||||
public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID agentID, uint circuitcode)
|
||||
{
|
||||
AgentCircuitData validcircuit = null;
|
||||
|
||||
lock (m_agentCircuits)
|
||||
{
|
||||
if (m_agentCircuits.ContainsKey(circuitcode))
|
||||
validcircuit = m_agentCircuits[circuitcode];
|
||||
}
|
||||
|
||||
AuthenticateResponse user = new AuthenticateResponse();
|
||||
|
||||
if (validcircuit == null)
|
||||
if (!m_agentCircuits.TryGetValue(circuitcode, out AgentCircuitData validcircuit) || validcircuit == null)
|
||||
{
|
||||
//don't have this circuit code in our list
|
||||
user.Authorised = false;
|
||||
|
@ -86,7 +79,6 @@ namespace OpenSim.Framework
|
|||
// Invalid
|
||||
user.Authorised = false;
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
@ -97,65 +89,39 @@ namespace OpenSim.Framework
|
|||
/// <param name="agentData"></param>
|
||||
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
{
|
||||
if (m_agentCircuits.ContainsKey(circuitCode))
|
||||
{
|
||||
RemoveCircuit(agentData.AgentID); // no duplications
|
||||
m_agentCircuits[circuitCode] = agentData;
|
||||
m_agentCircuitsByUUID[agentData.AgentID] = agentData;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_agentCircuits.Add(circuitCode, agentData);
|
||||
m_agentCircuitsByUUID[agentData.AgentID] = agentData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveCircuit(uint circuitCode)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
if (m_agentCircuits.TryRemove(circuitCode, out AgentCircuitData ac))
|
||||
{
|
||||
if (m_agentCircuits.ContainsKey(circuitCode))
|
||||
{
|
||||
UUID agentID = m_agentCircuits[circuitCode].AgentID;
|
||||
m_agentCircuits.Remove(circuitCode);
|
||||
m_agentCircuitsByUUID.Remove(agentID);
|
||||
}
|
||||
m_agentCircuitsByUUID.TryRemove(ac.AgentID, out AgentCircuitData dummy);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveCircuit(UUID agentID)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
if (m_agentCircuitsByUUID.TryRemove(agentID, out AgentCircuitData ac))
|
||||
{
|
||||
if (m_agentCircuitsByUUID.ContainsKey(agentID))
|
||||
{
|
||||
uint circuitCode = m_agentCircuitsByUUID[agentID].circuitcode;
|
||||
m_agentCircuits.Remove(circuitCode);
|
||||
m_agentCircuitsByUUID.Remove(agentID);
|
||||
}
|
||||
m_agentCircuits.TryRemove(ac.circuitcode, out AgentCircuitData dummy);
|
||||
}
|
||||
}
|
||||
|
||||
public AgentCircuitData GetAgentCircuitData(uint circuitCode)
|
||||
{
|
||||
AgentCircuitData agentCircuit = null;
|
||||
|
||||
lock (m_agentCircuits)
|
||||
m_agentCircuits.TryGetValue(circuitCode, out agentCircuit);
|
||||
|
||||
if(m_agentCircuits.TryGetValue(circuitCode, out AgentCircuitData agentCircuit))
|
||||
return agentCircuit;
|
||||
return null;
|
||||
}
|
||||
|
||||
public AgentCircuitData GetAgentCircuitData(UUID agentID)
|
||||
{
|
||||
AgentCircuitData agentCircuit = null;
|
||||
|
||||
lock (m_agentCircuits)
|
||||
m_agentCircuitsByUUID.TryGetValue(agentID, out agentCircuit);
|
||||
|
||||
if(m_agentCircuitsByUUID.TryGetValue(agentID, out AgentCircuitData agentCircuit))
|
||||
return agentCircuit;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -170,21 +136,16 @@ namespace OpenSim.Framework
|
|||
|
||||
public void UpdateAgentData(AgentCircuitData agentData)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
if (m_agentCircuits.TryGetValue(agentData.circuitcode, out AgentCircuitData ac))
|
||||
{
|
||||
if (m_agentCircuits.ContainsKey((uint) agentData.circuitcode))
|
||||
{
|
||||
m_agentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname;
|
||||
m_agentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname;
|
||||
m_agentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos;
|
||||
m_agentCircuits[(uint)agentData.circuitcode].startfar = agentData.startfar;
|
||||
ac.firstname = agentData.firstname;
|
||||
ac.lastname = agentData.lastname;
|
||||
ac.startpos = agentData.startpos;
|
||||
ac.startfar = agentData.startfar;
|
||||
|
||||
// Updated for when we don't know them before calling Scene.NewUserConnection
|
||||
m_agentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID;
|
||||
m_agentCircuits[(uint) agentData.circuitcode].SessionID = agentData.SessionID;
|
||||
|
||||
// m_log.Debug("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
|
||||
}
|
||||
ac.SecureSessionID = agentData.SecureSessionID;
|
||||
ac.SessionID = agentData.SessionID;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,38 +154,30 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <param name="circuitcode"></param>
|
||||
/// <param name="newcircuitcode"></param>
|
||||
public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode)
|
||||
public bool TryChangeCircuitCode(uint circuitcode, uint newcircuitcode)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
if(m_agentCircuits.ContainsKey(newcircuitcode))
|
||||
return false;
|
||||
if (m_agentCircuits.TryRemove(circuitcode, out AgentCircuitData agentData))
|
||||
{
|
||||
if (m_agentCircuits.ContainsKey((uint)circuitcode) && !m_agentCircuits.ContainsKey((uint)newcircuitcode))
|
||||
{
|
||||
AgentCircuitData agentData = m_agentCircuits[(uint)circuitcode];
|
||||
|
||||
agentData.circuitcode = newcircuitcode;
|
||||
|
||||
m_agentCircuits.Remove((uint)circuitcode);
|
||||
m_agentCircuits.Add(newcircuitcode, agentData);
|
||||
m_agentCircuits.TryAdd(newcircuitcode, agentData);
|
||||
m_agentCircuitsByUUID[agentData.AgentID] = agentData;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
if (m_agentCircuits.ContainsKey(circuitcode))
|
||||
m_agentCircuits[circuitcode].child = childstatus;
|
||||
if (m_agentCircuits.TryGetValue(circuitcode, out AgentCircuitData ac))
|
||||
ac.child = childstatus;
|
||||
}
|
||||
|
||||
public bool GetAgentChildStatus(uint circuitcode)
|
||||
{
|
||||
lock (m_agentCircuits)
|
||||
if (m_agentCircuits.ContainsKey(circuitcode))
|
||||
return m_agentCircuits[circuitcode].child;
|
||||
|
||||
if (m_agentCircuits.TryGetValue(circuitcode, out AgentCircuitData ac))
|
||||
return ac.child;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,12 +112,13 @@ namespace OpenSim.Framework
|
|||
/// <param name="args"></param>
|
||||
public void UnpackUpdateMessage(OSDMap args)
|
||||
{
|
||||
if (args["animation"] != null)
|
||||
animID = args["animation"].AsUUID();
|
||||
if (args["object_id"] != null)
|
||||
objectID = args["object_id"].AsUUID();
|
||||
if (args["seq_num"] != null)
|
||||
sequenceNum = args["seq_num"].AsInteger();
|
||||
OSD tmp;
|
||||
if (args.TryGetValue("animation", out tmp))
|
||||
animID = tmp.AsUUID();
|
||||
if (args.TryGetValue("object_id", out tmp))
|
||||
objectID = tmp.AsUUID();
|
||||
if (args.TryGetValue("seq_num", out tmp))
|
||||
sequenceNum = tmp.AsInteger();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
|
|
|
@ -34,12 +34,13 @@ using OpenMetaverse;
|
|||
namespace OpenSim.Framework
|
||||
{
|
||||
[Flags]
|
||||
// this enum is stuck, can not be changed or will break compatibilty with any version older than that change
|
||||
public enum AssetFlags : int
|
||||
{
|
||||
Normal = 0, // Immutable asset
|
||||
Maptile = 1, // What it says
|
||||
Rewritable = 2, // Content can be rewritten
|
||||
Collectable = 4 // Can be GC'ed after some time
|
||||
Collectable = 4, // Can be GC'ed after some time
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Framework
|
|||
|
||||
// regions and viewer compatibility
|
||||
public readonly static int TEXTURE_COUNT = 45;
|
||||
public const int TEXTURE_COUNT_PV7 = 26;
|
||||
public const int TEXTURE_COUNT_PV7 = 29;
|
||||
public const int BAKES_COUNT_PV7 = 6;
|
||||
public const int MAXWEARABLE_PV7 = 16;
|
||||
public const int MAXWEARABLE_LEGACY = 15;
|
||||
|
@ -817,7 +817,7 @@ namespace OpenSim.Framework
|
|||
return data;
|
||||
}
|
||||
|
||||
public OSDMap PackForNotecard()
|
||||
public OSDMap PackForNotecard(bool NoHuds = true)
|
||||
{
|
||||
OSDMap data = new OSDMap();
|
||||
|
||||
|
@ -868,7 +868,13 @@ namespace OpenSim.Framework
|
|||
// Attachments
|
||||
OSDArray attachs = new OSDArray(m_attachments.Count);
|
||||
foreach (AvatarAttachment attach in GetAttachments())
|
||||
{
|
||||
if (NoHuds &&
|
||||
attach.AttachPoint >= (uint)AttachmentPoint.HUDCenter2 &&
|
||||
attach.AttachPoint <= (uint)AttachmentPoint.HUDBottomRight)
|
||||
continue;
|
||||
attachs.Add(attach.Pack());
|
||||
}
|
||||
data["attachments"] = attachs;
|
||||
}
|
||||
|
||||
|
|
|
@ -571,145 +571,141 @@ namespace OpenSim.Framework
|
|||
public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
|
||||
{
|
||||
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
||||
OSD tmp;
|
||||
if (args.TryGetValue("region_id", out tmp) && tmp != null)
|
||||
UUID.TryParse(tmp.AsString(), out RegionID);
|
||||
|
||||
if (args.ContainsKey("region_id"))
|
||||
UUID.TryParse(args["region_id"].AsString(), out RegionID);
|
||||
if (args.TryGetValue("circuit_code", out tmp) && tmp != null)
|
||||
UInt32.TryParse(tmp.AsString(), out CircuitCode);
|
||||
|
||||
if (args["circuit_code"] != null)
|
||||
UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
|
||||
if (args.TryGetValue("agent_uuid", out tmp) && tmp != null)
|
||||
AgentID = tmp.AsUUID();
|
||||
|
||||
if (args["agent_uuid"] != null)
|
||||
AgentID = args["agent_uuid"].AsUUID();
|
||||
if (args.TryGetValue("session_uuid", out tmp) && tmp != null)
|
||||
SessionID = tmp.AsUUID();
|
||||
|
||||
if (args["session_uuid"] != null)
|
||||
SessionID = args["session_uuid"].AsUUID();
|
||||
if (args.TryGetValue("position", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out Position);
|
||||
|
||||
if (args["position"] != null)
|
||||
Vector3.TryParse(args["position"].AsString(), out Position);
|
||||
if (args.TryGetValue("velocity", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out Velocity);
|
||||
|
||||
if (args["velocity"] != null)
|
||||
Vector3.TryParse(args["velocity"].AsString(), out Velocity);
|
||||
if (args.TryGetValue("center", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out Center);
|
||||
|
||||
if (args["center"] != null)
|
||||
Vector3.TryParse(args["center"].AsString(), out Center);
|
||||
if (args.TryGetValue("size", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out Size);
|
||||
|
||||
if (args["size"] != null)
|
||||
Vector3.TryParse(args["size"].AsString(), out Size);
|
||||
if (args.TryGetValue("at_axis", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out AtAxis);
|
||||
|
||||
if (args["at_axis"] != null)
|
||||
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
|
||||
if (args.TryGetValue("left_axis", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out AtAxis);
|
||||
|
||||
if (args["left_axis"] != null)
|
||||
Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
|
||||
if (args.TryGetValue("up_axis", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out AtAxis);
|
||||
|
||||
if (args["up_axis"] != null)
|
||||
Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
|
||||
if (args.TryGetValue("wait_for_root", out tmp) && tmp != null)
|
||||
SenderWantsToWaitForRoot = tmp.AsBoolean();
|
||||
|
||||
if (args.ContainsKey("wait_for_root") && args["wait_for_root"] != null)
|
||||
SenderWantsToWaitForRoot = args["wait_for_root"].AsBoolean();
|
||||
if (args.TryGetValue("far", out tmp) && tmp != null)
|
||||
Far = (float)(tmp.AsReal());
|
||||
|
||||
if (args["far"] != null)
|
||||
Far = (float)(args["far"].AsReal());
|
||||
if (args.TryGetValue("aspect", out tmp) && tmp != null)
|
||||
Aspect = (float)tmp.AsReal();
|
||||
|
||||
if (args["aspect"] != null)
|
||||
Aspect = (float)args["aspect"].AsReal();
|
||||
if (args.TryGetValue("throttles", out tmp) && tmp != null)
|
||||
Throttles = tmp.AsBinary();
|
||||
|
||||
if (args["throttles"] != null)
|
||||
Throttles = args["throttles"].AsBinary();
|
||||
if (args.TryGetValue("locomotion_state", out tmp) && tmp != null)
|
||||
UInt32.TryParse(tmp.AsString(), out LocomotionState);
|
||||
|
||||
if (args["locomotion_state"] != null)
|
||||
UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
|
||||
if (args.TryGetValue("head_rotation", out tmp) && tmp != null)
|
||||
Quaternion.TryParse(tmp.AsString(), out HeadRotation);
|
||||
|
||||
if (args["head_rotation"] != null)
|
||||
Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
|
||||
if (args.TryGetValue("body_rotation", out tmp) && tmp != null)
|
||||
Quaternion.TryParse(tmp.AsString(), out BodyRotation);
|
||||
|
||||
if (args["body_rotation"] != null)
|
||||
Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
|
||||
if (args.TryGetValue("control_flags", out tmp) && tmp != null)
|
||||
UInt32.TryParse(tmp.AsString(), out ControlFlags);
|
||||
|
||||
if (args["control_flags"] != null)
|
||||
UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
|
||||
if (args.TryGetValue("energy_level", out tmp) && tmp != null)
|
||||
EnergyLevel = (float)(tmp.AsReal());
|
||||
|
||||
if (args["energy_level"] != null)
|
||||
EnergyLevel = (float)(args["energy_level"].AsReal());
|
||||
if (args.TryGetValue("god_data", out tmp) && tmp != null)
|
||||
GodData = tmp;
|
||||
|
||||
//if (args["god_level"] != null)
|
||||
// Byte.TryParse(args["god_level"].AsString(), out GodLevel);
|
||||
if (args.TryGetValue("always_run", out tmp) && tmp != null)
|
||||
AlwaysRun = tmp.AsBoolean();
|
||||
|
||||
if (args.ContainsKey("god_data") && args["god_data"] != null)
|
||||
GodData = args["god_data"];
|
||||
if (args.TryGetValue("prey_agent", out tmp) && tmp != null)
|
||||
PreyAgent = tmp.AsUUID();
|
||||
|
||||
if (args["always_run"] != null)
|
||||
AlwaysRun = args["always_run"].AsBoolean();
|
||||
if (args.TryGetValue("agent_access", out tmp) && tmp != null)
|
||||
Byte.TryParse(tmp.AsString(), out AgentAccess);
|
||||
|
||||
if (args["prey_agent"] != null)
|
||||
PreyAgent = args["prey_agent"].AsUUID();
|
||||
if (args.TryGetValue("agent_cof", out tmp) && tmp != null)
|
||||
agentCOF = tmp.AsUUID();
|
||||
|
||||
if (args["agent_access"] != null)
|
||||
Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
|
||||
|
||||
if (args.ContainsKey("agent_cof") && args["agent_cof"] != null)
|
||||
agentCOF = args["agent_cof"].AsUUID();
|
||||
|
||||
if (args.ContainsKey("crossingflags") && args["crossingflags"] != null)
|
||||
CrossingFlags = (byte)args["crossingflags"].AsInteger();
|
||||
if (args.TryGetValue("crossingflags", out tmp) && tmp != null)
|
||||
CrossingFlags = (byte)tmp.AsInteger();
|
||||
|
||||
if(CrossingFlags != 0)
|
||||
{
|
||||
if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null)
|
||||
CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger();
|
||||
if (args.TryGetValue("crossExtraFlags", out tmp) && tmp != null)
|
||||
CrossExtraFlags = (byte)tmp.AsInteger();
|
||||
}
|
||||
|
||||
if (args.ContainsKey("active_group_id") && args["active_group_id"] != null)
|
||||
ActiveGroupID = args["active_group_id"].AsUUID();
|
||||
if (args.TryGetValue("active_group_id", out tmp) && tmp != null)
|
||||
ActiveGroupID = tmp.AsUUID();
|
||||
|
||||
if (args.ContainsKey("active_group_name") && args["active_group_name"] != null)
|
||||
ActiveGroupName = args["active_group_name"].AsString();
|
||||
if (args.TryGetValue("active_group_name", out tmp) && tmp != null)
|
||||
ActiveGroupName = tmp.AsString();
|
||||
|
||||
if(args.ContainsKey("active_group_title") && args["active_group_title"] != null)
|
||||
ActiveGroupTitle = args["active_group_title"].AsString();
|
||||
if(args.TryGetValue("active_group_title", out tmp) && tmp != null)
|
||||
ActiveGroupTitle = tmp.AsString();
|
||||
|
||||
if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
|
||||
(args["children_seeds"].Type == OSDType.Array))
|
||||
if (args.TryGetValue("children_seeds", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
|
||||
OSDArray childrenSeeds = (OSDArray)tmp;
|
||||
ChildrenCapSeeds = new Dictionary<ulong, string>();
|
||||
foreach (OSD o in childrenSeeds)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
if (o is OSDMap)
|
||||
{
|
||||
ulong handle = 0;
|
||||
string seed = "";
|
||||
OSDMap pair = (OSDMap)o;
|
||||
if (pair["handle"] != null)
|
||||
if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
|
||||
if (pair.TryGetValue("handle", out tmp))
|
||||
if (!UInt64.TryParse(tmp.AsString(), out handle))
|
||||
continue;
|
||||
if (pair["seed"] != null)
|
||||
seed = pair["seed"].AsString();
|
||||
if (pair.TryGetValue("seed", out tmp))
|
||||
seed = tmp.AsString();
|
||||
if (!ChildrenCapSeeds.ContainsKey(handle))
|
||||
ChildrenCapSeeds.Add(handle, seed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
|
||||
if (args.TryGetValue("animations", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray anims = (OSDArray)(args["animations"]);
|
||||
OSDArray anims = (OSDArray)tmp;
|
||||
Anims = new Animation[anims.Count];
|
||||
int i = 0;
|
||||
foreach (OSD o in anims)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
if (o is OSDMap)
|
||||
{
|
||||
Anims[i++] = new Animation((OSDMap)o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args["default_animation"] != null)
|
||||
if (args.TryGetValue("default_animation", out tmp) && tmp is OSDMap)
|
||||
{
|
||||
try
|
||||
{
|
||||
DefaultAnim = new Animation((OSDMap)args["default_animation"]);
|
||||
DefaultAnim = new Animation((OSDMap)tmp);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -717,11 +713,11 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
if (args["animation_state"] != null)
|
||||
if (args.TryGetValue("animation_state", out tmp) && tmp is OSDMap)
|
||||
{
|
||||
try
|
||||
{
|
||||
AnimState = new Animation((OSDMap)args["animation_state"]);
|
||||
AnimState = new Animation((OSDMap)tmp);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -731,9 +727,9 @@ namespace OpenSim.Framework
|
|||
|
||||
MovementAnimationOverRides.Clear();
|
||||
|
||||
if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array)
|
||||
if (args.TryGetValue("movementAO", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray AOs = (OSDArray)(args["movementAO"]);
|
||||
OSDArray AOs = (OSDArray)tmp;
|
||||
int count = AOs.Count;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
|
@ -748,8 +744,8 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
if (args.ContainsKey("motion_state"))
|
||||
MotionState = (byte)args["motion_state"].AsInteger();
|
||||
if (args.TryGetValue("motion_state", out tmp) && tmp != null)
|
||||
MotionState = (byte)tmp.AsInteger();
|
||||
|
||||
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
||||
//{
|
||||
|
@ -762,10 +758,10 @@ namespace OpenSim.Framework
|
|||
|
||||
|
||||
// packed_appearence should contain all appearance information
|
||||
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
|
||||
if (args.TryGetValue("packed_appearance", out tmp) && tmp is OSDMap)
|
||||
{
|
||||
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
|
||||
Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
|
||||
Appearance = new AvatarAppearance((OSDMap)tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -777,19 +773,19 @@ namespace OpenSim.Framework
|
|||
// The code to unpack textures, visuals, wearables and attachments
|
||||
// should be removed; packed appearance contains the full appearance
|
||||
// This is retained for backward compatibility only
|
||||
if (args["texture_entry"] != null)
|
||||
if (args.TryGetValue("texture_entry", out tmp) && tmp != null)
|
||||
{
|
||||
byte[] rawtextures = args["texture_entry"].AsBinary();
|
||||
byte[] rawtextures = tmp.AsBinary();
|
||||
Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
|
||||
Appearance.SetTextureEntries(textures);
|
||||
}
|
||||
|
||||
if (args["visual_params"] != null)
|
||||
Appearance.SetVisualParams(args["visual_params"].AsBinary());
|
||||
if (args.TryGetValue("visual_params", out tmp) && tmp != null)
|
||||
Appearance.SetVisualParams(tmp.AsBinary());
|
||||
|
||||
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
|
||||
if (args.TryGetValue("wearables", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray wears = (OSDArray)(args["wearables"]);
|
||||
OSDArray wears = (OSDArray)tmp;
|
||||
|
||||
for (int i = 0; i < wears.Count / 2; i++)
|
||||
{
|
||||
|
@ -798,12 +794,12 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
|
||||
if (args.TryGetValue("attachments", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray attachs = (OSDArray)(args["attachments"]);
|
||||
OSDArray attachs = (OSDArray)tmp;
|
||||
foreach (OSD o in attachs)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
if (o is OSDMap)
|
||||
{
|
||||
// We know all of these must end up as attachments so we
|
||||
// append rather than replace to ensure multiple attachments
|
||||
|
@ -816,35 +812,35 @@ namespace OpenSim.Framework
|
|||
// end of code to remove
|
||||
}
|
||||
|
||||
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
|
||||
if (args.TryGetValue("controllers", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray controls = (OSDArray)(args["controllers"]);
|
||||
OSDArray controls = (OSDArray)tmp;
|
||||
Controllers = new ControllerData[controls.Count];
|
||||
int i = 0;
|
||||
foreach (OSD o in controls)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
if (o is OSDMap)
|
||||
{
|
||||
Controllers[i++] = new ControllerData((OSDMap)o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args["callback_uri"] != null)
|
||||
CallbackURI = args["callback_uri"].AsString();
|
||||
if (args.TryGetValue("callback_uri", out tmp) && tmp != null)
|
||||
CallbackURI = tmp.AsString();
|
||||
|
||||
if (args["cb_uri"] != null)
|
||||
NewCallbackURI = args["cb_uri"].AsString();
|
||||
if (args.TryGetValue("cb_uri", out tmp) && tmp != null)
|
||||
NewCallbackURI = tmp.AsString();
|
||||
|
||||
// Attachment objects
|
||||
if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
|
||||
if (args.TryGetValue("attach_objects", out tmp) && tmp is OSDArray)
|
||||
{
|
||||
OSDArray attObjs = (OSDArray)(args["attach_objects"]);
|
||||
OSDArray attObjs = (OSDArray)tmp;
|
||||
AttachmentObjects = new List<ISceneObject>();
|
||||
AttachmentObjectStates = new List<string>();
|
||||
foreach (OSD o in attObjs)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
if (o is OSDMap)
|
||||
{
|
||||
OSDMap info = (OSDMap)o;
|
||||
ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
|
||||
|
@ -856,10 +852,10 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
if (args["parent_part"] != null)
|
||||
ParentPart = args["parent_part"].AsUUID();
|
||||
if (args["sit_offset"] != null)
|
||||
Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
|
||||
if (args.TryGetValue("parent_part", out tmp) && tmp != null)
|
||||
ParentPart = tmp.AsUUID();
|
||||
if (args.TryGetValue("sit_offset", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out SitOffset);
|
||||
}
|
||||
|
||||
public AgentData()
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
}
|
||||
|
||||
public void Output(string format)
|
||||
public virtual void Output(string format)
|
||||
{
|
||||
System.Console.WriteLine(format);
|
||||
}
|
||||
|
|
|
@ -389,6 +389,11 @@ namespace OpenSim.Framework.Console
|
|||
System.Console.WriteLine();
|
||||
}
|
||||
|
||||
public override void Output(string format)
|
||||
{
|
||||
Output(format, null);
|
||||
}
|
||||
|
||||
public override void Output(string format, params object[] components)
|
||||
{
|
||||
string level = null;
|
||||
|
|
|
@ -190,6 +190,11 @@ namespace OpenSim.Framework.Console
|
|||
m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
|
||||
}
|
||||
|
||||
public override void Output(string format)
|
||||
{
|
||||
Output(format, null);
|
||||
}
|
||||
|
||||
public override void Output(string format, params object[] components)
|
||||
{
|
||||
string level = null;
|
||||
|
@ -424,10 +429,9 @@ namespace OpenSim.Framework.Console
|
|||
}
|
||||
|
||||
// This call is a CAP. The URL is the authentication.
|
||||
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
||||
string uri = "/ReadResponses/" + sessionID.ToString();
|
||||
|
||||
m_Server.AddPollServiceHTTPHandler(
|
||||
uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout
|
||||
m_Server.AddPollServiceHTTPHandler(new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout
|
||||
|
||||
// Our reply is an XML document.
|
||||
// TODO: Change this to Linq.Xml
|
||||
|
|
|
@ -25,18 +25,22 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class Constants
|
||||
{
|
||||
public const int MaxAgentAttachments = 38;
|
||||
public const int MaxAgentGroups = 60;
|
||||
|
||||
// 'RegionSize' is the legacy region size.
|
||||
// DO NOT USE THIS FOR ANY NEW CODE. Use Scene.RegionInfo.RegionSize[XYZ] as a region might not
|
||||
// be the legacy region size.
|
||||
public const uint RegionSize = 256;
|
||||
public const uint RegionHeight = 4096;
|
||||
// This could be a parameters but, really, a region of greater than this is pretty unmanageable
|
||||
public const uint MaximumRegionSize = 8192;
|
||||
|
||||
public const uint MaximumRegionSize = 4096;
|
||||
|
||||
// Since terrain is stored in 16x16 heights, regions must be a multiple of this number and that is the minimum
|
||||
public const int MinRegionSize = 16;
|
||||
|
@ -44,6 +48,9 @@ namespace OpenSim.Framework
|
|||
|
||||
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
|
||||
|
||||
public static readonly UUID m_MrOpenSimID = new UUID("11111111-1111-0000-0000-000100bba000");
|
||||
public static readonly DateTime m_MrOpenSimBorn = new DateTime(2007, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
public enum EstateAccessCodex : uint
|
||||
{
|
||||
AllowedAccess = 1,
|
||||
|
|
|
@ -115,25 +115,28 @@ namespace OpenSim.Framework
|
|||
|
||||
// Used by the sim
|
||||
//
|
||||
private bool m_UseGlobalTime = true;
|
||||
private bool m_UseGlobalTime = false;
|
||||
public bool UseGlobalTime
|
||||
{
|
||||
get { return m_UseGlobalTime; }
|
||||
set { m_UseGlobalTime = value; }
|
||||
//set { m_UseGlobalTime = value; }
|
||||
set { m_UseGlobalTime = false; }
|
||||
}
|
||||
|
||||
private bool m_FixedSun = false;
|
||||
public bool FixedSun
|
||||
{
|
||||
get { return m_FixedSun; }
|
||||
set { m_FixedSun = value; }
|
||||
// set { m_FixedSun = value; }
|
||||
set { m_FixedSun = false; }
|
||||
}
|
||||
|
||||
private double m_SunPosition = 0.0;
|
||||
public double SunPosition
|
||||
{
|
||||
get { return m_SunPosition; }
|
||||
set { m_SunPosition = value; }
|
||||
//set { m_SunPosition = value; }
|
||||
set { m_SunPosition = 0; }
|
||||
}
|
||||
|
||||
private bool m_AllowVoice = true;
|
||||
|
@ -202,7 +205,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_TaxFree = false;
|
||||
public bool TaxFree // this is now AllowAccessOverride, keeping same name to reuse DB entries
|
||||
public bool TaxFree // this is now !AllowAccessOverride, keeping same name to reuse DB entries
|
||||
{
|
||||
get { return m_TaxFree; }
|
||||
set { m_TaxFree = value; }
|
||||
|
@ -237,6 +240,13 @@ namespace OpenSim.Framework
|
|||
set { m_DenyMinors = value; }
|
||||
}
|
||||
|
||||
private bool m_AllowEnviromentOverride = false; //keep the mispell so not to go change the dbs
|
||||
public bool AllowEnvironmentOverride
|
||||
{
|
||||
get { return m_AllowEnviromentOverride; }
|
||||
set { m_AllowEnviromentOverride = value; }
|
||||
}
|
||||
|
||||
// All those lists...
|
||||
//
|
||||
private List<UUID> l_EstateManagers = new List<UUID>();
|
||||
|
|
|
@ -0,0 +1,291 @@
|
|||
/*
|
||||
* Copyright (c) 2008, openmetaverse.org, http://opensimulator.org/
|
||||
* All rights reserved.
|
||||
*
|
||||
* - 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.
|
||||
* - Neither the name of the openmetaverse.org 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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.Timers;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class ExpiringKey<Tkey1> : IDisposable
|
||||
{
|
||||
private Dictionary<Tkey1, int> m_dictionary;
|
||||
|
||||
private ReaderWriterLockSlim m_rwLock = new ReaderWriterLockSlim();
|
||||
private readonly double m_startTS;
|
||||
private readonly int expire;
|
||||
private Timer m_purgeTimer;
|
||||
|
||||
public ExpiringKey(int expireTimeinMS)
|
||||
{
|
||||
m_dictionary = new Dictionary<Tkey1, int>();
|
||||
m_startTS = Util.GetTimeStampMS();
|
||||
expire = expireTimeinMS;
|
||||
if(expire < 500)
|
||||
expire = 500;
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
private void SetTimer()
|
||||
{
|
||||
if (m_purgeTimer == null)
|
||||
{
|
||||
m_purgeTimer = new Timer()
|
||||
{
|
||||
Interval = expire,
|
||||
AutoReset = false // time drift is not a issue.
|
||||
|
||||
};
|
||||
m_purgeTimer.Elapsed += Purge;
|
||||
m_purgeTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
private void DisposeTimer()
|
||||
{
|
||||
if (m_purgeTimer != null)
|
||||
{
|
||||
m_purgeTimer.Stop();
|
||||
m_purgeTimer.Dispose();
|
||||
m_purgeTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
~ExpiringKey()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void Dispose(bool disposing)
|
||||
{
|
||||
if (m_rwLock != null)
|
||||
{
|
||||
m_rwLock.Dispose();
|
||||
m_rwLock = null;
|
||||
DisposeTimer();
|
||||
}
|
||||
}
|
||||
|
||||
private void Purge(object source, ElapsedEventArgs e)
|
||||
{
|
||||
if (m_dictionary.Count == 0)
|
||||
{
|
||||
DisposeTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
bool gotLock = false;
|
||||
int now = (int)(Util.GetTimeStampMS() - m_startTS);
|
||||
|
||||
try
|
||||
{
|
||||
try { }
|
||||
finally
|
||||
{
|
||||
m_rwLock.EnterWriteLock();
|
||||
gotLock = true;
|
||||
}
|
||||
List<Tkey1> expired = new List<Tkey1>(m_dictionary.Count);
|
||||
foreach(KeyValuePair<Tkey1,int> kvp in m_dictionary)
|
||||
{
|
||||
if(kvp.Value < now)
|
||||
expired.Add(kvp.Key);
|
||||
}
|
||||
foreach(Tkey1 key in expired)
|
||||
m_dictionary.Remove(key);
|
||||
if(m_dictionary.Count == 0)
|
||||
DisposeTimer();
|
||||
else
|
||||
m_purgeTimer.Start();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gotLock)
|
||||
m_rwLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Tkey1 key)
|
||||
{
|
||||
bool gotLock = false;
|
||||
int now = (int)(Util.GetTimeStampMS() - m_startTS) + expire;
|
||||
|
||||
try
|
||||
{
|
||||
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
|
||||
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
|
||||
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
|
||||
try { }
|
||||
finally
|
||||
{
|
||||
m_rwLock.EnterWriteLock();
|
||||
gotLock = true;
|
||||
}
|
||||
|
||||
m_dictionary[key] = now;
|
||||
SetTimer();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gotLock)
|
||||
m_rwLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Tkey1 key, int expireMS)
|
||||
{
|
||||
bool gotLock = false;
|
||||
int now;
|
||||
if (expireMS > 500)
|
||||
now = (int)(Util.GetTimeStampMS() - m_startTS) + expire;
|
||||
else
|
||||
now = (int)(Util.GetTimeStampMS() - m_startTS) + 500;
|
||||
|
||||
try
|
||||
{
|
||||
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
|
||||
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
|
||||
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
|
||||
try { }
|
||||
finally
|
||||
{
|
||||
m_rwLock.EnterWriteLock();
|
||||
gotLock = true;
|
||||
}
|
||||
|
||||
m_dictionary[key] = now;
|
||||
SetTimer();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gotLock)
|
||||
m_rwLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Remove(Tkey1 key)
|
||||
{
|
||||
bool success;
|
||||
bool gotLock = false;
|
||||
|
||||
try
|
||||
{
|
||||
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
|
||||
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
|
||||
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
|
||||
try {}
|
||||
finally
|
||||
{
|
||||
m_rwLock.EnterWriteLock();
|
||||
gotLock = true;
|
||||
}
|
||||
success = m_dictionary.Remove(key);
|
||||
if(m_dictionary.Count == 0)
|
||||
DisposeTimer();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gotLock)
|
||||
m_rwLock.ExitWriteLock();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
bool gotLock = false;
|
||||
|
||||
try
|
||||
{
|
||||
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
|
||||
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
|
||||
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
|
||||
try {}
|
||||
finally
|
||||
{
|
||||
m_rwLock.EnterWriteLock();
|
||||
gotLock = true;
|
||||
m_dictionary.Clear();
|
||||
DisposeTimer();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gotLock)
|
||||
m_rwLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return m_dictionary.Count; }
|
||||
}
|
||||
|
||||
public bool ContainsKey(Tkey1 key)
|
||||
{
|
||||
return m_dictionary.ContainsKey(key);
|
||||
}
|
||||
|
||||
public bool TryGetValue(Tkey1 key, out int value)
|
||||
{
|
||||
bool success;
|
||||
bool gotLock = false;
|
||||
|
||||
try
|
||||
{
|
||||
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
|
||||
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
|
||||
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
|
||||
try {}
|
||||
finally
|
||||
{
|
||||
m_rwLock.EnterReadLock();
|
||||
gotLock = true;
|
||||
}
|
||||
|
||||
success = m_dictionary.TryGetValue(key, out value);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gotLock)
|
||||
m_rwLock.ExitReadLock();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Framework
|
|||
/// Cache the specified asset.
|
||||
/// </summary>
|
||||
/// <param name='asset'></param>
|
||||
void Cache(AssetBase asset);
|
||||
void Cache(AssetBase asset, bool replace = false);
|
||||
|
||||
/// <summary>
|
||||
/// Cache that the specified asset wasn't found.
|
||||
|
|
|
@ -60,9 +60,8 @@ namespace OpenSim.Framework
|
|||
public delegate void ObjectAttach(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
|
||||
|
||||
public delegate void ModifyTerrain(UUID user,
|
||||
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
|
||||
UUID agentId);
|
||||
public delegate void ModifyTerrain(UUID user, float height, float seconds, float brushSize,
|
||||
byte action, float north, float west, float south, float east, int parcelLocalID);
|
||||
|
||||
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
|
||||
|
||||
|
@ -222,7 +221,9 @@ namespace OpenSim.Framework
|
|||
public delegate void AddNewPrim(
|
||||
UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart,
|
||||
UUID RayTargetID,
|
||||
byte RayEndIsIntersection);
|
||||
byte RayEndIsIntersection, uint addflags);
|
||||
|
||||
public delegate void AgentDataUpdate(IClientAPI remoteClient, UUID itemID, UUID ownerID);
|
||||
|
||||
public delegate void RequestGodlikePowers(
|
||||
UUID AgentID, UUID SessionID, UUID token, bool GodLike);
|
||||
|
@ -253,7 +254,7 @@ namespace OpenSim.Framework
|
|||
public delegate void PurgeInventoryDescendents(
|
||||
IClientAPI remoteClient, UUID folderID);
|
||||
|
||||
public delegate void FetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID);
|
||||
public delegate void FetchInventory(IClientAPI remoteClient, UUID[] items, UUID[] owner);
|
||||
|
||||
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
|
||||
|
||||
|
@ -847,7 +848,7 @@ namespace OpenSim.Framework
|
|||
event Action<IClientAPI> OnRequestAvatarsData;
|
||||
event AddNewPrim OnAddPrim;
|
||||
|
||||
event FetchInventory OnAgentDataUpdateRequest;
|
||||
event AgentDataUpdate OnAgentDataUpdateRequest;
|
||||
event TeleportLocationRequest OnSetStartLocationRequest;
|
||||
|
||||
event RequestGodlikePowers OnRequestGodlikePowers;
|
||||
|
@ -1206,10 +1207,10 @@ namespace OpenSim.Framework
|
|||
void FlushPrimUpdates();
|
||||
|
||||
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
|
||||
List<InventoryFolderBase> folders, int version, bool fetchFolders,
|
||||
bool fetchItems);
|
||||
List<InventoryFolderBase> folders, int version, int descendents,
|
||||
bool fetchFolders, bool fetchItems);
|
||||
|
||||
void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item);
|
||||
void SendInventoryItemDetails(InventoryItemBase[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Tell the client that we have created the item it requested.
|
||||
|
@ -1249,7 +1250,7 @@ namespace OpenSim.Framework
|
|||
int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice,
|
||||
float TeleportPriceExponent);
|
||||
|
||||
void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data);
|
||||
void SendAvatarPickerReply(UUID QueryID, List<UserData> users);
|
||||
|
||||
void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers,
|
||||
string groupname, string grouptitle);
|
||||
|
@ -1285,20 +1286,8 @@ namespace OpenSim.Framework
|
|||
void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch,
|
||||
string[] buttonlabels);
|
||||
|
||||
/// <summary>
|
||||
/// Update the client as to where the sun is currently located.
|
||||
/// </summary>
|
||||
/// <param name="sunPos"></param>
|
||||
/// <param name="sunVel"></param>
|
||||
/// <param name="CurrentTime">Seconds since Unix Epoch 01/01/1970 00:00:00</param>
|
||||
/// <param name="SecondsPerSunCycle"></param>
|
||||
/// <param name="SecondsPerYear"></param>
|
||||
/// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param>
|
||||
void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
|
||||
float OrbitalPosition);
|
||||
|
||||
void SendViewerTime(Vector3 sunDir, float sunphase);
|
||||
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
|
||||
void SendViewerTime(int phase);
|
||||
|
||||
void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] membershipType, string flAbout,
|
||||
uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);
|
||||
|
|
|
@ -99,5 +99,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
|
||||
void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
|
||||
void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay);
|
||||
void ClearAllEnvironments();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace OpenSim.Framework
|
|||
ILandObject Copy();
|
||||
|
||||
void SendLandUpdateToAvatarsOverMe();
|
||||
void SendLandUpdateToAvatars();
|
||||
|
||||
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
|
||||
bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay);
|
||||
|
@ -172,6 +173,8 @@ namespace OpenSim.Framework
|
|||
void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel);
|
||||
void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel);
|
||||
|
||||
void StoreEnvironment(ViewerEnvironment VEnv);
|
||||
|
||||
/// <summary>
|
||||
/// Set the media url for this land parcel
|
||||
/// </summary>
|
||||
|
|
|
@ -51,9 +51,9 @@ namespace OpenSim.Framework
|
|||
public const string LLSDEmpty = "<llsd><map /></llsd>";
|
||||
|
||||
// got tired of creating a stringbuilder all the time;
|
||||
public static StringBuilder Start(int size = 256, bool addxmlversion = false)
|
||||
public static StringBuilder Start(int size = 4096, bool addxmlversion = false)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(size);
|
||||
StringBuilder sb = osStringBuilderCache.Acquire(size);
|
||||
if(addxmlversion)
|
||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid
|
||||
else
|
||||
|
@ -69,7 +69,13 @@ namespace OpenSim.Framework
|
|||
public static string End(StringBuilder sb)
|
||||
{
|
||||
sb.Append("</llsd>");
|
||||
return sb.ToString();
|
||||
return osStringBuilderCache.GetStringAndRelease(sb);
|
||||
}
|
||||
|
||||
public static byte[] EndToNBBytes(StringBuilder sb)
|
||||
{
|
||||
sb.Append("</llsd>");
|
||||
return Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
|
||||
}
|
||||
|
||||
// map == a list of key value pairs
|
||||
|
@ -120,7 +126,7 @@ namespace OpenSim.Framework
|
|||
if(e)
|
||||
sb.Append("<boolean>1</boolean>");
|
||||
else
|
||||
sb.Append("<boolean />");
|
||||
sb.Append("<boolean>0</boolean>");
|
||||
}
|
||||
|
||||
public static void AddElem(byte e, StringBuilder sb)
|
||||
|
@ -142,7 +148,22 @@ namespace OpenSim.Framework
|
|||
else
|
||||
{
|
||||
sb.Append("<binary>"); // encode64 is default
|
||||
sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
|
||||
base64Encode(e, sb);
|
||||
sb.Append("</binary>");
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddElem(byte[] e, int start, int length, StringBuilder sb)
|
||||
{
|
||||
if (start + length >= e.Length)
|
||||
length = e.Length - start;
|
||||
|
||||
if (e == null || e.Length == 0 || length <= 0)
|
||||
sb.Append("binary />");
|
||||
else
|
||||
{
|
||||
sb.Append("<binary>"); // encode64 is default
|
||||
base64Encode(e, start, length, sb);
|
||||
sb.Append("</binary>");
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +193,7 @@ namespace OpenSim.Framework
|
|||
public static void AddElem(float e, StringBuilder sb)
|
||||
{
|
||||
if(e == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -186,7 +207,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("<array>");
|
||||
|
||||
if(e.X == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -195,7 +216,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Y == 0)
|
||||
sb.Append("<real /></array>");
|
||||
sb.Append("<real>0</real></array>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -209,7 +230,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("<array>");
|
||||
|
||||
if(e.X == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -218,7 +239,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Y == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -227,7 +248,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Z == 0)
|
||||
sb.Append("<real /></array>");
|
||||
sb.Append("<real>0</real></array>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -241,7 +262,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("<array><key>x</key>");
|
||||
|
||||
if(e.X == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -250,7 +271,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Y == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -258,7 +279,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</real>");
|
||||
}
|
||||
if(e.Z == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -267,7 +288,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.W == 0)
|
||||
sb.Append("<real /></array>");
|
||||
sb.Append("<real>0</real></array>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -279,7 +300,7 @@ namespace OpenSim.Framework
|
|||
public static void AddElem(double e, StringBuilder sb)
|
||||
{
|
||||
if(e == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -420,7 +441,7 @@ namespace OpenSim.Framework
|
|||
if(e)
|
||||
sb.Append("<boolean>1</boolean>");
|
||||
else
|
||||
sb.Append("<boolean />");
|
||||
sb.Append("<boolean>0</boolean>");
|
||||
}
|
||||
|
||||
public static void AddElem(string name, byte e, StringBuilder sb)
|
||||
|
@ -445,12 +466,31 @@ namespace OpenSim.Framework
|
|||
sb.Append(name);
|
||||
sb.Append("</key>");
|
||||
|
||||
if(e == null || e.Length == 0)
|
||||
if (e == null || e.Length == 0)
|
||||
sb.Append("binary />");
|
||||
else
|
||||
{
|
||||
sb.Append("<binary>"); // encode64 is default
|
||||
sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
|
||||
base64Encode(e, sb);
|
||||
sb.Append("</binary>");
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddElem(string name, byte[] e, int start, int length, StringBuilder sb)
|
||||
{
|
||||
sb.Append("<key>");
|
||||
sb.Append(name);
|
||||
sb.Append("</key>");
|
||||
|
||||
if (start + length >= e.Length)
|
||||
length = e.Length - start;
|
||||
|
||||
if (e == null || e.Length == 0 || length <= 0)
|
||||
sb.Append("binary />");
|
||||
else
|
||||
{
|
||||
sb.Append("<binary>"); // encode64 is default
|
||||
base64Encode(e, start, length, sb);
|
||||
sb.Append("</binary>");
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +528,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</key>");
|
||||
|
||||
if(e == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -504,7 +544,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</key><array>>");
|
||||
|
||||
if(e.X == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -513,7 +553,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Y == 0)
|
||||
sb.Append("<real /></array>");
|
||||
sb.Append("<real>0</real></array>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -529,7 +569,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</key><array>");
|
||||
|
||||
if(e.X == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -538,7 +578,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Y == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -547,7 +587,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Z == 0)
|
||||
sb.Append("<real /></array>");
|
||||
sb.Append("<real>0</real></array>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -563,7 +603,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</key><array>");
|
||||
|
||||
if(e.X == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -572,7 +612,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.Y == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -580,7 +620,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</real>");
|
||||
}
|
||||
if(e.Z == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -589,7 +629,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if(e.W == 0)
|
||||
sb.Append("<real /></array>");
|
||||
sb.Append("<real>0</real></array>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -605,7 +645,7 @@ namespace OpenSim.Framework
|
|||
sb.Append("</key>");
|
||||
|
||||
if(e == 0)
|
||||
sb.Append("<real />");
|
||||
sb.Append("<real>0</real>");
|
||||
else
|
||||
{
|
||||
sb.Append("<real>");
|
||||
|
@ -724,11 +764,8 @@ namespace OpenSim.Framework
|
|||
|
||||
public static void EscapeToXML(string s, StringBuilder sb)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
int len = s.Length;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
for (int i = 0; i < s.Length; ++i)
|
||||
{
|
||||
c = s[i];
|
||||
switch (c)
|
||||
|
@ -780,5 +817,97 @@ namespace OpenSim.Framework
|
|||
(byte)value
|
||||
};
|
||||
}
|
||||
|
||||
static readonly char[] base64Chars = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
|
||||
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d',
|
||||
'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
|
||||
't','u','v','w','x','y','z','0','1','2','3','4','5','6','7',
|
||||
'8','9','+','/'};
|
||||
|
||||
public static unsafe void base64Encode(byte[] data, StringBuilder sb)
|
||||
{
|
||||
int lenMod3 = data.Length % 3;
|
||||
int len = data.Length - lenMod3;
|
||||
|
||||
fixed (byte* d = data)
|
||||
{
|
||||
fixed (char* b64 = base64Chars)
|
||||
{
|
||||
int i = 0;
|
||||
while(i < len)
|
||||
{
|
||||
sb.Append(b64[d[i] >> 2]);
|
||||
sb.Append(b64[((d[i] & 0x03) << 4) | ((d[i + 1] & 0xf0) >> 4)]);
|
||||
sb.Append(b64[((d[i + 1] & 0x0f) << 2) | ((d[i + 2] & 0xc0) >> 6)]);
|
||||
sb.Append(b64[d[i + 2] & 0x3f]);
|
||||
i += 3;
|
||||
}
|
||||
|
||||
switch (lenMod3)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
i = len;
|
||||
sb.Append(b64[d[i] >> 2]);
|
||||
sb.Append(b64[((d[i] & 0x03) << 4) | ((d[i + 1] & 0xf0) >> 4)]);
|
||||
sb.Append(b64[((d[i + 1] & 0x0f) << 2)]);
|
||||
sb.Append('=');
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
i = len;
|
||||
sb.Append(b64[d[i] >> 2]);
|
||||
sb.Append(b64[(d[i] & 0x03) << 4]);
|
||||
sb.Append("==");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe void base64Encode(byte[] data, int start, int length, StringBuilder sb)
|
||||
{
|
||||
int lenMod3 = length % 3;
|
||||
int len = start + (length - lenMod3);
|
||||
|
||||
fixed (byte* d = data)
|
||||
{
|
||||
fixed (char* b64 = base64Chars)
|
||||
{
|
||||
int i = start;
|
||||
while(i < len)
|
||||
{
|
||||
sb.Append(b64[(d[i] & 0xfc) >> 2]);
|
||||
sb.Append(b64[((d[i] & 0x03) << 4) | (d[i + 1] >> 4)]);
|
||||
sb.Append(b64[((d[i + 1] & 0x0f) << 2) | (d[i + 2] >> 6)]);
|
||||
sb.Append(b64[d[i + 2] & 0x3f]);
|
||||
i += 3;
|
||||
}
|
||||
|
||||
switch (lenMod3)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
i = len;
|
||||
sb.Append(b64[d[i] >> 2]);
|
||||
sb.Append(b64[((d[i] & 0x03) << 4) | (d[i + 1] >> 4)]);
|
||||
sb.Append(b64[((d[i + 1] & 0x0f) << 2)]);
|
||||
sb.Append('=');
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
i = len;
|
||||
sb.Append(b64[d[i] >> 2]);
|
||||
sb.Append(b64[(d[i] & 0x03) << 4]);
|
||||
sb.Append("==");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -732,6 +732,11 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public int EnvironmentVersion = -1;
|
||||
|
||||
[XmlIgnore] //this needs to be added by hand
|
||||
public ViewerEnvironment Environment { get; set;}
|
||||
|
||||
public LandData()
|
||||
{
|
||||
_globalID = UUID.Random();
|
||||
|
@ -739,6 +744,8 @@ namespace OpenSim.Framework
|
|||
AnyAVSounds = true;
|
||||
GroupAVSounds = true;
|
||||
LastDwellTimeMS = Util.GetTimeStampMS();
|
||||
EnvironmentVersion = -1;
|
||||
Environment = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -804,6 +811,17 @@ namespace OpenSim.Framework
|
|||
landData._parcelAccessList.Add(newEntry);
|
||||
}
|
||||
|
||||
if (Environment == null)
|
||||
{
|
||||
landData.Environment = null;
|
||||
landData.EnvironmentVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
landData.Environment = Environment.Clone();
|
||||
landData.EnvironmentVersion = EnvironmentVersion;
|
||||
}
|
||||
|
||||
return landData;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,11 +52,10 @@ namespace OpenSim.Framework.Monitoring
|
|||
Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1048576.0, 3),
|
||||
Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1048576.0, 3));
|
||||
|
||||
Process myprocess = Process.GetCurrentProcess();
|
||||
// if (!myprocess.HasExited)
|
||||
try
|
||||
{
|
||||
myprocess.Refresh();
|
||||
using (Process myprocess = Process.GetCurrentProcess())
|
||||
{
|
||||
sb.AppendFormat(
|
||||
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
||||
Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0),
|
||||
|
@ -68,6 +67,7 @@ namespace OpenSim.Framework.Monitoring
|
|||
Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0),
|
||||
Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// else
|
||||
|
|
|
@ -131,7 +131,15 @@ namespace OpenSim.Framework.Monitoring
|
|||
finally
|
||||
{
|
||||
if(m_cancelSource != null)
|
||||
{
|
||||
m_cancelSource.Dispose();
|
||||
m_cancelSource = null;
|
||||
}
|
||||
if (m_jobQueue != null)
|
||||
{
|
||||
m_jobQueue.Dispose();
|
||||
m_jobQueue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,13 +246,13 @@ namespace OpenSim.Framework.Monitoring
|
|||
break;
|
||||
}
|
||||
}
|
||||
catch(ObjectDisposedException)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue",
|
||||
Name,m_jobQueue.Count);
|
||||
m_log.DebugFormat("[JobEngine] {0} Canceled ignoring {1} jobs in queue",
|
||||
Name, m_jobQueue.Count);
|
||||
break;
|
||||
}
|
||||
catch(OperationCanceledException)
|
||||
catch
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -266,6 +274,7 @@ namespace OpenSim.Framework.Monitoring
|
|||
if(LogLevel >= 1)
|
||||
m_log.DebugFormat("[{0}]: Processed job {1}",LoggingName,m_currentJob.Name);
|
||||
|
||||
m_currentJob.Action = null;
|
||||
m_currentJob = null;
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +301,7 @@ namespace OpenSim.Framework.Monitoring
|
|||
/// <summary>
|
||||
/// Action to perform when this job is processed.
|
||||
/// </summary>
|
||||
public Action Action { get; private set; }
|
||||
public Action Action { get; set; }
|
||||
|
||||
private Job(string name, string commonId, Action action)
|
||||
{
|
||||
|
|
|
@ -435,20 +435,18 @@ Asset service request failures: {3}" + Environment.NewLine,
|
|||
// Get the amount of physical memory, allocated with the instance of this program, in kilobytes;
|
||||
// the working set is the set of memory pages currently visible to this program in physical RAM
|
||||
// memory and includes both shared (e.g. system libraries) and private data
|
||||
double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0;
|
||||
int numberThreadsRunning = 0;
|
||||
double memUsage = 0;
|
||||
using(Process p = Process.GetCurrentProcess())
|
||||
{
|
||||
memUsage = p.WorkingSet64 / 1024.0;
|
||||
|
||||
// Get the number of threads from the system that are currently
|
||||
// running
|
||||
int numberThreadsRunning = 0;
|
||||
foreach (ProcessThread currentThread in
|
||||
Process.GetCurrentProcess().Threads)
|
||||
{
|
||||
// A known issue with the current process .Threads property is
|
||||
// that it can return null threads, thus don't count those as
|
||||
// running threads and prevent the program function from failing
|
||||
if (currentThread != null &&
|
||||
currentThread.ThreadState == ThreadState.Running)
|
||||
|
||||
foreach (ProcessThread currentThread in p.Threads)
|
||||
{
|
||||
if (currentThread != null && currentThread.ThreadState == ThreadState.Running)
|
||||
numberThreadsRunning++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1242,7 +1242,7 @@ namespace OpenSim.Framework
|
|||
|
||||
byte extraParamCount = data[0];
|
||||
int i = 1;
|
||||
for (int k = 0; k < extraParamCount; k++)
|
||||
for (int k = 0; k < extraParamCount; ++k)
|
||||
{
|
||||
byte epType = data[i];
|
||||
i += 6;
|
||||
|
|
|
@ -40,69 +40,12 @@ using OpenMetaverse.StructuredData;
|
|||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
[Serializable]
|
||||
public class RegionLightShareData : ICloneable
|
||||
{
|
||||
public bool valid = false;
|
||||
public UUID regionID = UUID.Zero;
|
||||
public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f);
|
||||
public float waterFogDensityExponent = 4.0f;
|
||||
public float underwaterFogModifier = 0.25f;
|
||||
public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f);
|
||||
public float fresnelScale = 0.40f;
|
||||
public float fresnelOffset = 0.50f;
|
||||
public float refractScaleAbove = 0.03f;
|
||||
public float refractScaleBelow = 0.20f;
|
||||
public float blurMultiplier = 0.040f;
|
||||
public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f);
|
||||
public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f);
|
||||
public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4");
|
||||
public Vector4 horizon = new Vector4(0.25f, 0.25f, 0.32f, 0.32f);
|
||||
public float hazeHorizon = 0.19f;
|
||||
public Vector4 blueDensity = new Vector4(0.12f, 0.22f, 0.38f, 0.38f);
|
||||
public float hazeDensity = 0.70f;
|
||||
public float densityMultiplier = 0.18f;
|
||||
public float distanceMultiplier = 0.8f;
|
||||
public UInt16 maxAltitude = 1605;
|
||||
public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
|
||||
public float sunMoonPosition = 0.317f;
|
||||
public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f);
|
||||
public float eastAngle = 0.0f;
|
||||
public float sunGlowFocus = 0.10f;
|
||||
public float sunGlowSize = 1.75f;
|
||||
public float sceneGamma = 1.0f;
|
||||
public float starBrightness = 0.0f;
|
||||
public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
|
||||
public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f);
|
||||
public float cloudCoverage = 0.27f;
|
||||
public float cloudScale = 0.42f;
|
||||
public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f);
|
||||
public float cloudScrollX = 0.20f;
|
||||
public bool cloudScrollXLock = false;
|
||||
public float cloudScrollY = 0.01f;
|
||||
public bool cloudScrollYLock = false;
|
||||
public bool drawClassicClouds = true;
|
||||
|
||||
public delegate void SaveDelegate(RegionLightShareData wl);
|
||||
public event SaveDelegate OnSave;
|
||||
public void Save()
|
||||
{
|
||||
if (OnSave != null)
|
||||
OnSave(this);
|
||||
}
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone(); // call clone method
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RegionInfo
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly string LogHeader = "[REGION INFO]";
|
||||
|
||||
|
||||
public bool commFailTF = false;
|
||||
public ConfigurationMember configMember;
|
||||
public string DataStore = String.Empty;
|
||||
|
@ -134,7 +77,6 @@ namespace OpenSim.Framework
|
|||
private int m_maxPrimsPerUser = -1;
|
||||
private int m_linksetCapacity = 0;
|
||||
private string m_regionType = String.Empty;
|
||||
private RegionLightShareData m_windlight = new RegionLightShareData();
|
||||
protected uint m_httpPort;
|
||||
protected string m_serverURI;
|
||||
protected string m_regionName = String.Empty;
|
||||
|
@ -180,7 +122,6 @@ namespace OpenSim.Framework
|
|||
|
||||
private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>();
|
||||
|
||||
public UUID CacheID { get; set;}
|
||||
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
||||
|
||||
// MT: Yes. Estates can't span trust boundaries. Therefore, it can be
|
||||
|
@ -197,8 +138,6 @@ namespace OpenSim.Framework
|
|||
public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
|
||||
{
|
||||
// m_configSource = configSource;
|
||||
CacheID = UUID.Random();
|
||||
|
||||
if (filename.ToLower().EndsWith(".ini"))
|
||||
{
|
||||
if (!File.Exists(filename)) // New region config request
|
||||
|
@ -225,7 +164,6 @@ namespace OpenSim.Framework
|
|||
source.Save(filename);
|
||||
|
||||
RegionFile = filename;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -257,7 +195,6 @@ namespace OpenSim.Framework
|
|||
ReadNiniConfig(source, name);
|
||||
|
||||
m_serverURI = string.Empty;
|
||||
CacheID = UUID.Random();
|
||||
}
|
||||
|
||||
public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||
|
@ -269,13 +206,11 @@ namespace OpenSim.Framework
|
|||
m_internalEndPoint = internalEndPoint;
|
||||
m_externalHostName = externalUri;
|
||||
m_serverURI = string.Empty;
|
||||
CacheID = UUID.Random();
|
||||
}
|
||||
|
||||
public RegionInfo()
|
||||
{
|
||||
m_serverURI = string.Empty;
|
||||
CacheID = UUID.Random();
|
||||
}
|
||||
|
||||
public EstateSettings EstateSettings
|
||||
|
@ -308,21 +243,6 @@ namespace OpenSim.Framework
|
|||
set { m_regionSettings = value; }
|
||||
}
|
||||
|
||||
public RegionLightShareData WindlightSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_windlight == null)
|
||||
{
|
||||
m_windlight = new RegionLightShareData();
|
||||
}
|
||||
|
||||
return m_windlight;
|
||||
}
|
||||
|
||||
set { m_windlight = value; }
|
||||
}
|
||||
|
||||
public float NonphysPrimMin
|
||||
{
|
||||
get { return m_nonphysPrimMin; }
|
||||
|
|
|
@ -121,15 +121,15 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private UUID m_RegionUUID = UUID.Zero;
|
||||
|
||||
public UUID RegionUUID
|
||||
{
|
||||
get { return m_RegionUUID; }
|
||||
set { m_RegionUUID = value; }
|
||||
}
|
||||
|
||||
private bool m_BlockTerraform = false;
|
||||
public UUID CacheID { get; set; } = UUID.Random();
|
||||
|
||||
private bool m_BlockTerraform = false;
|
||||
public bool BlockTerraform
|
||||
{
|
||||
get { return m_BlockTerraform; }
|
||||
|
@ -137,7 +137,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_BlockFly = false;
|
||||
|
||||
public bool BlockFly
|
||||
{
|
||||
get { return m_BlockFly; }
|
||||
|
@ -145,7 +144,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_AllowDamage = false;
|
||||
|
||||
public bool AllowDamage
|
||||
{
|
||||
get { return m_AllowDamage; }
|
||||
|
@ -153,7 +151,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_RestrictPushing = false;
|
||||
|
||||
public bool RestrictPushing
|
||||
{
|
||||
get { return m_RestrictPushing; }
|
||||
|
@ -161,7 +158,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_AllowLandResell = true;
|
||||
|
||||
public bool AllowLandResell
|
||||
{
|
||||
get { return m_AllowLandResell; }
|
||||
|
@ -169,7 +165,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_AllowLandJoinDivide = true;
|
||||
|
||||
public bool AllowLandJoinDivide
|
||||
{
|
||||
get { return m_AllowLandJoinDivide; }
|
||||
|
@ -177,7 +172,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_BlockShowInSearch = false;
|
||||
|
||||
public bool BlockShowInSearch
|
||||
{
|
||||
get { return m_BlockShowInSearch; }
|
||||
|
@ -185,7 +179,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private int m_AgentLimit = 40;
|
||||
|
||||
public int AgentLimit
|
||||
{
|
||||
get { return m_AgentLimit; }
|
||||
|
@ -193,7 +186,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_ObjectBonus = 1.0;
|
||||
|
||||
public double ObjectBonus
|
||||
{
|
||||
get { return m_ObjectBonus; }
|
||||
|
@ -201,7 +193,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private int m_Maturity = 0;
|
||||
|
||||
public int Maturity
|
||||
{
|
||||
get { return m_Maturity; }
|
||||
|
@ -209,7 +200,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_DisableScripts = false;
|
||||
|
||||
public bool DisableScripts
|
||||
{
|
||||
get { return m_DisableScripts; }
|
||||
|
@ -217,7 +207,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_DisableCollisions = false;
|
||||
|
||||
public bool DisableCollisions
|
||||
{
|
||||
get { return m_DisableCollisions; }
|
||||
|
@ -225,7 +214,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_DisablePhysics = false;
|
||||
|
||||
public bool DisablePhysics
|
||||
{
|
||||
get { return m_DisablePhysics; }
|
||||
|
@ -289,7 +277,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation1NW = 10;
|
||||
|
||||
public double Elevation1NW
|
||||
{
|
||||
get { return m_Elevation1NW; }
|
||||
|
@ -297,7 +284,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation2NW = 60;
|
||||
|
||||
public double Elevation2NW
|
||||
{
|
||||
get { return m_Elevation2NW; }
|
||||
|
@ -305,7 +291,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation1NE = 10;
|
||||
|
||||
public double Elevation1NE
|
||||
{
|
||||
get { return m_Elevation1NE; }
|
||||
|
@ -313,7 +298,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation2NE = 60;
|
||||
|
||||
public double Elevation2NE
|
||||
{
|
||||
get { return m_Elevation2NE; }
|
||||
|
@ -321,7 +305,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation1SE = 10;
|
||||
|
||||
public double Elevation1SE
|
||||
{
|
||||
get { return m_Elevation1SE; }
|
||||
|
@ -329,7 +312,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation2SE = 60;
|
||||
|
||||
public double Elevation2SE
|
||||
{
|
||||
get { return m_Elevation2SE; }
|
||||
|
@ -337,7 +319,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation1SW = 10;
|
||||
|
||||
public double Elevation1SW
|
||||
{
|
||||
get { return m_Elevation1SW; }
|
||||
|
@ -345,7 +326,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_Elevation2SW = 60;
|
||||
|
||||
public double Elevation2SW
|
||||
{
|
||||
get { return m_Elevation2SW; }
|
||||
|
@ -353,7 +333,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_WaterHeight = 20;
|
||||
|
||||
public double WaterHeight
|
||||
{
|
||||
get { return m_WaterHeight; }
|
||||
|
@ -361,7 +340,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_TerrainRaiseLimit = 100;
|
||||
|
||||
public double TerrainRaiseLimit
|
||||
{
|
||||
get { return m_TerrainRaiseLimit; }
|
||||
|
@ -369,7 +347,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private double m_TerrainLowerLimit = -100;
|
||||
|
||||
public double TerrainLowerLimit
|
||||
{
|
||||
get { return m_TerrainLowerLimit; }
|
||||
|
@ -377,7 +354,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_UseEstateSun = true;
|
||||
|
||||
public bool UseEstateSun
|
||||
{
|
||||
get { return m_UseEstateSun; }
|
||||
|
@ -385,23 +361,19 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private bool m_Sandbox = false;
|
||||
|
||||
public bool Sandbox
|
||||
{
|
||||
get { return m_Sandbox; }
|
||||
set { m_Sandbox = value; }
|
||||
}
|
||||
|
||||
private Vector3 m_SunVector;
|
||||
|
||||
public Vector3 SunVector
|
||||
{
|
||||
get { return m_SunVector; }
|
||||
set { m_SunVector = value; }
|
||||
get { return Vector3.Zero; }
|
||||
set { }
|
||||
}
|
||||
|
||||
private UUID m_ParcelImageID;
|
||||
|
||||
public UUID ParcelImageID
|
||||
{
|
||||
get { return m_ParcelImageID; }
|
||||
|
@ -409,27 +381,22 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private UUID m_TerrainImageID;
|
||||
|
||||
public UUID TerrainImageID
|
||||
{
|
||||
get { return m_TerrainImageID; }
|
||||
set { m_TerrainImageID = value; }
|
||||
}
|
||||
|
||||
private bool m_FixedSun = false;
|
||||
|
||||
public bool FixedSun
|
||||
{
|
||||
get { return m_FixedSun; }
|
||||
set { m_FixedSun = value; }
|
||||
get { return false; }
|
||||
set { }
|
||||
}
|
||||
|
||||
private double m_SunPosition = 0.0;
|
||||
|
||||
public double SunPosition
|
||||
{
|
||||
get { return m_SunPosition; }
|
||||
set { m_SunPosition = value; }
|
||||
get { return 0; }
|
||||
set { }
|
||||
}
|
||||
|
||||
private UUID m_Covenant = UUID.Zero;
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.Net;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
|
||||
|
@ -117,8 +118,7 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Default Buffer size of a block requested from the web-server
|
||||
/// </summary>
|
||||
private const int BufferSize = 4096; // Read blocks of 4 KB.
|
||||
|
||||
private const int BufferSize = 4 * 4096; // Read blocks of 4 * 4 KB.
|
||||
|
||||
/// <summary>
|
||||
/// if an exception occours during async processing, we need to save it, so it can be
|
||||
|
@ -181,10 +181,7 @@ namespace OpenSim.Framework
|
|||
/// <param name="element">path entry</param>
|
||||
public void AddResourcePath(string element)
|
||||
{
|
||||
if (isSlashed(element))
|
||||
_pathElements.Add(element.Substring(0, element.Length - 1));
|
||||
else
|
||||
_pathElements.Add(element);
|
||||
_pathElements.Add(Util.TrimEndSlash(element));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -237,16 +234,6 @@ namespace OpenSim.Framework
|
|||
set { _method = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if string contains a trailing slash '/'
|
||||
/// </summary>
|
||||
/// <param name="s">string to be examined</param>
|
||||
/// <returns>true if slash is present</returns>
|
||||
private static bool isSlashed(string s)
|
||||
{
|
||||
return s.Substring(s.Length - 1, 1) == "/";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a Uri based on the initial Url, path elements and parameters
|
||||
/// </summary>
|
||||
|
@ -339,9 +326,8 @@ namespace OpenSim.Framework
|
|||
lock (_lock)
|
||||
{
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
_request.KeepAlive = false;
|
||||
_request.ContentType = "application/xml";
|
||||
_request.Timeout = 200000;
|
||||
_request.Timeout = 90000;
|
||||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
if (auth != null)
|
||||
|
@ -351,8 +337,6 @@ namespace OpenSim.Framework
|
|||
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
|
||||
{
|
||||
using (_response = (HttpWebResponse) _request.GetResponse())
|
||||
|
@ -365,12 +349,6 @@ namespace OpenSim.Framework
|
|||
_resource.Write(_readbuf, 0, length);
|
||||
length = src.Read(_readbuf, 0, BufferSize);
|
||||
}
|
||||
|
||||
// TODO! Implement timeout, without killing the server
|
||||
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
|
||||
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
||||
|
||||
// _allDone.WaitOne();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +369,6 @@ namespace OpenSim.Framework
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (_asyncException != null)
|
||||
throw _asyncException;
|
||||
|
||||
|
@ -408,81 +385,53 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public Stream Request(Stream src, IServiceAuth auth)
|
||||
// just post data, ignoring result
|
||||
public async Task AsyncPOSTRequest(byte[] src, IServiceAuth auth)
|
||||
{
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
_request.KeepAlive = false;
|
||||
_request = (HttpWebRequest)WebRequest.Create(buildUri());
|
||||
_request.ContentType = "application/xml";
|
||||
_request.Timeout = 90000;
|
||||
_request.Method = RequestMethod;
|
||||
_request.Method = "POST";
|
||||
_asyncException = null;
|
||||
_request.ContentLength = src.Length;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
src.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (Stream dst = _request.GetRequestStream())
|
||||
{
|
||||
// m_log.Debug("[REST]: GetRequestStream is ok");
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int length = src.Read(buf, 0, 1024);
|
||||
// m_log.Debug("[REST]: First Read is ok");
|
||||
while (length > 0)
|
||||
{
|
||||
dst.Write(buf, 0, length);
|
||||
length = src.Read(buf, 0, 1024);
|
||||
}
|
||||
await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
_response = (HttpWebResponse)_request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
using(HttpWebResponse response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false))
|
||||
{
|
||||
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 (Stream responseStream = response.GetResponseStream())
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(responseStream))
|
||||
{
|
||||
string responseStr = reader.ReadToEnd();
|
||||
string responseStr = await reader.ReadToEndAsync().ConfigureAwait(false);
|
||||
WebUtil.LogResponseDetail(reqnum, responseStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_response != null)
|
||||
_response.Close();
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
|
||||
// TODO! Implement timeout, without killing the server
|
||||
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
|
||||
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with status {1} and message {2}",
|
||||
_request.RequestUri, e.Status, e.Message);
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with exception {1} {2}",
|
||||
_request.RequestUri, e.Message, e.StackTrace);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#region Async Invocation
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using OpenMetaverse;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
|
@ -44,7 +45,6 @@ namespace OpenSim.Framework
|
|||
Material = -2
|
||||
}
|
||||
|
||||
|
||||
#region SL / file extension / content-type conversions
|
||||
|
||||
/// <summary>
|
||||
|
@ -190,6 +190,56 @@ namespace OpenSim.Framework
|
|||
private static Dictionary<sbyte, string> inventory2Content;
|
||||
private static Dictionary<string, sbyte> content2Asset;
|
||||
private static Dictionary<string, sbyte> content2Inventory;
|
||||
private static Dictionary<string, AssetType> name2Asset = new Dictionary<string, AssetType>()
|
||||
{
|
||||
{"texture", AssetType.Texture },
|
||||
{"sound", AssetType.Sound},
|
||||
{"callcard", AssetType.CallingCard},
|
||||
{"landmark", AssetType.Landmark},
|
||||
{"script", (AssetType)4},
|
||||
{"clothing", AssetType.Clothing},
|
||||
{"object", AssetType.Object},
|
||||
{"notecard", AssetType.Notecard},
|
||||
{"category", AssetType.Folder},
|
||||
{"lsltext", AssetType.LSLText},
|
||||
{"lslbyte", AssetType.LSLBytecode},
|
||||
{"txtr_tga", AssetType.TextureTGA},
|
||||
{"bodypart", AssetType.Bodypart},
|
||||
{"snd_wav", AssetType.SoundWAV},
|
||||
{"img_tga", AssetType.ImageTGA},
|
||||
{"jpeg", AssetType.ImageJPEG},
|
||||
{"animatn", AssetType.Animation},
|
||||
{"gesture", AssetType.Gesture},
|
||||
{"simstate", AssetType.Simstate},
|
||||
{"mesh", AssetType.Mesh},
|
||||
{"settings", AssetType.Settings}
|
||||
};
|
||||
private static Dictionary<string, FolderType> name2Inventory = new Dictionary<string, FolderType>()
|
||||
{
|
||||
{"texture", FolderType.Texture},
|
||||
{"sound", FolderType.Sound},
|
||||
{"callcard", FolderType.CallingCard},
|
||||
{"landmark", FolderType.Landmark},
|
||||
{"script", (FolderType)4},
|
||||
{"clothing", FolderType.Clothing},
|
||||
{"object", FolderType.Object},
|
||||
{"notecard", FolderType.Notecard},
|
||||
{"root", FolderType.Root},
|
||||
{"lsltext", FolderType.LSLText},
|
||||
{"bodypart", FolderType.BodyPart},
|
||||
{"trash", FolderType.Trash},
|
||||
{"snapshot", FolderType.Snapshot},
|
||||
{"lostandfound", FolderType.LostAndFound},
|
||||
{"animatn", FolderType.Animation},
|
||||
{"gesture", FolderType.Gesture},
|
||||
{"favorites", FolderType.Favorites},
|
||||
{"currentoutfit", FolderType.CurrentOutfit},
|
||||
{"outfit", FolderType.Outfit},
|
||||
{"myoutfits", FolderType.MyOutfits},
|
||||
{"mesh", FolderType.Mesh},
|
||||
{"settings", FolderType.Settings},
|
||||
{"suitcase", FolderType.Suitcase}
|
||||
};
|
||||
|
||||
static SLUtil()
|
||||
{
|
||||
|
@ -227,6 +277,20 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public static AssetType SLAssetName2Type(string name)
|
||||
{
|
||||
if (name2Asset.TryGetValue(name, out AssetType type))
|
||||
return type;
|
||||
return AssetType.Unknown;
|
||||
}
|
||||
|
||||
public static FolderType SLInvName2Type(string name)
|
||||
{
|
||||
if (name2Inventory.TryGetValue(name, out FolderType type))
|
||||
return type;
|
||||
return FolderType.None;
|
||||
}
|
||||
|
||||
public static string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
string contentType;
|
||||
|
@ -269,270 +333,364 @@ namespace OpenSim.Framework
|
|||
|
||||
#endregion SL / file extension / content-type conversions
|
||||
|
||||
private class NotecardReader
|
||||
{
|
||||
private string rawInput;
|
||||
private int lineNumber;
|
||||
static char[] seps = new char[] { '\t', '\n' };
|
||||
static char[] stringseps = new char[] { '|', '\n' };
|
||||
|
||||
public int LineNumber
|
||||
static byte[] moronize = new byte[16]
|
||||
{
|
||||
get
|
||||
60, 17, 94, 81, 4, 244, 82, 60, 159, 166, 152, 175, 241, 3, 71, 48
|
||||
};
|
||||
|
||||
static int getField(string note, int start, string name, bool isString, out string value)
|
||||
{
|
||||
return lineNumber;
|
||||
}
|
||||
value = String.Empty;
|
||||
int end = -1;
|
||||
int limit = note.Length - start;
|
||||
if (limit > 64)
|
||||
limit = 64;
|
||||
int indx = note.IndexOf(name, start, limit);
|
||||
if (indx < 0)
|
||||
return -1;
|
||||
indx += name.Length + 1; // eat \t
|
||||
limit = note.Length - indx - 2;
|
||||
if (limit > 129)
|
||||
limit = 129;
|
||||
if (isString)
|
||||
end = note.IndexOfAny(stringseps, indx, limit);
|
||||
else
|
||||
end = note.IndexOfAny(seps, indx, limit);
|
||||
if (end < 0)
|
||||
return -1;
|
||||
value = note.Substring(indx, end - indx);
|
||||
return end;
|
||||
}
|
||||
|
||||
public NotecardReader(string _rawInput)
|
||||
private static UUID deMoronize(UUID id)
|
||||
{
|
||||
rawInput = (string)_rawInput.Clone();
|
||||
lineNumber = 0;
|
||||
byte[] data = new byte[16];
|
||||
id.ToBytes(data,0);
|
||||
for(int i = 0; i < 16; ++i)
|
||||
data[i] ^= moronize[i];
|
||||
|
||||
return new UUID(data,0);
|
||||
}
|
||||
|
||||
public string getLine()
|
||||
public static InventoryItemBase GetEmbeddedItem(byte[] data, UUID itemID)
|
||||
{
|
||||
if(rawInput.Length == 0)
|
||||
{
|
||||
throw new NotANotecardFormatException(lineNumber + 1);
|
||||
}
|
||||
if(data == null || data.Length < 300)
|
||||
return null;
|
||||
|
||||
int pos = rawInput.IndexOf('\n');
|
||||
if(pos < 0)
|
||||
{
|
||||
pos = rawInput.Length;
|
||||
}
|
||||
string note = Util.UTF8.GetString(data);
|
||||
if (String.IsNullOrWhiteSpace(note))
|
||||
return null;
|
||||
|
||||
/* cut line from rest */
|
||||
++lineNumber;
|
||||
string line = rawInput.Substring(0, pos);
|
||||
if (pos + 1 >= rawInput.Length)
|
||||
// waste some time checking rigid versions
|
||||
string version = note.Substring(0,21);
|
||||
if (!version.Equals("Linden text version 2"))
|
||||
return null;
|
||||
|
||||
version = note.Substring(24, 25);
|
||||
if (!version.Equals("LLEmbeddedItems version 1"))
|
||||
return null;
|
||||
|
||||
int indx = note.IndexOf(itemID.ToString(), 100);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
indx = note.IndexOf("permissions", indx, 100); // skip parentID
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
string valuestr;
|
||||
|
||||
indx = getField(note, indx, "base_mask", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint basemask))
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "owner_mask", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint ownermask))
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "group_mask", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint groupmask))
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "everyone_mask", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint everyonemask))
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "next_owner_mask", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint nextownermask))
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "creator_id", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!UUID.TryParse(valuestr, out UUID creatorID))
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "owner_id", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!UUID.TryParse(valuestr, out UUID ownerID))
|
||||
return null;
|
||||
|
||||
int limit = note.Length - indx;
|
||||
if (limit > 120)
|
||||
limit = 120;
|
||||
indx = note.IndexOf('}', indx, limit); // last owner
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
int curindx = indx;
|
||||
UUID assetID = UUID.Zero;
|
||||
indx = getField(note, indx, "asset_id", false, out valuestr);
|
||||
if (indx < 0)
|
||||
{
|
||||
rawInput = string.Empty;
|
||||
indx = getField(note, curindx, "shadow_id", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!UUID.TryParse(valuestr, out assetID))
|
||||
return null;
|
||||
assetID = deMoronize(assetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
rawInput = rawInput.Substring(pos + 1);
|
||||
}
|
||||
/* clean up line from double spaces and tabs */
|
||||
line = line.Replace("\t", " ");
|
||||
while(line.IndexOf(" ") >= 0)
|
||||
{
|
||||
line = line.Replace(" ", " ");
|
||||
}
|
||||
return line.Replace("\r", "").Trim();
|
||||
if (!UUID.TryParse(valuestr, out assetID))
|
||||
return null;
|
||||
}
|
||||
|
||||
public string getBlock(int length)
|
||||
{
|
||||
/* cut line from rest */
|
||||
if(length > rawInput.Length)
|
||||
{
|
||||
throw new NotANotecardFormatException(lineNumber);
|
||||
}
|
||||
string line = rawInput.Substring(0, length);
|
||||
rawInput = rawInput.Substring(length);
|
||||
return line;
|
||||
}
|
||||
indx = getField(note, indx, "type", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
AssetType assetType = SLAssetName2Type(valuestr);
|
||||
|
||||
indx = getField(note, indx, "inv_type", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
FolderType invType = SLInvName2Type(valuestr);
|
||||
|
||||
indx = getField(note, indx, "flags", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint flags))
|
||||
return null;
|
||||
|
||||
limit = note.Length - indx;
|
||||
if (limit > 120)
|
||||
limit = 120;
|
||||
indx = note.IndexOf('}', indx, limit); // skip sale
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
indx = getField(note, indx, "name", true, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
string name = valuestr;
|
||||
|
||||
indx = getField(note, indx, "desc", true, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
string desc = valuestr;
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.AssetID = assetID;
|
||||
item.AssetType = (sbyte)assetType;
|
||||
item.BasePermissions = basemask;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
item.CreatorData = "";
|
||||
item.CreatorId = creatorID.ToString();
|
||||
item.CurrentPermissions = ownermask;
|
||||
item.Description = desc;
|
||||
item.Flags = flags;
|
||||
item.Folder = UUID.Zero;
|
||||
item.GroupID = UUID.Zero;
|
||||
item.GroupOwned = false;
|
||||
item.GroupPermissions = groupmask;
|
||||
item.InvType = (sbyte)invType;
|
||||
item.Name = name;
|
||||
item.NextPermissions = nextownermask;
|
||||
item.Owner = ownerID;
|
||||
item.SalePrice = 0;
|
||||
item.SaleType = (byte)SaleType.Not;
|
||||
item.ID = UUID.Random();
|
||||
return item;
|
||||
}
|
||||
|
||||
public class NotANotecardFormatException : Exception
|
||||
public static List<UUID> GetEmbeddedAssetIDs(byte[] data)
|
||||
{
|
||||
public int lineNumber;
|
||||
public NotANotecardFormatException(int _lineNumber)
|
||||
: base()
|
||||
{
|
||||
lineNumber = _lineNumber;
|
||||
}
|
||||
}
|
||||
if (data == null || data.Length < 79)
|
||||
return null;
|
||||
|
||||
private static void skipSection(NotecardReader reader)
|
||||
{
|
||||
if (reader.getLine() != "{")
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
string note = Util.UTF8.GetString(data);
|
||||
if (String.IsNullOrWhiteSpace(note))
|
||||
return null;
|
||||
|
||||
string line;
|
||||
while ((line = reader.getLine()) != "}")
|
||||
{
|
||||
if(line.IndexOf('{')>=0)
|
||||
{
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
// waste some time checking rigid versions
|
||||
string tmpStr = note.Substring(0, 21);
|
||||
if (!tmpStr.Equals("Linden text version 2"))
|
||||
return null;
|
||||
|
||||
private static void skipInventoryItem(NotecardReader reader)
|
||||
{
|
||||
if (reader.getLine() != "{")
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
tmpStr = note.Substring(24, 25);
|
||||
if (!tmpStr.Equals("LLEmbeddedItems version 1"))
|
||||
return null;
|
||||
|
||||
string line;
|
||||
while((line = reader.getLine()) != "}")
|
||||
{
|
||||
string[] data = line.Split(' ');
|
||||
if(data.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(data[0] == "permissions")
|
||||
{
|
||||
skipSection(reader);
|
||||
}
|
||||
else if(data[0] == "sale_info")
|
||||
{
|
||||
skipSection(reader);
|
||||
}
|
||||
else if (line.IndexOf('{') >= 0)
|
||||
{
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
tmpStr = note.Substring(52,5);
|
||||
if (!tmpStr.Equals("count"))
|
||||
return null;
|
||||
|
||||
private static void skipInventoryItems(NotecardReader reader)
|
||||
{
|
||||
if(reader.getLine() != "{")
|
||||
{
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
}
|
||||
int limit = note.Length - 57 - 2;
|
||||
if (limit > 8)
|
||||
limit = 8;
|
||||
|
||||
string line;
|
||||
while((line = reader.getLine()) != "}")
|
||||
{
|
||||
string[] data = line.Split(' ');
|
||||
if(data.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int indx = note.IndexOfAny(seps, 57, limit);
|
||||
if(indx < 0)
|
||||
return null;
|
||||
|
||||
if(data[0] == "inv_item")
|
||||
{
|
||||
skipInventoryItem(reader);
|
||||
}
|
||||
else if (line.IndexOf('{') >= 0)
|
||||
{
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
}
|
||||
if (!int.TryParse(note.Substring(57, indx - 57), out int count))
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
List<UUID> ids = new List<UUID>();
|
||||
while(count > 0)
|
||||
{
|
||||
string valuestr;
|
||||
UUID assetID = UUID.Zero;
|
||||
indx = note.IndexOf('}',indx); // skip to end of permissions
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
private static void skipInventory(NotecardReader reader)
|
||||
int curindx = indx;
|
||||
indx = getField(note, indx, "asset_id", false, out valuestr);
|
||||
if (indx < 0)
|
||||
{
|
||||
if (reader.getLine() != "{")
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
|
||||
string line;
|
||||
while((line = reader.getLine()) != "}")
|
||||
{
|
||||
string[] data = line.Split(' ');
|
||||
if(data[0] == "count")
|
||||
{
|
||||
int count = Int32.Parse(data[1]);
|
||||
for(int i = 0; i < count; ++i)
|
||||
{
|
||||
skipInventoryItems(reader);
|
||||
}
|
||||
}
|
||||
else if (line.IndexOf('{') >= 0)
|
||||
{
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string readNotecardText(NotecardReader reader)
|
||||
{
|
||||
if (reader.getLine() != "{")
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
|
||||
string notecardString = string.Empty;
|
||||
string line;
|
||||
while((line = reader.getLine()) != "}")
|
||||
{
|
||||
string[] data = line.Split(' ');
|
||||
if (data.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data[0] == "LLEmbeddedItems")
|
||||
{
|
||||
skipInventory(reader);
|
||||
}
|
||||
else if(data[0] == "Text" && data.Length == 3)
|
||||
{
|
||||
int length = Int32.Parse(data[2]);
|
||||
notecardString = reader.getBlock(length);
|
||||
}
|
||||
else if (line.IndexOf('{') >= 0)
|
||||
{
|
||||
throw new NotANotecardFormatException(reader.LineNumber);
|
||||
}
|
||||
|
||||
}
|
||||
return notecardString;
|
||||
}
|
||||
|
||||
private static string readNotecard(byte[] rawInput)
|
||||
{
|
||||
string rawIntermedInput = string.Empty;
|
||||
|
||||
/* make up a Raw Encoding here */
|
||||
foreach(byte c in rawInput)
|
||||
{
|
||||
char d = (char)c;
|
||||
rawIntermedInput += d;
|
||||
}
|
||||
|
||||
NotecardReader reader = new NotecardReader(rawIntermedInput);
|
||||
string line;
|
||||
try
|
||||
{
|
||||
line = reader.getLine();
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
return System.Text.Encoding.UTF8.GetString(rawInput);
|
||||
}
|
||||
string[] versioninfo = line.Split(' ');
|
||||
if(versioninfo.Length < 3)
|
||||
{
|
||||
return System.Text.Encoding.UTF8.GetString(rawInput);
|
||||
}
|
||||
else if(versioninfo[0] != "Linden" || versioninfo[1] != "text")
|
||||
{
|
||||
return System.Text.Encoding.UTF8.GetString(rawInput);
|
||||
indx = getField(note, curindx, "shadow_id", false, out valuestr);
|
||||
if (indx < 0)
|
||||
return null;
|
||||
if (!UUID.TryParse(valuestr, out assetID))
|
||||
return null;
|
||||
assetID = deMoronize(assetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* now we actually decode the Encoding, before we needed it in raw */
|
||||
string o = readNotecardText(reader);
|
||||
byte[] a = new byte[o.Length];
|
||||
for(int i = 0; i < o.Length; ++i)
|
||||
if (!UUID.TryParse(valuestr, out assetID))
|
||||
return null;
|
||||
}
|
||||
ids.Add(assetID);
|
||||
|
||||
indx = note.IndexOf('}', indx); // skip to end of sale
|
||||
if (indx < 0)
|
||||
return null;
|
||||
indx = getField(note, indx, "name", false, out valuestr); // avoid name contents
|
||||
if (indx < 0)
|
||||
return null;
|
||||
indx = getField(note, indx, "desc", false, out valuestr); // avoid desc contents
|
||||
if (indx < 0)
|
||||
return null;
|
||||
|
||||
if(count > 1)
|
||||
{
|
||||
a[i] = (byte)o[i];
|
||||
indx = note.IndexOf("ext char index", indx); // skip to next
|
||||
if (indx < 0)
|
||||
return null;
|
||||
}
|
||||
return System.Text.Encoding.UTF8.GetString(a);
|
||||
--count;
|
||||
}
|
||||
|
||||
indx = note.IndexOf("Text length",indx);
|
||||
if(indx > 0)
|
||||
{
|
||||
indx += 14;
|
||||
List<UUID> textIDs = Util.GetUUIDsOnString(ref note, indx, note.Length - indx);
|
||||
if(textIDs.Count > 0)
|
||||
ids.AddRange(textIDs);
|
||||
}
|
||||
if (ids.Count == 0)
|
||||
return null;
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a notecard in Linden format to a string of ordinary text.
|
||||
/// Parse a notecard in Linden format to a list of ordinary lines for LSL
|
||||
/// </summary>
|
||||
/// <param name="rawInput"></param>
|
||||
/// <returns></returns>
|
||||
public static string ParseNotecardToString(byte[] rawInput)
|
||||
{
|
||||
return readNotecard(rawInput);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a notecard in Linden format to a list of ordinary lines.
|
||||
/// </summary>
|
||||
/// <param name="rawInput"></param>
|
||||
/// <returns></returns>
|
||||
public static string[] ParseNotecardToArray(byte[] rawInput)
|
||||
public static string[] ParseNotecardToArray(byte[] data)
|
||||
{
|
||||
return readNotecard(rawInput).Replace("\r", "").Split('\n');
|
||||
// check of a valid notecard
|
||||
if (data == null || data.Length < 79)
|
||||
return new string[0];
|
||||
|
||||
//LSL can't read notecards with embedded items
|
||||
if (data[58] != '0' || data[59] != '\n')
|
||||
return new string[0];
|
||||
|
||||
string note = Util.UTF8.GetString(data);
|
||||
if (String.IsNullOrWhiteSpace(note))
|
||||
return new string[0];
|
||||
|
||||
// waste some time checking rigid versions
|
||||
string tmpStr = note.Substring(0, 21);
|
||||
if (!tmpStr.Equals("Linden text version 2"))
|
||||
return new string[0];
|
||||
|
||||
tmpStr = note.Substring(24, 25);
|
||||
if (!tmpStr.Equals("LLEmbeddedItems version 1"))
|
||||
return new string[0];
|
||||
|
||||
tmpStr = note.Substring(52, 5);
|
||||
if (!tmpStr.Equals("count"))
|
||||
return new string[0];
|
||||
|
||||
int indx = note.IndexOf("Text length", 60);
|
||||
if(indx < 0)
|
||||
return new string[0];
|
||||
|
||||
indx += 12;
|
||||
int end = indx + 1;
|
||||
for (; end < note.Length && note[end] != '\n'; ++end);
|
||||
if (note[end] != '\n')
|
||||
return new string[0];
|
||||
|
||||
tmpStr = note.Substring(indx, end - indx);
|
||||
if (!int.TryParse(tmpStr, out int textLen) || textLen == 0)
|
||||
return new string[0];
|
||||
|
||||
indx = end + 1;
|
||||
if (textLen + indx > data.Length)
|
||||
return new string[0];
|
||||
// yeackk
|
||||
note = Util.UTF8.GetString(data, indx, textLen);
|
||||
textLen = note.Length;
|
||||
indx = 0;
|
||||
var lines = new List<string>();
|
||||
while (indx < textLen)
|
||||
{
|
||||
end = indx;
|
||||
for (; end < textLen && note[end] != '\n'; ++end);
|
||||
if(end == indx)
|
||||
lines.Add(String.Empty);
|
||||
else
|
||||
lines.Add(note.Substring(indx, end - indx));
|
||||
indx = end + 1;
|
||||
}
|
||||
// notes only seem to have one text section
|
||||
|
||||
if(lines.Count == 0)
|
||||
return new string[0];
|
||||
return lines.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,8 @@ namespace OpenSim.Framework.Serialization
|
|||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ASSET_EXTENSION_SEPARATOR + "sound.wav";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR + "texture.jp2";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Settings] = ASSET_EXTENSION_SEPARATOR + "settings.bin";
|
||||
|
||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation;
|
||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bodypart.txt"] = (sbyte)AssetType.Bodypart;
|
||||
|
@ -147,6 +148,7 @@ namespace OpenSim.Framework.Serialization
|
|||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.jp2"] = (sbyte)AssetType.Texture;
|
||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
|
||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "material.xml"] = (sbyte)OpenSimAssetType.Material;
|
||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "settings.bin"] = (sbyte)AssetType.Settings;
|
||||
}
|
||||
|
||||
public static string CreateOarLandDataPath(LandData ld)
|
||||
|
|
|
@ -400,13 +400,7 @@ namespace OpenSim.Framework.Serialization.External
|
|||
/// <returns></returns>
|
||||
public static string SanitizeXml(string xmlData)
|
||||
{
|
||||
string fixedData = xmlData;
|
||||
if (fixedData != null)
|
||||
// Loop, because it may contain multiple
|
||||
while (fixedData.Contains("xmlns:xmlns:"))
|
||||
fixedData = fixedData.Replace("xmlns:xmlns:", "xmlns:");
|
||||
return fixedData;
|
||||
return xmlData.Replace("xmlns:xmlns:", "xmlns:");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
|
@ -99,6 +97,9 @@ namespace OpenSim.Framework.Serialization.External
|
|||
m_ldProcessors.Add(
|
||||
"ParcelAccessList", ProcessParcelAccessList);
|
||||
|
||||
m_ldProcessors.Add(
|
||||
"Environment", ProcessParcelEnvironment);
|
||||
|
||||
m_ldProcessors.Add(
|
||||
"PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
|
||||
m_ldProcessors.Add(
|
||||
|
@ -132,6 +133,14 @@ namespace OpenSim.Framework.Serialization.External
|
|||
);
|
||||
m_laeProcessors.Add(
|
||||
"AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
|
||||
|
||||
}
|
||||
|
||||
public static void ProcessParcelEnvironment(LandData ld, XmlReader xtr)
|
||||
{
|
||||
string senv = xtr.ReadElementString("Environment");
|
||||
ld.Environment = ViewerEnvironment.FromOSDString(senv);
|
||||
ld.EnvironmentVersion = ld.Environment.version;
|
||||
}
|
||||
|
||||
public static void ProcessParcelAccessList(LandData ld, XmlReader xtr)
|
||||
|
@ -255,6 +264,15 @@ namespace OpenSim.Framework.Serialization.External
|
|||
xtw.WriteElementString("Dwell", "0");
|
||||
xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
|
||||
|
||||
if(landData.Environment != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
string senv = ViewerEnvironment.ToOSDString(landData.Environment);
|
||||
xtw.WriteElementString("Environment", senv);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Close();
|
||||
|
|
|
@ -46,9 +46,10 @@ namespace OpenSim.Framework.Serialization.External
|
|||
/// <param name="serializedSettings"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static RegionSettings Deserialize(byte[] serializedSettings)
|
||||
public static RegionSettings Deserialize(byte[] serializedSettings, out ViewerEnvironment regionEnv)
|
||||
{
|
||||
return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
|
||||
// encoding is wrong. old oars seem to be on utf-16
|
||||
return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length), out regionEnv);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -57,9 +58,10 @@ namespace OpenSim.Framework.Serialization.External
|
|||
/// <param name="serializedSettings"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static RegionSettings Deserialize(string serializedSettings)
|
||||
public static RegionSettings Deserialize(string serializedSettings, out ViewerEnvironment regionEnv)
|
||||
{
|
||||
RegionSettings settings = new RegionSettings();
|
||||
regionEnv = null;
|
||||
|
||||
StringReader sr = new StringReader(serializedSettings);
|
||||
XmlTextReader xtr = new XmlTextReader(sr);
|
||||
|
@ -191,9 +193,12 @@ namespace OpenSim.Framework.Serialization.External
|
|||
xtr.ReadEndElement();
|
||||
|
||||
if (xtr.IsStartElement("Telehub"))
|
||||
{
|
||||
if (xtr.IsEmptyElement)
|
||||
xtr.Read();
|
||||
else
|
||||
{
|
||||
xtr.ReadStartElement("Telehub");
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
|
@ -208,6 +213,28 @@ namespace OpenSim.Framework.Serialization.External
|
|||
break;
|
||||
}
|
||||
}
|
||||
xtr.ReadEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (xtr.IsStartElement("Environment"))
|
||||
{
|
||||
if (xtr.IsEmptyElement)
|
||||
xtr.Read();
|
||||
else
|
||||
{
|
||||
xtr.ReadStartElement("Environment");
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
{
|
||||
case "data":
|
||||
regionEnv = ViewerEnvironment.FromOSDString(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
xtr.ReadEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
xtr.Close();
|
||||
|
@ -216,7 +243,7 @@ namespace OpenSim.Framework.Serialization.External
|
|||
return settings;
|
||||
}
|
||||
|
||||
public static string Serialize(RegionSettings settings)
|
||||
public static string Serialize(RegionSettings settings, ViewerEnvironment RegionEnv)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
|
@ -263,8 +290,6 @@ namespace OpenSim.Framework.Serialization.External
|
|||
xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString());
|
||||
xtw.WriteElementString("FixedSun", settings.FixedSun.ToString());
|
||||
xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
|
||||
// Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
|
||||
// calculates it automatically according to the date and other factors.
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteStartElement("Telehub");
|
||||
|
@ -276,6 +301,13 @@ namespace OpenSim.Framework.Serialization.External
|
|||
}
|
||||
xtw.WriteEndElement();
|
||||
|
||||
if (RegionEnv != null)
|
||||
{
|
||||
xtw.WriteStartElement("Environment");
|
||||
xtw.WriteElementString("data", ViewerEnvironment.ToOSDString(RegionEnv));
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Close();
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Framework.Serialization.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs);
|
||||
RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs, out ViewerEnvironment dummy);
|
||||
Assert.That(deserRs, Is.Not.Null);
|
||||
Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
|
||||
Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
|
||||
|
|
|
@ -190,8 +190,15 @@ namespace OpenSim.Framework.Servers
|
|||
//m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
|
||||
m_log.InfoFormat(
|
||||
"[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
|
||||
Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
|
||||
Environment.OSVersion, Environment.OSVersion.Platform, Environment.Is64BitProcess ? "64" : "32");
|
||||
|
||||
// next code can be changed on .net 4.7.x
|
||||
if(Util.IsWindows())
|
||||
m_log.InfoFormat("[STARTUP]: Processor Architecture: {0}({1})",
|
||||
System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", EnvironmentVariableTarget.Machine),
|
||||
BitConverter.IsLittleEndian ?"le":"be");
|
||||
|
||||
// on other platforms we need to wait for .net4.7.1
|
||||
try
|
||||
{
|
||||
StartupSpecific();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -62,24 +62,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
Description = description;
|
||||
m_httpMethod = httpMethod;
|
||||
m_path = path;
|
||||
|
||||
// FIXME: A very temporary measure to stop the simulator stats being overwhelmed with user CAPS info.
|
||||
// Needs to be fixed properly in stats display
|
||||
if (!path.StartsWith("/CAPS/"))
|
||||
{
|
||||
StatsManager.RegisterStat(
|
||||
new Stat(
|
||||
"requests",
|
||||
"requests",
|
||||
"Number of requests received by this service endpoint",
|
||||
"requests",
|
||||
"service",
|
||||
string.Format("{0}:{1}", httpMethod, path),
|
||||
StatType.Pull,
|
||||
MeasuresOfInterest.AverageChangeOverTime,
|
||||
s => s.Value = RequestsReceived,
|
||||
StatVerbosity.Debug));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string Path
|
||||
|
|
|
@ -47,30 +47,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] data = ReadFully(request);
|
||||
byte[] data;
|
||||
if (request is MemoryStream)
|
||||
data = ((MemoryStream)request).ToArray();
|
||||
else
|
||||
{
|
||||
request.Seek(0, SeekOrigin.Begin);
|
||||
using (MemoryStream ms = new MemoryStream((int)request.Length))
|
||||
{
|
||||
request.CopyTo(ms);
|
||||
data = ms.ToArray();
|
||||
}
|
||||
}
|
||||
request.Dispose();
|
||||
|
||||
string param = GetParam(path);
|
||||
string responseString = m_method(data, path, param);
|
||||
|
||||
return Encoding.UTF8.GetBytes(responseString);
|
||||
}
|
||||
|
||||
private static byte[] ReadFully(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
using (MemoryStream ms = new MemoryStream(1024*256))
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
int read = stream.Read(buffer, 0, buffer.Length);
|
||||
|
||||
if (read <= 0)
|
||||
{
|
||||
return ms.ToArray();
|
||||
}
|
||||
|
||||
ms.Write(buffer, 0, read);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -78,7 +78,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// </returns>
|
||||
bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
|
||||
|
||||
bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args);
|
||||
bool AddPollServiceHTTPHandler(string uripath, PollServiceEventArgs args);
|
||||
bool AddPollServiceHTTPHandler(PollServiceEventArgs args);
|
||||
|
||||
void RemovePollServiceHTTPHandler(string url, string path);
|
||||
void RemovePollServiceHTTPHandler(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a LLSD handler, yay.
|
||||
|
@ -93,6 +97,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// </summary>
|
||||
/// <param name="handler"></param>
|
||||
void AddStreamHandler(IRequestHandler handler);
|
||||
void AddSimpleStreamHandler(ISimpleStreamHandler handler, bool varPath = false);
|
||||
|
||||
bool AddXmlRPCHandler(string method, XmlRpcMethod handler);
|
||||
bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
|
||||
|
@ -133,18 +138,19 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// <param name="path"></param>
|
||||
void RemoveHTTPHandler(string httpMethod, string path);
|
||||
|
||||
void RemovePollServiceHTTPHandler(string httpMethod, string path);
|
||||
|
||||
bool RemoveLLSDHandler(string path, LLSDMethod handler);
|
||||
|
||||
void RemoveStreamHandler(string httpMethod, string path);
|
||||
void RemoveSimpleStreamHandler(string path);
|
||||
|
||||
void RemoveXmlRPCHandler(string method);
|
||||
|
||||
void RemoveJsonRPCHandler(string method);
|
||||
|
||||
string GetHTTP404(string host);
|
||||
|
||||
string GetHTTP500();
|
||||
string GetHTTP404();
|
||||
void AddIndexPHPMethodHandler(string key, SimpleStreamMethod sh);
|
||||
void RemoveIndexPHPMethodHandler(string key);
|
||||
SimpleStreamMethod TryGetIndexPHPMethodHandler(string key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
@ -51,9 +52,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
bool KeepAlive { get; }
|
||||
NameValueCollection QueryString { get; }
|
||||
Hashtable Query { get; }
|
||||
HashSet<string> QueryFlags { get; }
|
||||
Dictionary<string, string> QueryAsDictionary { get; } //faster than Query
|
||||
string RawUrl { get; }
|
||||
IPEndPoint RemoteIPEndPoint { get; }
|
||||
IPEndPoint LocalIPEndPoint { get; }
|
||||
Uri Url { get; }
|
||||
string UriPath { get; }
|
||||
string UserAgent { get; }
|
||||
double ArrivalTS { get; }
|
||||
}
|
||||
}
|
|
@ -92,17 +92,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
Stream OutputStream { get; }
|
||||
|
||||
string ProtocolVersion { get; set; }
|
||||
int Priority { get; set; }
|
||||
byte[] RawBuffer { get; set; }
|
||||
int RawBufferStart { get; set; }
|
||||
int RawBufferLen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the output stream feeding the body.
|
||||
/// </summary>
|
||||
Stream Body { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set a redirct location.
|
||||
/// </summary>
|
||||
string RedirectLocation { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Chunk transfers.
|
||||
/// </summary>
|
||||
|
@ -118,6 +117,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// </summary>
|
||||
string StatusDescription { get; set; }
|
||||
|
||||
double RequestTS { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Add a header field and content to the response.
|
||||
/// </summary>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
@ -88,4 +89,20 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
Hashtable Handle(string path, Hashtable request);
|
||||
}
|
||||
|
||||
public interface ISimpleStreamHandler
|
||||
{
|
||||
string Name { get; }
|
||||
string Path { get; }
|
||||
|
||||
int RequestsReceived { get; }
|
||||
int RequestsHandled { get; }
|
||||
|
||||
// Handle request stream, return byte array
|
||||
void Handle(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
}
|
||||
|
||||
public delegate void SimpleStreamMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
public delegate void SimpleOSDMapMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap args);
|
||||
public delegate void SimpleBinaryMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, byte[] data);
|
||||
}
|
|
@ -1,183 +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.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
/// <sumary>
|
||||
/// Any OSHttpHandler must return one of the following results:
|
||||
/// <list type = "table">
|
||||
/// <listheader>
|
||||
/// <term>result code</term>
|
||||
/// <description>meaning</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>Pass</term>
|
||||
/// <description>handler did not process the request</request>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>Done</term>
|
||||
/// <description>handler did process the request, OSHttpServer
|
||||
/// can clean up and close the request</request>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
public enum OSHttpHandlerResult
|
||||
{
|
||||
Unprocessed,
|
||||
Pass,
|
||||
Done,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An OSHttpHandler that matches on the "content-type" header can
|
||||
/// supply an OSHttpContentTypeChecker delegate which will be
|
||||
/// invoked by the request matcher in OSHttpRequestPump.
|
||||
/// </summary>
|
||||
/// <returns>true if the handler is interested in the content;
|
||||
/// false otherwise</returns>
|
||||
public delegate bool OSHttpContentTypeChecker(OSHttpRequest req);
|
||||
|
||||
public abstract class OSHttpHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Regular expression used to match against method of
|
||||
/// the incoming HTTP request. If you want to match any string
|
||||
/// either use '.*' or null. To match on the empty string use
|
||||
/// '^$'.
|
||||
/// </summary>
|
||||
public virtual Regex Method
|
||||
{
|
||||
get { return _method; }
|
||||
}
|
||||
protected Regex _method;
|
||||
|
||||
/// <summary>
|
||||
/// Regular expression used to match against path of the
|
||||
/// incoming HTTP request. If you want to match any string
|
||||
/// either use '.*' or null. To match on the empty string use
|
||||
/// '^$'.
|
||||
/// </summary>
|
||||
public virtual Regex Path
|
||||
{
|
||||
get { return _path; }
|
||||
}
|
||||
protected Regex _path;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of (query name, regular expression) tuples,
|
||||
/// allowing us to match on URI query fields.
|
||||
/// </summary>
|
||||
public virtual Dictionary<string, Regex> Query
|
||||
{
|
||||
get { return _query; }
|
||||
}
|
||||
protected Dictionary<string, Regex> _query;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of (header name, regular expression) tuples,
|
||||
/// allowing us to match on HTTP header fields.
|
||||
/// </summary>
|
||||
public virtual Dictionary<string, Regex> Headers
|
||||
{
|
||||
get { return _headers; }
|
||||
}
|
||||
protected Dictionary<string, Regex> _headers;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of (header name, regular expression) tuples,
|
||||
/// allowing us to match on HTTP header fields.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This feature is currently not implemented as it requires
|
||||
/// (trivial) changes to HttpServer.HttpListener that have not
|
||||
/// been implemented.
|
||||
/// </remarks>
|
||||
public virtual Regex IPEndPointWhitelist
|
||||
{
|
||||
get { return _ipEndPointRegex; }
|
||||
}
|
||||
protected Regex _ipEndPointRegex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Base class constructor.
|
||||
/// </summary>
|
||||
/// <param name="path">null or path regex</param>
|
||||
/// <param name="headers">null or dictionary of header
|
||||
/// regexs</param>
|
||||
/// <param name="contentType">null or content type
|
||||
/// regex</param>
|
||||
/// <param name="whitelist">null or IP address regex</param>
|
||||
public OSHttpHandler(Regex method, Regex path, Dictionary<string, Regex> query,
|
||||
Dictionary<string, Regex> headers, Regex contentType, Regex whitelist)
|
||||
{
|
||||
_method = method;
|
||||
_path = path;
|
||||
_query = query;
|
||||
_ipEndPointRegex = whitelist;
|
||||
|
||||
if (null == _headers && null != contentType)
|
||||
{
|
||||
_headers = new Dictionary<string, Regex>();
|
||||
_headers.Add("content-type", contentType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Process an incoming OSHttpRequest that matched our
|
||||
/// requirements.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// OSHttpHandlerResult.Pass if we are after all not
|
||||
/// interested in the request; OSHttpHandlerResult.Done if we
|
||||
/// did process the request.
|
||||
/// </returns>
|
||||
public abstract OSHttpHandlerResult Process(OSHttpRequest request);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
sw.WriteLine("{0}", base.ToString());
|
||||
sw.WriteLine(" method regex {0}", null == Method ? "null" : Method.ToString());
|
||||
sw.WriteLine(" path regex {0}", null == Path ? "null": Path.ToString());
|
||||
foreach (string tag in Headers.Keys)
|
||||
{
|
||||
sw.WriteLine(" header {0} : {1}", tag, Headers[tag].ToString());
|
||||
}
|
||||
sw.WriteLine(" IP whitelist {0}", null == IPEndPointWhitelist ? "null" : IPEndPointWhitelist.ToString());
|
||||
sw.WriteLine();
|
||||
sw.Close();
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,145 +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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate XmlRpcResponse OSHttpHttpProcessor(XmlRpcRequest request);
|
||||
|
||||
public class OSHttpHttpHandler: OSHttpHandler
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// contains handler for processing HTTP Request
|
||||
private GenericHTTPMethod _handler;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate an HTTP handler.
|
||||
/// </summary>
|
||||
/// <param name="handler">a GenericHTTPMethod</param>
|
||||
/// <param name="method">null or HTTP method regex</param>
|
||||
/// <param name="path">null or path regex</param>
|
||||
/// <param name="query">null or dictionary with query regexs</param>
|
||||
/// <param name="headers">null or dictionary with header
|
||||
/// regexs</param>
|
||||
/// <param name="whitelist">null or IP address whitelist</param>
|
||||
public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path,
|
||||
Dictionary<string, Regex> query,
|
||||
Dictionary<string, Regex> headers, Regex whitelist)
|
||||
: base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
whitelist)
|
||||
{
|
||||
_handler = handler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate an HTTP handler.
|
||||
/// </summary>
|
||||
/// <param name="handler">a GenericHTTPMethod</param>
|
||||
public OSHttpHttpHandler(GenericHTTPMethod handler)
|
||||
: this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked by OSHttpRequestPump.
|
||||
/// </summary>
|
||||
public override OSHttpHandlerResult Process(OSHttpRequest request)
|
||||
{
|
||||
// call handler method
|
||||
Hashtable responseData = _handler(request.Query);
|
||||
|
||||
int responseCode = (int)responseData["int_response_code"];
|
||||
string responseString = (string)responseData["str_response_string"];
|
||||
string contentType = (string)responseData["content_type"];
|
||||
|
||||
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
|
||||
//and should check for NullReferenceExceptions
|
||||
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
{
|
||||
contentType = "text/html";
|
||||
}
|
||||
|
||||
OSHttpResponse response = new OSHttpResponse(request);
|
||||
|
||||
// We're forgoing the usual error status codes here because the client
|
||||
// ignores anything but 200 and 301
|
||||
|
||||
response.StatusCode = (int)OSHttpStatusCode.SuccessOk;
|
||||
|
||||
if (responseCode == (int)OSHttpStatusCode.RedirectMovedPermanently)
|
||||
{
|
||||
response.RedirectLocation = (string)responseData["str_redirect_location"];
|
||||
response.StatusCode = responseCode;
|
||||
}
|
||||
|
||||
response.AddHeader("Content-type", contentType);
|
||||
|
||||
byte[] buffer;
|
||||
|
||||
if (!contentType.Contains("image"))
|
||||
{
|
||||
buffer = Encoding.UTF8.GetBytes(responseString);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = Convert.FromBase64String(responseString);
|
||||
}
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.Body.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("[OSHttpHttpHandler]: Error: {0}", ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
response.Send();
|
||||
}
|
||||
|
||||
return OSHttpHandlerResult.Done;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ using System.Net;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using HttpServer;
|
||||
using OSHttpServer;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
@ -43,23 +43,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected IHttpRequest _request = null;
|
||||
protected IHttpClientContext _context = null;
|
||||
protected IHttpRequest m_request = null;
|
||||
protected IHttpClientContext m_context = null;
|
||||
|
||||
public string[] AcceptTypes
|
||||
{
|
||||
get { return _request.AcceptTypes; }
|
||||
get { return m_request.AcceptTypes; }
|
||||
}
|
||||
|
||||
public Encoding ContentEncoding
|
||||
{
|
||||
get { return _contentEncoding; }
|
||||
get { return m_contentEncoding; }
|
||||
}
|
||||
private Encoding _contentEncoding;
|
||||
private Encoding m_contentEncoding;
|
||||
|
||||
public long ContentLength
|
||||
{
|
||||
get { return _request.ContentLength; }
|
||||
get { return m_request.ContentLength; }
|
||||
}
|
||||
|
||||
public long ContentLength64
|
||||
|
@ -69,99 +69,142 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public string ContentType
|
||||
{
|
||||
get { return _contentType; }
|
||||
get { return m_contentType; }
|
||||
}
|
||||
private string _contentType;
|
||||
private string m_contentType;
|
||||
|
||||
public HttpCookieCollection Cookies
|
||||
{
|
||||
get
|
||||
{
|
||||
RequestCookies cookies = _request.Cookies;
|
||||
RequestCookies cookies = m_request.Cookies;
|
||||
HttpCookieCollection httpCookies = new HttpCookieCollection();
|
||||
if(cookies != null)
|
||||
{
|
||||
foreach (RequestCookie cookie in cookies)
|
||||
httpCookies.Add(new HttpCookie(cookie.Name, cookie.Value));
|
||||
}
|
||||
return httpCookies;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasEntityBody
|
||||
{
|
||||
get { return _request.ContentLength != 0; }
|
||||
get { return m_request.ContentLength != 0; }
|
||||
}
|
||||
|
||||
public NameValueCollection Headers
|
||||
{
|
||||
get { return _request.Headers; }
|
||||
get { return m_request.Headers; }
|
||||
}
|
||||
|
||||
public string HttpMethod
|
||||
{
|
||||
get { return _request.Method; }
|
||||
get { return m_request.Method; }
|
||||
}
|
||||
|
||||
public Stream InputStream
|
||||
{
|
||||
get { return _request.Body; }
|
||||
get { return m_request.Body; }
|
||||
}
|
||||
|
||||
public bool IsSecured
|
||||
{
|
||||
get { return _context.IsSecured; }
|
||||
get { return m_context.IsSecured; }
|
||||
}
|
||||
|
||||
public bool KeepAlive
|
||||
{
|
||||
get { return ConnectionType.KeepAlive == _request.Connection; }
|
||||
get { return ConnectionType.KeepAlive == m_request.Connection; }
|
||||
}
|
||||
|
||||
public NameValueCollection QueryString
|
||||
{
|
||||
get { return _queryString; }
|
||||
get { return m_request.QueryString;}
|
||||
}
|
||||
private NameValueCollection _queryString;
|
||||
|
||||
private Hashtable m_queryAsHashtable = null;
|
||||
public Hashtable Query
|
||||
{
|
||||
get { return _query; }
|
||||
get
|
||||
{
|
||||
if (m_queryAsHashtable == null)
|
||||
BuildQueryHashtable();
|
||||
return m_queryAsHashtable;
|
||||
}
|
||||
}
|
||||
private Hashtable _query;
|
||||
|
||||
//faster than Query
|
||||
private Dictionary<string, string> _queryAsDictionay = null;
|
||||
public Dictionary<string,string> QueryAsDictionary
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_queryAsDictionay == null)
|
||||
BuildQueryDictionary();
|
||||
return _queryAsDictionay;
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<string> m_queryFlags = null;
|
||||
public HashSet<string> QueryFlags
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_queryFlags == null)
|
||||
BuildQueryDictionary();
|
||||
return m_queryFlags;
|
||||
}
|
||||
}
|
||||
/// <value>
|
||||
/// POST request values, if applicable
|
||||
/// </value>
|
||||
// public Hashtable Form { get; private set; }
|
||||
// public Hashtable Form { get; private set; }
|
||||
|
||||
public string RawUrl
|
||||
{
|
||||
get { return _request.Uri.AbsolutePath; }
|
||||
get { return m_request.Uri.AbsolutePath; }
|
||||
}
|
||||
|
||||
public IPEndPoint RemoteIPEndPoint
|
||||
{
|
||||
get { return _remoteIPEndPoint; }
|
||||
get { return m_request.RemoteIPEndPoint; }
|
||||
}
|
||||
|
||||
public IPEndPoint LocalIPEndPoint
|
||||
{
|
||||
get { return m_request.LocalIPEndPoint; }
|
||||
}
|
||||
private IPEndPoint _remoteIPEndPoint;
|
||||
|
||||
public Uri Url
|
||||
{
|
||||
get { return _request.Uri; }
|
||||
get { return m_request.Uri; }
|
||||
}
|
||||
|
||||
public string UriPath
|
||||
{
|
||||
get { return m_request.UriPath; }
|
||||
}
|
||||
|
||||
public string UserAgent
|
||||
{
|
||||
get { return _userAgent; }
|
||||
get { return m_userAgent; }
|
||||
}
|
||||
private string m_userAgent;
|
||||
|
||||
public double ArrivalTS
|
||||
{
|
||||
get { return m_request.ArrivalTS;}
|
||||
}
|
||||
private string _userAgent;
|
||||
|
||||
internal IHttpRequest IHttpRequest
|
||||
{
|
||||
get { return _request; }
|
||||
get { return m_request; }
|
||||
}
|
||||
|
||||
internal IHttpClientContext IHttpClientContext
|
||||
{
|
||||
get { return _context; }
|
||||
get { return m_context; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -176,73 +219,27 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public OSHttpRequest() {}
|
||||
|
||||
public OSHttpRequest(IHttpClientContext context, IHttpRequest req)
|
||||
public OSHttpRequest(IHttpRequest req)
|
||||
{
|
||||
_request = req;
|
||||
_context = context;
|
||||
m_request = req;
|
||||
m_context = req.Context;
|
||||
|
||||
if (null != req.Headers["content-encoding"])
|
||||
{
|
||||
try
|
||||
{
|
||||
_contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]);
|
||||
m_contentEncoding = Encoding.GetEncoding(m_request.Headers["content-encoding"]);
|
||||
}
|
||||
catch (Exception)
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
if (null != req.Headers["content-type"])
|
||||
_contentType = _request.Headers["content-type"];
|
||||
m_contentType = m_request.Headers["content-type"];
|
||||
if (null != req.Headers["user-agent"])
|
||||
_userAgent = req.Headers["user-agent"];
|
||||
|
||||
if (null != req.Headers["remote_addr"])
|
||||
{
|
||||
try
|
||||
{
|
||||
IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]);
|
||||
// sometimes req.Headers["remote_port"] returns a comma separated list, so use
|
||||
// the first one in the list and log it
|
||||
string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' });
|
||||
if (strPorts.Length > 1)
|
||||
{
|
||||
_log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring",
|
||||
req.Headers["remote_addr"], req.Headers["remote_port"]);
|
||||
}
|
||||
int port = Int32.Parse(strPorts[0]);
|
||||
_remoteIPEndPoint = new IPEndPoint(addr, port);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
_log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring",
|
||||
req.Headers["remote_addr"], req.Headers["remote_port"]);
|
||||
}
|
||||
}
|
||||
|
||||
_queryString = new NameValueCollection();
|
||||
_query = new Hashtable();
|
||||
try
|
||||
{
|
||||
foreach (HttpInputItem item in req.QueryString)
|
||||
{
|
||||
try
|
||||
{
|
||||
_queryString.Add(item.Name, item.Value);
|
||||
_query[item.Name] = item.Value;
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
_log.DebugFormat("[OSHttpRequest]: error parsing {0} query item, skipping it", item.Name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_log.ErrorFormat("[OSHttpRequest]: Error parsing querystring");
|
||||
}
|
||||
m_userAgent = req.Headers["user-agent"];
|
||||
|
||||
// Form = new Hashtable();
|
||||
// foreach (HttpInputItem item in req.Form)
|
||||
|
@ -252,6 +249,44 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
// }
|
||||
}
|
||||
|
||||
private void BuildQueryDictionary()
|
||||
{
|
||||
NameValueCollection q = m_request.QueryString;
|
||||
_queryAsDictionay = new Dictionary<string, string>();
|
||||
m_queryFlags = new HashSet<string>();
|
||||
for(int i = 0; i <q.Count; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
var name = q.GetKey(i);
|
||||
if(!string.IsNullOrEmpty(name))
|
||||
_queryAsDictionay[name] = q[i];
|
||||
else
|
||||
m_queryFlags.Add(q[i]);
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildQueryHashtable()
|
||||
{
|
||||
NameValueCollection q = m_request.QueryString;
|
||||
m_queryAsHashtable = new Hashtable();
|
||||
m_queryFlags = new HashSet<string>();
|
||||
for (int i = 0; i < q.Count; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
var name = q.GetKey(i);
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
m_queryAsHashtable[name] = q[i];
|
||||
else
|
||||
m_queryFlags.Add(q[i]);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder me = new StringBuilder();
|
||||
|
|
|
@ -1,298 +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.
|
||||
*/
|
||||
|
||||
// #define DEBUGGING
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using HttpServer;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// An OSHttpRequestPump fetches incoming OSHttpRequest objects
|
||||
/// from the OSHttpRequestQueue and feeds them to all subscribed
|
||||
/// parties. Each OSHttpRequestPump encapsulates one thread to do
|
||||
/// the work and there is a fixed number of pumps for each
|
||||
/// OSHttpServer object.
|
||||
/// </summary>
|
||||
public class OSHttpRequestPump
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected OSHttpServer _server;
|
||||
protected OSHttpRequestQueue _queue;
|
||||
protected Thread _engine;
|
||||
|
||||
private int _id;
|
||||
|
||||
public string EngineID
|
||||
{
|
||||
get { return String.Format("{0} pump {1}", _server.EngineID, _id); }
|
||||
}
|
||||
|
||||
public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id)
|
||||
{
|
||||
_server = server;
|
||||
_queue = queue;
|
||||
_id = id;
|
||||
|
||||
_engine = new Thread(new ThreadStart(Engine));
|
||||
_engine.IsBackground = true;
|
||||
_engine.Start();
|
||||
_engine.Name = string.Format ("Engine:{0}",EngineID);
|
||||
|
||||
ThreadTracker.Add(_engine);
|
||||
}
|
||||
|
||||
public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize)
|
||||
{
|
||||
OSHttpRequestPump[] pumps = new OSHttpRequestPump[poolSize];
|
||||
for (int i = 0; i < pumps.Length; i++)
|
||||
{
|
||||
pumps[i] = new OSHttpRequestPump(server, queue, i);
|
||||
}
|
||||
|
||||
return pumps;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_engine = new Thread(new ThreadStart(Engine));
|
||||
_engine.IsBackground = true;
|
||||
_engine.Start();
|
||||
_engine.Name = string.Format ("Engine:{0}",EngineID);
|
||||
|
||||
ThreadTracker.Add(_engine);
|
||||
}
|
||||
|
||||
public void Engine()
|
||||
{
|
||||
OSHttpRequest req = null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
// dequeue an OSHttpRequest from OSHttpServer's
|
||||
// request queue
|
||||
req = _queue.Dequeue();
|
||||
|
||||
// get a copy of the list of registered handlers
|
||||
List<OSHttpHandler> handlers = _server.OSHttpHandlers;
|
||||
|
||||
// prune list and have it sorted from most
|
||||
// specific to least specific
|
||||
handlers = MatchHandlers(req, handlers);
|
||||
|
||||
// process req: we try each handler in turn until
|
||||
// we are either out of handlers or get back a
|
||||
// Pass or Done
|
||||
OSHttpHandlerResult rc = OSHttpHandlerResult.Unprocessed;
|
||||
foreach (OSHttpHandler h in handlers)
|
||||
{
|
||||
rc = h.Process(req);
|
||||
|
||||
// Pass: handler did not process the request,
|
||||
// try next handler
|
||||
if (OSHttpHandlerResult.Pass == rc) continue;
|
||||
|
||||
// Handled: handler has processed the request
|
||||
if (OSHttpHandlerResult.Done == rc) break;
|
||||
|
||||
// hmm, something went wrong
|
||||
throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc));
|
||||
}
|
||||
|
||||
if (OSHttpHandlerResult.Unprocessed == rc)
|
||||
{
|
||||
_log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req);
|
||||
|
||||
// set up response header
|
||||
OSHttpResponse resp = new OSHttpResponse(req);
|
||||
resp.StatusCode = (int)OSHttpStatusCode.ClientErrorNotFound;
|
||||
resp.StatusDescription = String.Format("no handler on call for {0}", req);
|
||||
resp.ContentType = "text/html";
|
||||
|
||||
// add explanatory message
|
||||
StreamWriter body = new StreamWriter(resp.Body);
|
||||
body.WriteLine("<html>");
|
||||
body.WriteLine("<header><title>Ooops...</title><header>");
|
||||
body.WriteLine(String.Format("<body><p>{0}</p></body>", resp.StatusDescription));
|
||||
body.WriteLine("</html>");
|
||||
body.Flush();
|
||||
|
||||
// and ship it back
|
||||
resp.Send();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString());
|
||||
_log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<OSHttpHandler> MatchHandlers(OSHttpRequest req, List<OSHttpHandler> handlers)
|
||||
{
|
||||
Dictionary<OSHttpHandler, int> scoredHandlers = new Dictionary<OSHttpHandler, int>();
|
||||
|
||||
_log.DebugFormat("[{0}] MatchHandlers for {1}", EngineID, req);
|
||||
foreach (OSHttpHandler h in handlers)
|
||||
{
|
||||
// initial anchor
|
||||
scoredHandlers[h] = 0;
|
||||
|
||||
// first, check whether IPEndPointWhitelist applies
|
||||
// and, if it does, whether client is on that white
|
||||
// list.
|
||||
if (null != h.IPEndPointWhitelist)
|
||||
{
|
||||
// TODO: following code requires code changes to
|
||||
// HttpServer.HttpRequest to become functional
|
||||
|
||||
IPEndPoint remote = req.RemoteIPEndPoint;
|
||||
if (null != remote)
|
||||
{
|
||||
Match epm = h.IPEndPointWhitelist.Match(remote.ToString());
|
||||
if (!epm.Success)
|
||||
{
|
||||
scoredHandlers.Remove(h);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null != h.Method)
|
||||
{
|
||||
Match m = h.Method.Match(req.HttpMethod);
|
||||
if (!m.Success)
|
||||
{
|
||||
scoredHandlers.Remove(h);
|
||||
continue;
|
||||
}
|
||||
scoredHandlers[h]++;
|
||||
}
|
||||
|
||||
// whitelist ok, now check path
|
||||
if (null != h.Path)
|
||||
{
|
||||
Match m = h.Path.Match(req.RawUrl);
|
||||
if (!m.Success)
|
||||
{
|
||||
scoredHandlers.Remove(h);
|
||||
continue;
|
||||
}
|
||||
scoredHandlers[h] += m.ToString().Length;
|
||||
}
|
||||
|
||||
// whitelist & path ok, now check query string
|
||||
if (null != h.Query)
|
||||
{
|
||||
int queriesMatch = MatchOnNameValueCollection(req.QueryString, h.Query);
|
||||
if (0 == queriesMatch)
|
||||
{
|
||||
_log.DebugFormat("[{0}] request {1}", EngineID, req);
|
||||
_log.DebugFormat("[{0}] dropping handler {1}", EngineID, h);
|
||||
|
||||
scoredHandlers.Remove(h);
|
||||
continue;
|
||||
}
|
||||
scoredHandlers[h] += queriesMatch;
|
||||
}
|
||||
|
||||
// whitelist, path, query string ok, now check headers
|
||||
if (null != h.Headers)
|
||||
{
|
||||
int headersMatch = MatchOnNameValueCollection(req.Headers, h.Headers);
|
||||
if (0 == headersMatch)
|
||||
{
|
||||
_log.DebugFormat("[{0}] request {1}", EngineID, req);
|
||||
_log.DebugFormat("[{0}] dropping handler {1}", EngineID, h);
|
||||
|
||||
scoredHandlers.Remove(h);
|
||||
continue;
|
||||
}
|
||||
scoredHandlers[h] += headersMatch;
|
||||
}
|
||||
}
|
||||
|
||||
List<OSHttpHandler> matchingHandlers = new List<OSHttpHandler>(scoredHandlers.Keys);
|
||||
matchingHandlers.Sort(delegate(OSHttpHandler x, OSHttpHandler y)
|
||||
{
|
||||
return scoredHandlers[x] - scoredHandlers[y];
|
||||
});
|
||||
LogDumpHandlerList(matchingHandlers);
|
||||
return matchingHandlers;
|
||||
}
|
||||
|
||||
protected int MatchOnNameValueCollection(NameValueCollection collection, Dictionary<string, Regex> regexs)
|
||||
{
|
||||
int matched = 0;
|
||||
|
||||
foreach (string tag in regexs.Keys)
|
||||
{
|
||||
// do we have a header "tag"?
|
||||
if (null == collection[tag])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// does the content of collection[tag] match
|
||||
// the supplied regex?
|
||||
Match cm = regexs[tag].Match(collection[tag]);
|
||||
if (!cm.Success)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ok: matches
|
||||
matched++;
|
||||
continue;
|
||||
}
|
||||
|
||||
return matched;
|
||||
}
|
||||
|
||||
[ConditionalAttribute("DEBUGGING")]
|
||||
private void LogDumpHandlerList(List<OSHttpHandler> l)
|
||||
{
|
||||
_log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID);
|
||||
foreach (OSHttpHandler h in l)
|
||||
_log.DebugFormat(" ", h.ToString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@
|
|||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using HttpServer;
|
||||
using OSHttpServer;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
@ -231,19 +231,18 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a redirct location.
|
||||
/// </summary>
|
||||
public string RedirectLocation
|
||||
public int Priority
|
||||
{
|
||||
// get { return _redirectLocation; }
|
||||
get
|
||||
{
|
||||
return _httpResponse.Priority;
|
||||
}
|
||||
set
|
||||
{
|
||||
_httpResponse.Redirect(value);
|
||||
_httpResponse.Priority = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Chunk transfers.
|
||||
/// </summary>
|
||||
|
@ -276,6 +275,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
|
||||
public double RequestTS
|
||||
{
|
||||
get {return _httpResponse.RequestTS; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status description.
|
||||
|
@ -310,8 +313,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// replying</param>
|
||||
public OSHttpResponse(OSHttpRequest req)
|
||||
{
|
||||
_httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest);
|
||||
|
||||
_httpResponse = new HttpResponse(req.IHttpRequest);
|
||||
}
|
||||
|
||||
public OSHttpResponse(HttpResponse resp)
|
||||
|
|
|
@ -1,210 +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.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using log4net;
|
||||
using HttpServer;
|
||||
|
||||
using HttpListener = HttpServer.HttpListener;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// OSHttpServer provides an HTTP server bound to a specific
|
||||
/// port. When instantiated with just address and port it uses
|
||||
/// normal HTTP, when instantiated with address, port, and X509
|
||||
/// certificate, it uses HTTPS.
|
||||
/// </summary>
|
||||
public class OSHttpServer
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private object _syncObject = new object();
|
||||
|
||||
// underlying HttpServer.HttpListener
|
||||
protected HttpListener _listener;
|
||||
// underlying core/engine thread
|
||||
protected Thread _engine;
|
||||
|
||||
// Queue containing (OS)HttpRequests
|
||||
protected OSHttpRequestQueue _queue;
|
||||
|
||||
// OSHttpRequestPumps "pumping" incoming OSHttpRequests
|
||||
// upwards
|
||||
protected OSHttpRequestPump[] _pumps;
|
||||
|
||||
// thread identifier
|
||||
protected string _engineId;
|
||||
public string EngineID
|
||||
{
|
||||
get { return _engineId; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if this is an HTTPS connection; false otherwise.
|
||||
/// </summary>
|
||||
protected bool _isSecure;
|
||||
public bool IsSecure
|
||||
{
|
||||
get { return _isSecure; }
|
||||
}
|
||||
|
||||
public int QueueSize
|
||||
{
|
||||
get { return _pumps.Length; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of registered OSHttpHandlers for this OSHttpServer instance.
|
||||
/// </summary>
|
||||
protected List<OSHttpHandler> _httpHandlers = new List<OSHttpHandler>();
|
||||
public List<OSHttpHandler> OSHttpHandlers
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_httpHandlers)
|
||||
{
|
||||
return new List<OSHttpHandler>(_httpHandlers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate an HTTP server.
|
||||
/// </summary>
|
||||
public OSHttpServer(IPAddress address, int port, int poolSize)
|
||||
{
|
||||
_engineId = String.Format("OSHttpServer (HTTP:{0})", port);
|
||||
_isSecure = false;
|
||||
_log.DebugFormat("[{0}] HTTP server instantiated", EngineID);
|
||||
|
||||
_listener = new HttpListener(address, port);
|
||||
_queue = new OSHttpRequestQueue();
|
||||
_pumps = OSHttpRequestPump.Pumps(this, _queue, poolSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate an HTTPS server.
|
||||
/// </summary>
|
||||
public OSHttpServer(IPAddress address, int port, X509Certificate certificate, int poolSize)
|
||||
{
|
||||
_engineId = String.Format("OSHttpServer [HTTPS:{0}/ps:{1}]", port, poolSize);
|
||||
_isSecure = true;
|
||||
_log.DebugFormat("[{0}] HTTPS server instantiated", EngineID);
|
||||
|
||||
_listener = new HttpListener(address, port, certificate);
|
||||
_queue = new OSHttpRequestQueue();
|
||||
_pumps = OSHttpRequestPump.Pumps(this, _queue, poolSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn an HttpRequest into an OSHttpRequestItem and place it
|
||||
/// in the queue. The OSHttpRequestQueue object will pulse the
|
||||
/// next available idle pump.
|
||||
/// </summary>
|
||||
protected void OnHttpRequest(HttpClientContext client, HttpRequest request)
|
||||
{
|
||||
// turn request into OSHttpRequest
|
||||
OSHttpRequest req = new OSHttpRequest(client, request);
|
||||
|
||||
// place OSHttpRequest into _httpRequestQueue, will
|
||||
// trigger Pulse to idle waiting pumps
|
||||
_queue.Enqueue(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the HTTP server engine.
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
_engine = new Thread(new ThreadStart(Engine));
|
||||
_engine.IsBackground = true;
|
||||
_engine.Start();
|
||||
_engine.Name = string.Format ("Engine:{0}",_engineId);
|
||||
|
||||
ThreadTracker.Add(_engine);
|
||||
|
||||
// start the pumps...
|
||||
for (int i = 0; i < _pumps.Length; i++)
|
||||
_pumps[i].Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
lock (_syncObject) Monitor.Pulse(_syncObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Engine keeps the HTTP server running.
|
||||
/// </summary>
|
||||
private void Engine()
|
||||
{
|
||||
try {
|
||||
_listener.RequestHandler += OnHttpRequest;
|
||||
_listener.Start(QueueSize);
|
||||
_log.InfoFormat("[{0}] HTTP server started", EngineID);
|
||||
|
||||
lock (_syncObject) Monitor.Wait(_syncObject);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.DebugFormat("[{0}] HTTP server startup failed: {1}", EngineID, ex.ToString());
|
||||
}
|
||||
|
||||
_log.InfoFormat("[{0}] HTTP server terminated", EngineID);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add an HTTP request handler.
|
||||
/// </summary>
|
||||
/// <param name="handler">OSHttpHandler delegate</param>
|
||||
/// <param name="path">regex object for path matching</parm>
|
||||
/// <param name="headers">dictionary containing header names
|
||||
/// and regular expressions to match against header values</param>
|
||||
public void AddHandler(OSHttpHandler handler)
|
||||
{
|
||||
lock (_httpHandlers)
|
||||
{
|
||||
if (_httpHandlers.Contains(handler))
|
||||
{
|
||||
_log.DebugFormat("[OSHttpServer] attempt to add already existing handler ignored");
|
||||
return;
|
||||
}
|
||||
_httpHandlers.Add(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace OSHttpServer.Exceptions
|
||||
{
|
||||
/// <summary>
|
||||
/// The request could not be understood by the server due to malformed syntax.
|
||||
/// The client SHOULD NOT repeat the request without modifications.
|
||||
///
|
||||
/// Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php
|
||||
/// </summary>
|
||||
public class BadRequestException : HttpException
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new bad request exception.
|
||||
/// </summary>
|
||||
/// <param name="errMsg">reason to why the request was bad.</param>
|
||||
public BadRequestException(string errMsg)
|
||||
: base(HttpStatusCode.BadRequest, errMsg)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new bad request exception.
|
||||
/// </summary>
|
||||
/// <param name="errMsg">reason to why the request was bad.</param>
|
||||
/// <param name="inner">inner exception</param>
|
||||
public BadRequestException(string errMsg, Exception inner)
|
||||
: base(HttpStatusCode.BadRequest, errMsg, inner)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
|
||||
namespace OSHttpServer.Parser
|
||||
{
|
||||
/// <summary>
|
||||
/// Arguments used when more body bytes have come.
|
||||
/// </summary>
|
||||
public class BodyEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BodyEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="buffer">buffer that contains the received bytes.</param>
|
||||
/// <param name="offset">offset in buffer where to start processing.</param>
|
||||
/// <param name="count">number of bytes from <paramref name="offset"/> that should be parsed.</param>
|
||||
public BodyEventArgs(byte[] buffer, int offset, int count)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Offset = offset;
|
||||
Count = count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BodyEventArgs"/> class.
|
||||
/// </summary>
|
||||
public BodyEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets buffer that contains the received bytes.
|
||||
/// </summary>
|
||||
public byte[] Buffer { get; set; }
|
||||
/*
|
||||
/// <summary>
|
||||
/// Gets or sets number of bytes used by the request.
|
||||
/// </summary>
|
||||
public int BytesUsed { get; set; }
|
||||
*/
|
||||
/// <summary>
|
||||
/// Gets or sets number of bytes from <see cref="Offset"/> that should be parsed.
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
/*
|
||||
/// <summary>
|
||||
/// Gets or sets whether the body is complete.
|
||||
/// </summary>
|
||||
public bool IsBodyComplete { get; set; }
|
||||
*/
|
||||
/// <summary>
|
||||
/// Gets or sets offset in buffer where to start processing.
|
||||
/// </summary>
|
||||
public int Offset { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace OSHttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when a client have been accepted by the <see cref="OSHttpListener"/>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can be used to revoke incoming connections
|
||||
/// </remarks>
|
||||
public class ClientAcceptedEventArgs : EventArgs
|
||||
{
|
||||
private readonly Socket _socket;
|
||||
private bool _revoke;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ClientAcceptedEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="socket">The socket.</param>
|
||||
public ClientAcceptedEventArgs(Socket socket)
|
||||
{
|
||||
_socket = socket;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accepted socket.
|
||||
/// </summary>
|
||||
public Socket Socket
|
||||
{
|
||||
get { return _socket; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client should be revoked.
|
||||
/// </summary>
|
||||
public bool Revoked
|
||||
{
|
||||
get { return _revoke; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client may not be handled.
|
||||
/// </summary>
|
||||
public void Revoke()
|
||||
{
|
||||
_revoke = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,414 @@
|
|||
/*
|
||||
* 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.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSHttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Timeout Manager. Checks for dead clients. Clients with open connections that are not doing anything. Closes sessions opened with keepalive.
|
||||
/// </summary>
|
||||
public static class ContextTimeoutManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Use a Thread or a Timer to monitor the ugly
|
||||
/// </summary>
|
||||
private static Thread m_internalThread = null;
|
||||
private static object m_threadLock = new object();
|
||||
private static ConcurrentQueue<HttpClientContext> m_contexts = new ConcurrentQueue<HttpClientContext>();
|
||||
private static ConcurrentQueue<HttpClientContext> m_highPrio = new ConcurrentQueue<HttpClientContext>();
|
||||
private static ConcurrentQueue<HttpClientContext> m_midPrio = new ConcurrentQueue<HttpClientContext>();
|
||||
private static ConcurrentQueue<HttpClientContext> m_lowPrio = new ConcurrentQueue<HttpClientContext>();
|
||||
private static AutoResetEvent m_processWaitEven = new AutoResetEvent(false);
|
||||
private static bool m_shuttingDown;
|
||||
|
||||
private static int m_ActiveSendingCount;
|
||||
private static double m_lastTimeOutCheckTime = 0;
|
||||
private static double m_lastSendCheckTime = 0;
|
||||
|
||||
const int m_maxBandWidth = 10485760; //80Mbps
|
||||
const int m_maxConcurrenSend = 32;
|
||||
|
||||
static ContextTimeoutManager()
|
||||
{
|
||||
TimeStampClockPeriod = 1.0 / (double)Stopwatch.Frequency;
|
||||
TimeStampClockPeriodMS = 1e3 / (double)Stopwatch.Frequency;
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
lock (m_threadLock)
|
||||
{
|
||||
if (m_internalThread != null)
|
||||
return;
|
||||
|
||||
m_lastTimeOutCheckTime = GetTimeStampMS();
|
||||
m_internalThread = new Thread(ThreadRunProcess);
|
||||
m_internalThread.Priority = ThreadPriority.Normal;
|
||||
m_internalThread.IsBackground = true;
|
||||
m_internalThread.CurrentCulture = new CultureInfo("en-US", false);
|
||||
m_internalThread.Name = "HttpServerMain";
|
||||
m_internalThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
m_shuttingDown = true;
|
||||
m_internalThread.Join();
|
||||
ProcessShutDown();
|
||||
}
|
||||
|
||||
private static void ThreadRunProcess()
|
||||
{
|
||||
while (!m_shuttingDown)
|
||||
{
|
||||
m_processWaitEven.WaitOne(500);
|
||||
|
||||
if(m_shuttingDown)
|
||||
return;
|
||||
|
||||
double now = GetTimeStamp();
|
||||
if(m_contexts.Count > 0)
|
||||
{
|
||||
ProcessSendQueues(now);
|
||||
|
||||
if (now - m_lastTimeOutCheckTime > 1.0)
|
||||
{
|
||||
ProcessContextTimeouts();
|
||||
m_lastTimeOutCheckTime = now;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_lastTimeOutCheckTime = now;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ProcessShutDown()
|
||||
{
|
||||
try
|
||||
{
|
||||
SocketError disconnectError = SocketError.HostDown;
|
||||
for (int i = 0; i < m_contexts.Count; i++)
|
||||
{
|
||||
if (m_contexts.TryDequeue(out HttpClientContext context))
|
||||
{
|
||||
try
|
||||
{
|
||||
context.Disconnect(disconnectError);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
m_processWaitEven.Dispose();
|
||||
m_processWaitEven = null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We can't let this crash.
|
||||
}
|
||||
}
|
||||
|
||||
public static void ProcessSendQueues(double now)
|
||||
{
|
||||
int inqueues = m_highPrio.Count + m_midPrio.Count + m_lowPrio.Count;
|
||||
if(inqueues == 0)
|
||||
return;
|
||||
|
||||
double dt = now - m_lastSendCheckTime;
|
||||
m_lastSendCheckTime = now;
|
||||
|
||||
int totalSending = m_ActiveSendingCount;
|
||||
|
||||
int curConcurrentLimit = m_maxConcurrenSend - totalSending;
|
||||
if(curConcurrentLimit <= 0)
|
||||
return;
|
||||
|
||||
if(curConcurrentLimit > inqueues)
|
||||
curConcurrentLimit = inqueues;
|
||||
|
||||
if (dt > 0.5)
|
||||
dt = 0.5;
|
||||
|
||||
dt /= curConcurrentLimit;
|
||||
int curbytesLimit = (int)(m_maxBandWidth * dt);
|
||||
if(curbytesLimit < 8192)
|
||||
curbytesLimit = 8192;
|
||||
|
||||
HttpClientContext ctx;
|
||||
int sent;
|
||||
while (curConcurrentLimit > 0)
|
||||
{
|
||||
sent = 0;
|
||||
while (m_highPrio.TryDequeue(out ctx))
|
||||
{
|
||||
if(TrySend(ctx, curbytesLimit))
|
||||
m_highPrio.Enqueue(ctx);
|
||||
|
||||
if (m_shuttingDown)
|
||||
return;
|
||||
--curConcurrentLimit;
|
||||
if (++sent == 4)
|
||||
break;
|
||||
}
|
||||
|
||||
sent = 0;
|
||||
while(m_midPrio.TryDequeue(out ctx))
|
||||
{
|
||||
if(TrySend(ctx, curbytesLimit))
|
||||
m_midPrio.Enqueue(ctx);
|
||||
|
||||
if (m_shuttingDown)
|
||||
return;
|
||||
--curConcurrentLimit;
|
||||
if (++sent >= 2)
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_lowPrio.TryDequeue(out ctx))
|
||||
{
|
||||
--curConcurrentLimit;
|
||||
if(TrySend(ctx, curbytesLimit))
|
||||
m_lowPrio.Enqueue(ctx);
|
||||
}
|
||||
|
||||
if (m_shuttingDown)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TrySend(HttpClientContext ctx, int bytesLimit)
|
||||
{
|
||||
if(!ctx.CanSend())
|
||||
return false;
|
||||
|
||||
return ctx.TrySendResponse(bytesLimit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Causes the watcher to immediately check the connections.
|
||||
/// </summary>
|
||||
public static void ProcessContextTimeouts()
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < m_contexts.Count; i++)
|
||||
{
|
||||
if (m_shuttingDown)
|
||||
return;
|
||||
if (m_contexts.TryDequeue(out HttpClientContext context))
|
||||
{
|
||||
if (!ContextTimedOut(context, out SocketError disconnectError))
|
||||
m_contexts.Enqueue(context);
|
||||
else if(disconnectError != SocketError.InProgress)
|
||||
context.Disconnect(disconnectError);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We can't let this crash.
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ContextTimedOut(HttpClientContext context, out SocketError disconnectError)
|
||||
{
|
||||
disconnectError = SocketError.InProgress;
|
||||
|
||||
// First our error conditions
|
||||
if (context.contextID < 0 || context.StopMonitoring || context.StreamPassedOff)
|
||||
return true;
|
||||
|
||||
int nowMS = EnvironmentTickCount();
|
||||
|
||||
// First we check first contact line
|
||||
if (!context.FirstRequestLineReceived)
|
||||
{
|
||||
if (EnvironmentTickCountAdd(context.TimeoutFirstLine, context.LastActivityTimeMS) < nowMS)
|
||||
{
|
||||
disconnectError = SocketError.TimedOut;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// First we check first contact request
|
||||
if (!context.FullRequestReceived)
|
||||
{
|
||||
if (EnvironmentTickCountAdd(context.TimeoutRequestReceived, context.LastActivityTimeMS) < nowMS)
|
||||
{
|
||||
disconnectError = SocketError.TimedOut;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (context.TriggerKeepalive)
|
||||
{
|
||||
context.TriggerKeepalive = false;
|
||||
context.MonitorKeepaliveStartMS = nowMS + 500;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (context.MonitorKeepaliveStartMS != 0)
|
||||
{
|
||||
if (context.IsClosing)
|
||||
{
|
||||
disconnectError = SocketError.Success;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (EnvironmentTickCountAdd(context.TimeoutKeepAlive, context.MonitorKeepaliveStartMS) < nowMS)
|
||||
{
|
||||
disconnectError = SocketError.TimedOut;
|
||||
context.MonitorKeepaliveStartMS = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (EnvironmentTickCountAdd(context.TimeoutMaxIdle, context.LastActivityTimeMS) < nowMS)
|
||||
{
|
||||
disconnectError = SocketError.TimedOut;
|
||||
context.MonitorKeepaliveStartMS = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void StartMonitoringContext(HttpClientContext context)
|
||||
{
|
||||
context.LastActivityTimeMS = EnvironmentTickCount();
|
||||
m_contexts.Enqueue(context);
|
||||
}
|
||||
|
||||
public static void EnqueueSend(HttpClientContext context, int priority, bool notThrottled = true)
|
||||
{
|
||||
switch(priority)
|
||||
{
|
||||
case 0:
|
||||
m_highPrio.Enqueue(context);
|
||||
break;
|
||||
case 1:
|
||||
m_midPrio.Enqueue(context);
|
||||
break;
|
||||
case 2:
|
||||
m_lowPrio.Enqueue(context);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if(notThrottled)
|
||||
m_processWaitEven.Set();
|
||||
}
|
||||
|
||||
public static void ContextEnterActiveSend()
|
||||
{
|
||||
Interlocked.Increment(ref m_ActiveSendingCount);
|
||||
}
|
||||
|
||||
public static void ContextLeaveActiveSend()
|
||||
{
|
||||
Interlocked.Decrement(ref m_ActiveSendingCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
|
||||
/// for the callers.
|
||||
/// This trims it to a 12 day interval so don't let your frame time get too long.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int EnvironmentTickCount()
|
||||
{
|
||||
return Environment.TickCount & EnvironmentTickCountMask;
|
||||
}
|
||||
const int EnvironmentTickCountMask = 0x3fffffff;
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
|
||||
/// 'EnvironmentTickCount()') and accounts for any wrapping.
|
||||
/// </summary>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="prevValue"></param>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
public static int EnvironmentTickCountSubtract(Int32 newValue, Int32 prevValue)
|
||||
{
|
||||
int diff = newValue - prevValue;
|
||||
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
|
||||
/// 'EnvironmentTickCount()') and accounts for any wrapping.
|
||||
/// </summary>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="prevValue"></param>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
public static int EnvironmentTickCountAdd(Int32 newValue, Int32 prevValue)
|
||||
{
|
||||
int ret = newValue + prevValue;
|
||||
return (ret >= 0) ? ret : (ret + EnvironmentTickCountMask + 1);
|
||||
}
|
||||
|
||||
public static double TimeStampClockPeriodMS;
|
||||
public static double TimeStampClockPeriod;
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
public static double GetTimeStamp()
|
||||
{
|
||||
return Stopwatch.GetTimestamp() * TimeStampClockPeriod;
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
public static double GetTimeStampMS()
|
||||
{
|
||||
return Stopwatch.GetTimestamp() * TimeStampClockPeriodMS;
|
||||
}
|
||||
|
||||
// doing math in ticks is usefull to avoid loss of resolution
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
public static long GetTimeStampTicks()
|
||||
{
|
||||
return Stopwatch.GetTimestamp();
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
public static double TimeStampTicksToMS(long ticks)
|
||||
{
|
||||
return ticks * TimeStampClockPeriodMS;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
|
||||
namespace OSHttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// An unhandled exception have been caught by the system.
|
||||
/// </summary>
|
||||
public class ExceptionEventArgs : EventArgs
|
||||
{
|
||||
private readonly Exception _exception;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ExceptionEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="exception">Caught exception.</param>
|
||||
public ExceptionEventArgs(Exception exception)
|
||||
{
|
||||
_exception = exception;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caught exception
|
||||
/// </summary>
|
||||
public Exception Exception
|
||||
{
|
||||
get { return _exception; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
namespace OSHttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// We dont want to let the server to die due to exceptions thrown in worker threads.
|
||||
/// therefore we use this delegate to give you a change to handle uncaught exceptions.
|
||||
/// </summary>
|
||||
/// <param name="source">Class that the exception was thrown in.</param>
|
||||
/// <param name="exception">Exception</param>
|
||||
/// <remarks>
|
||||
/// Server will throw a InternalServerException in release version if you dont
|
||||
/// handle this delegate.
|
||||
/// </remarks>
|
||||
public delegate void ExceptionHandler(object source, Exception exception);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using System.Net;
|
||||
|
||||
namespace OSHttpServer.Exceptions
|
||||
{
|
||||
/// <summary>
|
||||
/// The server understood the request, but is refusing to fulfill it.
|
||||
/// Authorization will not help and the request SHOULD NOT be repeated.
|
||||
/// If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled,
|
||||
/// it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information
|
||||
/// available to the client, the status code 404 (Not Found) can be used instead.
|
||||
///
|
||||
/// Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php
|
||||
/// </summary>
|
||||
public class ForbiddenException : HttpException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ForbiddenException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="errorMsg">error message</param>
|
||||
public ForbiddenException(string errorMsg)
|
||||
: base(HttpStatusCode.Forbidden, errorMsg)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
|
||||
namespace OSHttpServer.Parser
|
||||
{
|
||||
/// <summary>
|
||||
/// Event arguments used when a new header have been parsed.
|
||||
/// </summary>
|
||||
public class HeaderEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HeaderEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of header.</param>
|
||||
/// <param name="value">Header value.</param>
|
||||
public HeaderEventArgs(string name, string value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HeaderEventArgs"/> class.
|
||||
/// </summary>
|
||||
public HeaderEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets header name.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets header value.
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue