diff options
Renamed the new Directories. (removed the "-Source" from the end of them)
Diffstat (limited to 'OpenGridServices-Source/OpenGrid.Framework.Data.SQLite')
6 files changed, 0 insertions, 509 deletions
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj deleted file mode 100644 index ef2ecaa..0000000 --- a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{1E3F341A-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data.SQLite</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.SQLite</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="System" > | ||
62 | <HintPath>System.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System.Xml" > | ||
66 | <HintPath>System.Xml.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Data.SQLite.dll" > | ||
74 | <HintPath>..\bin\System.Data.SQLite.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="libsecondlife.dll" > | ||
78 | <HintPath>..\bin\libsecondlife.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
84 | <Name>OpenGrid.Framework.Data</Name> | ||
85 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | </ItemGroup> | ||
90 | <ItemGroup> | ||
91 | <Compile Include="SQLiteGridData.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | <Compile Include="SQLiteManager.cs"> | ||
95 | <SubType>Code</SubType> | ||
96 | </Compile> | ||
97 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | </ItemGroup> | ||
101 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
102 | <PropertyGroup> | ||
103 | <PreBuildEvent> | ||
104 | </PreBuildEvent> | ||
105 | <PostBuildEvent> | ||
106 | </PostBuildEvent> | ||
107 | </PropertyGroup> | ||
108 | </Project> | ||
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user deleted file mode 100644 index d47d65d..0000000 --- a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj.user +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath> | ||
6 | <LastOpenVersion>8.0.50727</LastOpenVersion> | ||
7 | <ProjectView>ProjectFiles</ProjectView> | ||
8 | <ProjectTrust>0</ProjectTrust> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " /> | ||
11 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " /> | ||
12 | </Project> | ||
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build deleted file mode 100644 index d9a2369..0000000 --- a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data.SQLite" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data.SQLite" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="SQLiteGridData.cs" /> | ||
15 | <include name="SQLiteManager.cs" /> | ||
16 | <include name="Properties/AssemblyInfo.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="System.dll" /> | ||
24 | <include name="System.Xml.dll" /> | ||
25 | <include name="System.Data.dll" /> | ||
26 | <include name="../bin/System.Data.SQLite.dll" /> | ||
27 | <include name="../bin/OpenGrid.Framework.Data.dll" /> | ||
28 | <include name="../bin/libsecondlife.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs deleted file mode 100644 index 57c4bae..0000000 --- a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data.SQLite")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data.SQLite")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs deleted file mode 100644 index 4850f12..0000000 --- a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteGridData.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 | |||
6 | namespace OpenGrid.Framework.Data.SQLite | ||
7 | { | ||
8 | public class SQLiteGridData : IGridData | ||
9 | { | ||
10 | private SQLiteManager database; | ||
11 | |||
12 | /// <summary> | ||
13 | /// Initialises the Grid Interface | ||
14 | /// </summary> | ||
15 | public void Initialise() | ||
16 | { | ||
17 | database = new SQLiteManager("localhost", "db", "user", "password", "false"); | ||
18 | } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Shuts down the grid interface | ||
22 | /// </summary> | ||
23 | public void Close() | ||
24 | { | ||
25 | database.Close(); | ||
26 | } | ||
27 | |||
28 | public string getName() | ||
29 | { | ||
30 | return "SQLite OpenGridData"; | ||
31 | } | ||
32 | |||
33 | public string getVersion() | ||
34 | { | ||
35 | return "0.1"; | ||
36 | } | ||
37 | |||
38 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | ||
39 | { | ||
40 | return null; | ||
41 | } | ||
42 | |||
43 | /// <summary> | ||
44 | /// Returns a sim profile from it's location | ||
45 | /// </summary> | ||
46 | /// <param name="handle">Region location handle</param> | ||
47 | /// <returns>Sim profile</returns> | ||
48 | public SimProfileData GetProfileByHandle(ulong handle) | ||
49 | { | ||
50 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
51 | param["handle"] = handle.ToString(); | ||
52 | |||
53 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); | ||
54 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
55 | |||
56 | SimProfileData row = database.getRow(reader); | ||
57 | reader.Close(); | ||
58 | result.Dispose(); | ||
59 | |||
60 | return row; | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Returns a sim profile from it's UUID | ||
65 | /// </summary> | ||
66 | /// <param name="uuid">The region UUID</param> | ||
67 | /// <returns>The sim profile</returns> | ||
68 | public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) | ||
69 | { | ||
70 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
71 | param["uuid"] = uuid.ToStringHyphenated(); | ||
72 | |||
73 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); | ||
74 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
75 | |||
76 | SimProfileData row = database.getRow(reader); | ||
77 | reader.Close(); | ||
78 | result.Dispose(); | ||
79 | |||
80 | return row; | ||
81 | } | ||
82 | |||
83 | public DataResponse AddProfile(SimProfileData profile) | ||
84 | { | ||
85 | if (database.insertRow(profile)) | ||
86 | { | ||
87 | return DataResponse.RESPONSE_OK; | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | return DataResponse.RESPONSE_ERROR; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | ||
97 | /// </summary> | ||
98 | /// <param name="uuid">The UUID of the challenger</param> | ||
99 | /// <param name="handle">The attempted regionHandle of the challenger</param> | ||
100 | /// <param name="authkey">The secret</param> | ||
101 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | ||
102 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) | ||
103 | { | ||
104 | bool throwHissyFit = false; // Should be true by 1.0 | ||
105 | |||
106 | if (throwHissyFit) | ||
107 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | ||
108 | |||
109 | SimProfileData data = GetProfileByLLUUID(uuid); | ||
110 | |||
111 | return (handle == data.regionHandle && authkey == data.regionSecret); | ||
112 | } | ||
113 | |||
114 | /// <summary> | ||
115 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | ||
116 | /// </summary> | ||
117 | /// <remarks>This requires a security audit.</remarks> | ||
118 | /// <param name="uuid"></param> | ||
119 | /// <param name="handle"></param> | ||
120 | /// <param name="authhash"></param> | ||
121 | /// <param name="challenge"></param> | ||
122 | /// <returns></returns> | ||
123 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) | ||
124 | { | ||
125 | System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); | ||
126 | System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); | ||
127 | |||
128 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | ||
129 | byte[] hash = HashProvider.ComputeHash(stream); | ||
130 | |||
131 | return false; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | |||
136 | } | ||
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs deleted file mode 100644 index 408a582..0000000 --- a/OpenGridServices-Source/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Data; | ||
5 | |||
6 | using System.Data.SQLite; | ||
7 | |||
8 | using OpenGrid.Framework.Data; | ||
9 | |||
10 | namespace OpenGrid.Framework.Data.SQLite | ||
11 | { | ||
12 | class SQLiteManager | ||
13 | { | ||
14 | IDbConnection dbcon; | ||
15 | |||
16 | /// <summary> | ||
17 | /// Initialises and creates a new SQLite connection and maintains it. | ||
18 | /// </summary> | ||
19 | /// <param name="hostname">The SQLite server being connected to</param> | ||
20 | /// <param name="database">The name of the SQLite database being used</param> | ||
21 | /// <param name="username">The username logging into the database</param> | ||
22 | /// <param name="password">The password for the user logging in</param> | ||
23 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | ||
24 | public SQLiteManager(string hostname, string database, string username, string password, string cpooling) | ||
25 | { | ||
26 | try | ||
27 | { | ||
28 | string connectionString = "URI=file:GridServerSqlite.db;"; | ||
29 | dbcon = new SQLiteConnection(connectionString); | ||
30 | |||
31 | dbcon.Open(); | ||
32 | } | ||
33 | catch (Exception e) | ||
34 | { | ||
35 | throw new Exception("Error initialising SQLite Database: " + e.ToString()); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | /// <summary> | ||
40 | /// Shuts down the database connection | ||
41 | /// </summary> | ||
42 | public void Close() | ||
43 | { | ||
44 | dbcon.Close(); | ||
45 | dbcon = null; | ||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// Runs a query with protection against SQL Injection by using parameterised input. | ||
50 | /// </summary> | ||
51 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | ||
52 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | ||
53 | /// <returns>A SQLite DB Command</returns> | ||
54 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | ||
55 | { | ||
56 | SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); | ||
57 | dbcommand.CommandText = sql; | ||
58 | foreach (KeyValuePair<string, string> param in parameters) | ||
59 | { | ||
60 | SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); | ||
61 | dbcommand.Parameters.Add(paramx); | ||
62 | } | ||
63 | |||
64 | return (IDbCommand)dbcommand; | ||
65 | } | ||
66 | |||
67 | public SimProfileData getRow(IDataReader reader) | ||
68 | { | ||
69 | SimProfileData retval = new SimProfileData(); | ||
70 | |||
71 | if (reader.Read()) | ||
72 | { | ||
73 | // Region Main | ||
74 | retval.regionHandle = (ulong)reader["regionHandle"]; | ||
75 | retval.regionName = (string)reader["regionName"]; | ||
76 | retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); | ||
77 | |||
78 | // Secrets | ||
79 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | ||
80 | retval.regionSecret = (string)reader["regionSecret"]; | ||
81 | retval.regionSendKey = (string)reader["regionSendKey"]; | ||
82 | |||
83 | // Region Server | ||
84 | retval.regionDataURI = (string)reader["regionDataURI"]; | ||
85 | retval.regionOnline = false; // Needs to be pinged before this can be set. | ||
86 | retval.serverIP = (string)reader["serverIP"]; | ||
87 | retval.serverPort = (uint)reader["serverPort"]; | ||
88 | retval.serverURI = (string)reader["serverURI"]; | ||
89 | |||
90 | // Location | ||
91 | retval.regionLocX = (uint)((int)reader["locX"]); | ||
92 | retval.regionLocY = (uint)((int)reader["locY"]); | ||
93 | retval.regionLocZ = (uint)((int)reader["locZ"]); | ||
94 | |||
95 | // Neighbours - 0 = No Override | ||
96 | retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | ||
97 | retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | ||
98 | retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | ||
99 | retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | ||
100 | |||
101 | // Assets | ||
102 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | ||
103 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | ||
104 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | ||
105 | |||
106 | // Userserver | ||
107 | retval.regionUserURI = (string)reader["regionUserURI"]; | ||
108 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | ||
109 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | throw new Exception("No rows to return"); | ||
114 | } | ||
115 | return retval; | ||
116 | } | ||
117 | |||
118 | public bool insertRow(SimProfileData profile) | ||
119 | { | ||
120 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | ||
121 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
122 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | ||
123 | |||
124 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | ||
125 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
126 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | ||
127 | |||
128 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
129 | |||
130 | parameters["regionHandle"] = profile.regionHandle.ToString(); | ||
131 | parameters["regionName"] = profile.regionName; | ||
132 | parameters["uuid"] = profile.UUID.ToString(); | ||
133 | parameters["regionRecvKey"] = profile.regionRecvKey; | ||
134 | parameters["regionSendKey"] = profile.regionSendKey; | ||
135 | parameters["regionDataURI"] = profile.regionDataURI; | ||
136 | parameters["serverIP"] = profile.serverIP; | ||
137 | parameters["serverPort"] = profile.serverPort.ToString(); | ||
138 | parameters["serverURI"] = profile.serverURI; | ||
139 | parameters["locX"] = profile.regionLocX.ToString(); | ||
140 | parameters["locY"] = profile.regionLocY.ToString(); | ||
141 | parameters["locZ"] = profile.regionLocZ.ToString(); | ||
142 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | ||
143 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | ||
144 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | ||
145 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | ||
146 | parameters["regionAssetURI"] = profile.regionAssetURI; | ||
147 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | ||
148 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | ||
149 | parameters["regionUserURI"] = profile.regionUserURI; | ||
150 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | ||
151 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | ||
152 | |||
153 | bool returnval = false; | ||
154 | |||
155 | try | ||
156 | { | ||
157 | IDbCommand result = Query(sql, parameters); | ||
158 | |||
159 | if (result.ExecuteNonQuery() == 1) | ||
160 | returnval = true; | ||
161 | |||
162 | result.Dispose(); | ||
163 | } | ||
164 | catch (Exception e) | ||
165 | { | ||
166 | return false; | ||
167 | } | ||
168 | |||
169 | return returnval; | ||
170 | } | ||
171 | } | ||
172 | } | ||