diff options
Diffstat (limited to 'OpenGridServices')
3 files changed, 121 insertions, 16 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs index 76d3faf..b42ec09 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs | |||
@@ -514,6 +514,90 @@ namespace OpenGrid.Framework.Data.MySQL | |||
514 | } | 514 | } |
515 | 515 | ||
516 | /// <summary> | 516 | /// <summary> |
517 | /// Creates a new user and inserts it into the database | ||
518 | /// </summary> | ||
519 | /// <param name="uuid">User ID</param> | ||
520 | /// <param name="username">First part of the login</param> | ||
521 | /// <param name="lastname">Second part of the login</param> | ||
522 | /// <param name="passwordHash">A salted hash of the users password</param> | ||
523 | /// <param name="passwordSalt">The salt used for the password hash</param> | ||
524 | /// <param name="homeRegion">A regionHandle of the users home region</param> | ||
525 | /// <param name="homeLocX">Home region position vector</param> | ||
526 | /// <param name="homeLocY">Home region position vector</param> | ||
527 | /// <param name="homeLocZ">Home region position vector</param> | ||
528 | /// <param name="homeLookAtX">Home region 'look at' vector</param> | ||
529 | /// <param name="homeLookAtY">Home region 'look at' vector</param> | ||
530 | /// <param name="homeLookAtZ">Home region 'look at' vector</param> | ||
531 | /// <param name="created">Account created (unix timestamp)</param> | ||
532 | /// <param name="lastlogin">Last login (unix timestamp)</param> | ||
533 | /// <param name="inventoryURI">Users inventory URI</param> | ||
534 | /// <param name="assetURI">Users asset URI</param> | ||
535 | /// <param name="canDoMask">I can do mask</param> | ||
536 | /// <param name="wantDoMask">I want to do mask</param> | ||
537 | /// <param name="aboutText">Profile text</param> | ||
538 | /// <param name="firstText">Firstlife text</param> | ||
539 | /// <param name="profileImage">UUID for profile image</param> | ||
540 | /// <param name="firstImage">UUID for firstlife image</param> | ||
541 | /// <returns>Success?</returns> | ||
542 | public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, | ||
543 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, | ||
544 | libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) | ||
545 | { | ||
546 | string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passworldSalt`, `homeRegion`, "; | ||
547 | sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; | ||
548 | sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; | ||
549 | sql += "`profileFirstText`, `profileImage`, profileFirstImage`) VALUES "; | ||
550 | |||
551 | sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passworldSalt, ?homeRegion, "; | ||
552 | sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX`, ?homeLookAtY, ?homeLookAtZ, ?created, "; | ||
553 | sql += "?lastLogin`, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; | ||
554 | sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; | ||
555 | |||
556 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
557 | parameters["?UUID"] = uuid.ToStringHyphenated(); | ||
558 | parameters["?username"] = username.ToString(); | ||
559 | parameters["?lastname"] = lastname.ToString(); | ||
560 | parameters["?passwordHash"] = passwordHash.ToString(); | ||
561 | parameters["?passworldSalt"] = passwordSalt.ToString(); | ||
562 | parameters["?homeRegion"] = homeRegion.ToString(); | ||
563 | parameters["?homeLocationX"] = homeLocX.ToString(); | ||
564 | parameters["?homeLocationY"] = homeLocY.ToString(); | ||
565 | parameters["?homeLocationZ"] = homeLocZ.ToString(); | ||
566 | parameters["?homeLookAtX"] = homeLookAtX.ToString(); | ||
567 | parameters["?homeLookAtY"] = homeLookAtY.ToString(); | ||
568 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); | ||
569 | parameters["?created"] = created.ToString(); | ||
570 | parameters["?lastLogin"] = lastlogin.ToString(); | ||
571 | parameters["?userInventoryURI"] = inventoryURI.ToString(); | ||
572 | parameters["?userAssetURI"] = assetURI.ToString(); | ||
573 | parameters["?profileCanDoMask"] = canDoMask.ToString(); | ||
574 | parameters["?profileWantDoMask"] = wantDoMask.ToString(); | ||
575 | parameters["?profileAboutText"] = aboutText.ToString(); | ||
576 | parameters["?profileFirstText"] = firstText.ToString(); | ||
577 | parameters["?profileImage"] = profileImage.ToStringHyphenated(); | ||
578 | parameters["?profileFirstImage"] = firstImage.ToStringHyphenated(); | ||
579 | |||
580 | bool returnval = false; | ||
581 | |||
582 | try | ||
583 | { | ||
584 | IDbCommand result = Query(sql, parameters); | ||
585 | |||
586 | if (result.ExecuteNonQuery() == 1) | ||
587 | returnval = true; | ||
588 | |||
589 | result.Dispose(); | ||
590 | } | ||
591 | catch (Exception e) | ||
592 | { | ||
593 | Console.WriteLine(e.ToString()); | ||
594 | return false; | ||
595 | } | ||
596 | |||
597 | return returnval; | ||
598 | } | ||
599 | |||
600 | /// <summary> | ||
517 | /// Inserts a new region into the database | 601 | /// Inserts a new region into the database |
518 | /// </summary> | 602 | /// </summary> |
519 | /// <param name="profile">The region to insert</param> | 603 | /// <param name="profile">The region to insert</param> |
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs index 032a0e6..e988c94 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | |||
@@ -200,6 +200,20 @@ namespace OpenGrid.Framework.Data.MySQL | |||
200 | /// <param name="user">The user profile to create</param> | 200 | /// <param name="user">The user profile to create</param> |
201 | public void addNewUserProfile(UserProfileData user) | 201 | public void addNewUserProfile(UserProfileData user) |
202 | { | 202 | { |
203 | try | ||
204 | { | ||
205 | lock (database) | ||
206 | { | ||
207 | database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, | ||
208 | user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, | ||
209 | user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); | ||
210 | } | ||
211 | } | ||
212 | catch (Exception e) | ||
213 | { | ||
214 | database.Reconnect(); | ||
215 | Console.WriteLine(e.ToString()); | ||
216 | } | ||
203 | } | 217 | } |
204 | 218 | ||
205 | /// <summary> | 219 | /// <summary> |
diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj index 0708947..e07e5be 100644 --- a/OpenGridServices/ServiceManager/ServiceManager.csproj +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>ServiceManager</AssemblyName> | 13 | <AssemblyName>ServiceManager</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Exe</OutputType> | 18 | <OutputType>Exe</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>ServiceManager</RootNamespace> | 21 | <RootNamespace>ServiceManager</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,30 +61,31 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="libsecondlife.dll" > | 68 | <Reference Include="libsecondlife.dll"> |
62 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 69 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="OpenSim.Framework.dll" > | 72 | <Reference Include="OpenSim.Framework.dll"> |
66 | <HintPath>..\..\bin\OpenSim.Framework.dll</HintPath> | 73 | <HintPath>..\..\bin\OpenSim.Framework.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="OpenSim.GenericConfig.Xml" > | 76 | <Reference Include="OpenSim.GenericConfig.Xml"> |
70 | <HintPath>OpenSim.GenericConfig.Xml.dll</HintPath> | 77 | <HintPath>OpenSim.GenericConfig.Xml.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="System" > | 80 | <Reference Include="System"> |
74 | <HintPath>System.dll</HintPath> | 81 | <HintPath>System.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
77 | <Reference Include="System.ServiceProcess" > | 84 | <Reference Include="System.ServiceProcess"> |
78 | <HintPath>System.ServiceProcess.dll</HintPath> | 85 | <HintPath>System.ServiceProcess.dll</HintPath> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </Reference> | 87 | </Reference> |
81 | <Reference Include="System.Xml" > | 88 | <Reference Include="System.Xml"> |
82 | <HintPath>System.Xml.dll</HintPath> | 89 | <HintPath>System.Xml.dll</HintPath> |
83 | <Private>False</Private> | 90 | <Private>False</Private> |
84 | </Reference> | 91 | </Reference> |
@@ -87,7 +94,7 @@ | |||
87 | </ItemGroup> | 94 | </ItemGroup> |
88 | <ItemGroup> | 95 | <ItemGroup> |
89 | <Compile Include="ServiceManager.cs"> | 96 | <Compile Include="ServiceManager.cs"> |
90 | <SubType>Code</SubType> | 97 | <SubType>Component</SubType> |
91 | </Compile> | 98 | </Compile> |
92 | </ItemGroup> | 99 | </ItemGroup> |
93 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | 100 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
@@ -97,4 +104,4 @@ | |||
97 | <PostBuildEvent> | 104 | <PostBuildEvent> |
98 | </PostBuildEvent> | 105 | </PostBuildEvent> |
99 | </PropertyGroup> | 106 | </PropertyGroup> |
100 | </Project> | 107 | </Project> \ No newline at end of file |