aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ogs/userserver/src/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ogs/userserver/src/Main.cs')
-rw-r--r--ogs/userserver/src/Main.cs114
1 files changed, 114 insertions, 0 deletions
diff --git a/ogs/userserver/src/Main.cs b/ogs/userserver/src/Main.cs
new file mode 100644
index 0000000..40ef916
--- /dev/null
+++ b/ogs/userserver/src/Main.cs
@@ -0,0 +1,114 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using System.Text;
34using libsecondlife;
35using ServerConsole;
36
37namespace OpenGridServices
38{
39 /// <summary>
40 /// </summary>
41 public class OpenUser_Main
42 {
43
44 public static OpenUser_Main userserver;
45
46 public UserHTTPServer _httpd;
47 public UserProfileManager _profilemanager;
48 public UserProfile GridGod;
49 public string DefaultStartupMsg;
50 public string GridURL;
51 public string GridSendKey;
52 public string GridRecvKey;
53
54 public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
55
56 [STAThread]
57 public static void Main( string[] args )
58 {
59 Console.WriteLine("OpenUser " + VersionInfo.Version + "\n");
60 Console.WriteLine("Starting...\n");
61 ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0, "opengrid-console.log", "OpenUser", new UserConsole());
62
63 userserver = new OpenUser_Main();
64 userserver.Startup();
65
66 ServerConsole.MainConsole.Instance.WriteLine("\nEnter help for a list of commands\n");
67
68 while(true) {
69 ServerConsole.MainConsole.Instance.MainConsolePrompt();
70 }
71 }
72
73 public void Startup() {
74 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings");
75
76 this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: ");
77 this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: ");
78 this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: ");
79
80 this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!] :","Welcome to OGS!");
81
82 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
83 _profilemanager = new UserProfileManager();
84 _profilemanager.InitUserProfiles();
85
86
87 string tempfirstname;
88 string templastname;
89 string tempMD5Passwd;
90 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please configure the grid god user:");
91 tempfirstname=ServerConsole.MainConsole.Instance.CmdPrompt("First name: ");
92 templastname=ServerConsole.MainConsole.Instance.CmdPrompt("Last name: ");
93 tempMD5Passwd=ServerConsole.MainConsole.Instance.PasswdPrompt("Password: ");
94
95 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
96 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
97 bs = x.ComputeHash(bs);
98 System.Text.StringBuilder s = new System.Text.StringBuilder();
99 foreach (byte b in bs)
100 {
101 s.Append(b.ToString("x2").ToLower());
102 }
103 tempMD5Passwd = "$1$" + s.ToString();
104
105 GridGod=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd);
106 _profilemanager.SetGod(GridGod.UUID);
107 GridGod.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
108 GridGod.homepos = new LLVector3(128f,128f,23f);
109
110 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process");
111 _httpd = new UserHTTPServer();
112 }
113 }
114}