blob: 63f976f107a278680cd54ac519c94c5abf350094 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
using System;
using System.Collections.Generic;
using System.Text;
using OpenGrid.Framework.Data;
using libsecondlife;
namespace OpenGrid.Framework.Data.DB4o
{
class DB4oGridData : IGridData
{
DB4oManager manager;
public void Initialise() {
manager = new DB4oManager("gridserver.yap");
}
public SimProfileData GetProfileByHandle(ulong handle) {
lock (manager.profiles)
{
foreach (LLUUID UUID in manager.profiles.Keys)
{
if (manager.profiles[UUID].regionHandle == handle)
{
return manager.profiles[UUID];
}
}
}
throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")");
}
public SimProfileData GetProfileByLLUUID(LLUUID uuid)
{
lock (manager.profiles)
{
if (manager.profiles.ContainsKey(uuid))
return manager.profiles[uuid];
}
throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")");
}
public DataResponse AddProfile(SimProfileData profile)
{
if (manager.AddRow(profile))
{
return DataResponse.RESPONSE_OK;
}
else
{
return DataResponse.RESPONSE_ERROR;
}
}
public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
if (manager.profiles[uuid].regionRecvKey == key)
return true;
return false;
}
public void Close()
{
manager = null;
}
public string getName()
{
return "DB4o Grid Provider";
}
public string getVersion()
{
return "0.1";
}
}
}
|