diff options
Some more code refactoring, plus a restructuring of the directories so that the Grid servers can be a separate solution to the region server.
Diffstat (limited to 'OpenGrid.Framework.Data.MySQL/MySQLUserData.cs')
-rw-r--r-- | OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs deleted file mode 100644 index 0741272..0000000 --- a/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenGrid.Framework.Data; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenGrid.Framework.Data.MySQL | ||
8 | { | ||
9 | class MySQLUserData : IUserData | ||
10 | { | ||
11 | public MySQLManager database; | ||
12 | |||
13 | public void Initialise() | ||
14 | { | ||
15 | database = new MySQLManager("host", "database", "user", "password", "false"); | ||
16 | } | ||
17 | |||
18 | public UserProfileData getUserByName(string name) | ||
19 | { | ||
20 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
21 | } | ||
22 | |||
23 | public UserProfileData getUserByName(string user, string last) | ||
24 | { | ||
25 | try | ||
26 | { | ||
27 | lock (database) | ||
28 | { | ||
29 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
30 | param["?first"] = user; | ||
31 | param["?second"] = last; | ||
32 | |||
33 | System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); | ||
34 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
35 | |||
36 | UserProfileData row = database.getUserRow(reader); | ||
37 | |||
38 | reader.Close(); | ||
39 | result.Dispose(); | ||
40 | |||
41 | return row; | ||
42 | } | ||
43 | } | ||
44 | catch (Exception e) | ||
45 | { | ||
46 | Console.WriteLine(e.ToString()); | ||
47 | return null; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | public UserProfileData getUserByUUID(LLUUID uuid) | ||
52 | { | ||
53 | try | ||
54 | { | ||
55 | lock (database) | ||
56 | { | ||
57 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
58 | param["?uuid"] = uuid.ToStringHyphenated(); | ||
59 | |||
60 | System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); | ||
61 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
62 | |||
63 | UserProfileData row = database.getUserRow(reader); | ||
64 | |||
65 | reader.Close(); | ||
66 | result.Dispose(); | ||
67 | |||
68 | return row; | ||
69 | } | ||
70 | } | ||
71 | catch (Exception e) | ||
72 | { | ||
73 | Console.WriteLine(e.ToString()); | ||
74 | return null; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | public UserAgentData getAgentByName(string name) | ||
79 | { | ||
80 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
81 | } | ||
82 | |||
83 | public UserAgentData getAgentByName(string user, string last) | ||
84 | { | ||
85 | UserProfileData profile = getUserByName(user, last); | ||
86 | return getAgentByUUID(profile.UUID); | ||
87 | } | ||
88 | |||
89 | public UserAgentData getAgentByUUID(LLUUID uuid) | ||
90 | { | ||
91 | try | ||
92 | { | ||
93 | lock (database) | ||
94 | { | ||
95 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
96 | param["?uuid"] = uuid.ToStringHyphenated(); | ||
97 | |||
98 | System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); | ||
99 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
100 | |||
101 | UserAgentData row = database.getAgentRow(reader); | ||
102 | |||
103 | reader.Close(); | ||
104 | result.Dispose(); | ||
105 | |||
106 | return row; | ||
107 | } | ||
108 | } | ||
109 | catch (Exception e) | ||
110 | { | ||
111 | Console.WriteLine(e.ToString()); | ||
112 | return null; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | ||
117 | { | ||
118 | return false; | ||
119 | } | ||
120 | |||
121 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | ||
122 | { | ||
123 | return false; | ||
124 | } | ||
125 | |||
126 | public string getName() | ||
127 | { | ||
128 | return "MySQL Userdata Interface"; | ||
129 | } | ||
130 | |||
131 | public string getVersion() | ||
132 | { | ||
133 | return "0.1"; | ||
134 | } | ||
135 | } | ||
136 | } | ||