aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OGS/userserver/src/Main.cs
diff options
context:
space:
mode:
authorgareth2007-03-22 10:11:15 +0000
committergareth2007-03-22 10:11:15 +0000
commit7daa3955bc3a1918e40962851f9e8d38597a245e (patch)
treebee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /OGS/userserver/src/Main.cs
parentLoad XML for neighbourinfo from grid (diff)
downloadopensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.zip
opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz
opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2
opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz
brought zircon branch into trunk
Diffstat (limited to 'OGS/userserver/src/Main.cs')
-rw-r--r--OGS/userserver/src/Main.cs118
1 files changed, 118 insertions, 0 deletions
diff --git a/OGS/userserver/src/Main.cs b/OGS/userserver/src/Main.cs
new file mode 100644
index 0000000..7e5308e
--- /dev/null
+++ b/OGS/userserver/src/Main.cs
@@ -0,0 +1,118 @@
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;
36using OpenSim.Framework.User;
37using OpenSim.Framework.Sims;
38using OpenSim.Framework.Inventory;
39
40namespace OpenGridServices
41{
42 /// <summary>
43 /// </summary>
44 public class OpenUser_Main
45 {
46
47 public static OpenUser_Main userserver;
48
49 public UserHTTPServer _httpd;
50 public UserProfileManager _profilemanager;
51 public UserProfile GridGod;
52 public string DefaultStartupMsg;
53 public string GridURL;
54 public string GridSendKey;
55 public string GridRecvKey;
56
57 public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
58
59 [STAThread]
60 public static void Main( string[] args )
61 {
62 Console.WriteLine("OpenUser " + VersionInfo.Version + "\n");
63 Console.WriteLine("Starting...\n");
64 ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0, "opengrid-console.log", "OpenUser", new UserConsole());
65
66 userserver = new OpenUser_Main();
67 userserver.Startup();
68
69 ServerConsole.MainConsole.Instance.WriteLine("\nEnter help for a list of commands\n");
70
71 while(true) {
72 ServerConsole.MainConsole.Instance.MainConsolePrompt();
73 }
74 }
75
76 public void Startup() {
77 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings");
78
79 this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: ");
80 this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: ");
81 this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: ");
82
83 this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!] :","Welcome to OGS!");
84
85 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
86 _profilemanager = new UserProfileManager();
87 _profilemanager.InitUserProfiles();
88 _profilemanager.SetKeys(GridSendKey, GridRecvKey, GridURL, DefaultStartupMsg);
89
90
91 string tempfirstname;
92 string templastname;
93 string tempMD5Passwd;
94 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please configure the grid god user:");
95 tempfirstname=ServerConsole.MainConsole.Instance.CmdPrompt("First name: ");
96 templastname=ServerConsole.MainConsole.Instance.CmdPrompt("Last name: ");
97 tempMD5Passwd=ServerConsole.MainConsole.Instance.PasswdPrompt("Password: ");
98
99 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
100 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
101 bs = x.ComputeHash(bs);
102 System.Text.StringBuilder s = new System.Text.StringBuilder();
103 foreach (byte b in bs)
104 {
105 s.Append(b.ToString("x2").ToLower());
106 }
107 tempMD5Passwd = "$1$" + s.ToString();
108
109 GridGod=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd);
110 _profilemanager.SetGod(GridGod.UUID);
111 GridGod.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
112 GridGod.homepos = new LLVector3(128f,128f,23f);
113
114 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting HTTP process");
115 _httpd = new UserHTTPServer();
116 }
117 }
118}