aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/Config.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Config.cs106
1 files changed, 82 insertions, 24 deletions
diff --git a/src/Config.cs b/src/Config.cs
index f85e4d5..dc01df9 100644
--- a/src/Config.cs
+++ b/src/Config.cs
@@ -53,25 +53,81 @@ namespace OpenSim
53 public int IPListenPort; 53 public int IPListenPort;
54 public string IPListenAddr; 54 public string IPListenAddr;
55 55
56 public string AssetURL; 56 public bool sandbox;
57 public string AssetSendKey; 57 public string AssetURL="";
58 public string AssetSendKey="";
58 59
59 public string GridURL; 60 public string GridURL="";
60 public string GridSendKey; 61 public string GridSendKey="";
61 62
62 private IObjectContainer db; 63 private IObjectContainer db;
63 64
64 public void LoadDefaults() { 65 public void LoadDefaults() {
65 this.RegionName = "OpenSim test\0"; 66 string tempstring;
66 this.RegionLocX = 997; 67 Console.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
67 this.RegionLocY = 996; 68 Console.Write("Name [OpenSim test]:");
69 tempstring=Console.ReadLine();
70 if(tempstring=="") {
71 this.RegionName = "OpenSim test";
72 } else {
73 this.RegionName = tempstring;
74 }
75
76 Console.Write("Grid location X [997]:");
77 tempstring=Console.ReadLine();
78 if(tempstring=="") {
79 this.RegionLocX = 997;
80 } else {
81 this.RegionLocX = (uint)Convert.ToInt32(tempstring);
82 }
83
84 Console.Write("Grid location Y [996]:");
85 tempstring=Console.ReadLine();
86 if(tempstring=="") {
87 this.RegionLocY = 996;
88 } else {
89 this.RegionLocY = (uint)Convert.ToInt32(tempstring);
90 }
91
92 Console.Write("Listen on UDP port for client connections [9000]:");
93 tempstring=Console.ReadLine();
94 if(tempstring=="") {
95 this.IPListenPort = 9000;
96 } else {
97 this.IPListenPort = Convert.ToInt32(tempstring);
98 }
99
100 Console.Write("Listen on IP address for client connections [127.0.0.1]:");
101 tempstring=Console.ReadLine();
102 if(tempstring=="") {
103 this.IPListenAddr = "127.0.0.1";
104 } else {
105 this.IPListenAddr = tempstring;
106 }
107
108
109 Console.Write("Run in sandbox or grid mode? [sandbox]:");
110 tempstring=Console.ReadLine();
111 if(tempstring=="") {
112 this.sandbox = true;
113 } else if(tempstring=="grid"){
114 this.sandbox = false;
115 } else if(tempstring=="sandbox"){
116 this.sandbox=true;
117 }
118
119 if(!this.sandbox) {
120 Console.Write("Asset server URL:");
121 this.AssetURL=Console.ReadLine();
122 Console.Write("Key to send to asset server:");
123 this.AssetSendKey=Console.ReadLine();
124 Console.Write("Grid server URL:");
125 this.GridURL=Console.ReadLine();
126 Console.Write("Key to send to gridserver:");
127 this.GridSendKey=Console.ReadLine();
128
129 }
68 this.RegionHandle = Helpers.UIntsToLong((RegionLocX*256), (RegionLocY*256)); 130 this.RegionHandle = Helpers.UIntsToLong((RegionLocX*256), (RegionLocY*256));
69 this.IPListenPort = 9000;
70 this.IPListenAddr = "4.78.190.75";
71 this.AssetURL = "http://www.osgrid.org/ogs/assetserver/";
72 this.AssetSendKey = "1234";
73 this.GridURL = "http://www.osgrid.org/ogs/gridserver/";
74 this.GridSendKey = "1234";
75 } 131 }
76 132
77 public void InitConfig() { 133 public void InitConfig() {
@@ -103,20 +159,30 @@ namespace OpenSim
103 Console.WriteLine("Config.cs:InitConfig() - Exception occured"); 159 Console.WriteLine("Config.cs:InitConfig() - Exception occured");
104 Console.WriteLine(e.ToString()); 160 Console.WriteLine(e.ToString());
105 } 161 }
162 Console.WriteLine("Sim settings loaded:");
163 Console.WriteLine("Name: " + this.RegionName);
164 Console.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
165 Console.WriteLine("Region Handle: " + this.RegionHandle.ToString());
166 Console.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
167 Console.WriteLine("Sandbox Mode? " + this.sandbox.ToString());
168 Console.WriteLine("Asset URL: " + this.AssetURL);
169 Console.WriteLine("Asset key: " + this.AssetSendKey);
170 Console.WriteLine("Grid URL: " + this.GridURL);
171 Console.WriteLine("Grid key: " + this.GridSendKey);
106 } 172 }
107 173
108 public World LoadWorld() { 174 public World LoadWorld() {
109 Console.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB"); 175 Console.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB");
110 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World)); 176 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
111 // if(world_result.Count==1) { 177 // if(world_result.Count==1) {
112 Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading"); 178 // Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
113 //return (World)world_result.Next(); 179 //return (World)world_result.Next();
114 // } else { 180 // } else {
115 Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one"); 181 Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
116 World blank = new World(); 182 World blank = new World();
117 Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk"); 183 Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
118 db.Set(blank); 184 //db.Set(blank);
119 db.Commit(); 185 //db.Commit();
120 return blank; 186 return blank;
121 // } 187 // }
122 } 188 }
@@ -124,14 +190,6 @@ namespace OpenSim
124 public void LoadFromGrid() { 190 public void LoadFromGrid() {
125 Console.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); 191 Console.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
126 // TODO: Make this crap work 192 // TODO: Make this crap work
127 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
128 WebResponse GridResponse = GridLogin.GetResponse();
129 byte[] idata = new byte[(int)GridResponse.ContentLength];
130 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
131
132 br.Close();
133 GridResponse.Close();
134 */
135 } 193 }
136 194
137 public void Shutdown() { 195 public void Shutdown() {