aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/Config.cs
diff options
context:
space:
mode:
authorgareth2007-03-06 15:57:36 +0000
committergareth2007-03-06 15:57:36 +0000
commitd828af7036fd11a4a1f678b2b7e51bdb6380087a (patch)
tree99544eb8c363afeccd0da17ba67970b8cc505d14 /src/Config.cs
parentAdded sandbox mode and setup facility (diff)
downloadopensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.zip
opensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.tar.gz
opensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.tar.bz2
opensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.tar.xz
Implemented local console and VERY rough skeleton for TCP/Worldchat console
Implemented seperate logging (but no packetlog or chat yet)
Diffstat (limited to '')
-rw-r--r--src/Config.cs107
1 files changed, 33 insertions, 74 deletions
diff --git a/src/Config.cs b/src/Config.cs
index dc01df9..55bcdfe 100644
--- a/src/Config.cs
+++ b/src/Config.cs
@@ -64,68 +64,27 @@ namespace OpenSim
64 64
65 public void LoadDefaults() { 65 public void LoadDefaults() {
66 string tempstring; 66 string tempstring;
67 Console.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 67 OpenSim_Main.localcons.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
68 Console.Write("Name [OpenSim test]:"); 68
69 tempstring=Console.ReadLine(); 69 this.RegionName=OpenSim_Main.localcons.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
70 if(tempstring=="") { 70 this.RegionLocX=(uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location X [997]: ","997"));
71 this.RegionName = "OpenSim test"; 71 this.RegionLocY=(uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location Y [996]: ","996"));
72 } else { 72 this.IPListenPort=Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("UDP port for client connections [9000]: ","9000"));
73 this.RegionName = tempstring; 73 this.IPListenAddr=OpenSim_Main.localcons.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
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 74
108 75
109 Console.Write("Run in sandbox or grid mode? [sandbox]:"); 76 tempstring=OpenSim_Main.localcons.CmdPrompt("Run in sandbox or grid mode? [sandbox]: ","sandbox", "sandbox", "grid");
110 tempstring=Console.ReadLine(); 77 if(tempstring=="grid"){
111 if(tempstring=="") {
112 this.sandbox = true;
113 } else if(tempstring=="grid"){
114 this.sandbox = false; 78 this.sandbox = false;
115 } else if(tempstring=="sandbox"){ 79 } else if(tempstring=="sandbox"){
116 this.sandbox=true; 80 this.sandbox=true;
117 } 81 }
118 82
119 if(!this.sandbox) { 83 if(!this.sandbox) {
120 Console.Write("Asset server URL:"); 84 this.AssetURL=OpenSim_Main.localcons.CmdPrompt("Asset server URL: ");
121 this.AssetURL=Console.ReadLine(); 85 this.AssetSendKey=OpenSim_Main.localcons.CmdPrompt("Asset server key: ");
122 Console.Write("Key to send to asset server:"); 86 this.GridURL=OpenSim_Main.localcons.CmdPrompt("Grid server URL: ");
123 this.AssetSendKey=Console.ReadLine(); 87 this.GridSendKey=OpenSim_Main.localcons.CmdPrompt("Grid server key: ");
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 } 88 }
130 this.RegionHandle = Helpers.UIntsToLong((RegionLocX*256), (RegionLocY*256)); 89 this.RegionHandle = Helpers.UIntsToLong((RegionLocX*256), (RegionLocY*256));
131 } 90 }
@@ -135,7 +94,7 @@ namespace OpenSim
135 db = Db4oFactory.OpenFile("opensim.yap"); 94 db = Db4oFactory.OpenFile("opensim.yap");
136 IObjectSet result = db.Get(typeof(SimConfig)); 95 IObjectSet result = db.Get(typeof(SimConfig));
137 if(result.Count==1) { 96 if(result.Count==1) {
138 Console.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); 97 OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
139 foreach (SimConfig cfg in result) { 98 foreach (SimConfig cfg in result) {
140 this.RegionName = cfg.RegionName; 99 this.RegionName = cfg.RegionName;
141 this.RegionLocX = cfg.RegionLocX; 100 this.RegionLocX = cfg.RegionLocX;
@@ -149,38 +108,38 @@ namespace OpenSim
149 this.GridSendKey = cfg.GridSendKey; 108 this.GridSendKey = cfg.GridSendKey;
150 } 109 }
151 } else { 110 } else {
152 Console.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 111 OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
153 LoadDefaults(); 112 LoadDefaults();
154 Console.WriteLine("Writing out default settings to local database"); 113 OpenSim_Main.localcons.WriteLine("Writing out default settings to local database");
155 db.Set(this); 114 db.Set(this);
156 } 115 }
157 } catch(Exception e) { 116 } catch(Exception e) {
158 db.Close(); 117 db.Close();
159 Console.WriteLine("Config.cs:InitConfig() - Exception occured"); 118 OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Exception occured");
160 Console.WriteLine(e.ToString()); 119 OpenSim_Main.localcons.WriteLine(e.ToString());
161 } 120 }
162 Console.WriteLine("Sim settings loaded:"); 121 OpenSim_Main.localcons.WriteLine("Sim settings loaded:");
163 Console.WriteLine("Name: " + this.RegionName); 122 OpenSim_Main.localcons.WriteLine("Name: " + this.RegionName);
164 Console.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); 123 OpenSim_Main.localcons.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
165 Console.WriteLine("Region Handle: " + this.RegionHandle.ToString()); 124 OpenSim_Main.localcons.WriteLine("Region Handle: " + this.RegionHandle.ToString());
166 Console.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); 125 OpenSim_Main.localcons.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
167 Console.WriteLine("Sandbox Mode? " + this.sandbox.ToString()); 126 OpenSim_Main.localcons.WriteLine("Sandbox Mode? " + this.sandbox.ToString());
168 Console.WriteLine("Asset URL: " + this.AssetURL); 127 OpenSim_Main.localcons.WriteLine("Asset URL: " + this.AssetURL);
169 Console.WriteLine("Asset key: " + this.AssetSendKey); 128 OpenSim_Main.localcons.WriteLine("Asset key: " + this.AssetSendKey);
170 Console.WriteLine("Grid URL: " + this.GridURL); 129 OpenSim_Main.localcons.WriteLine("Grid URL: " + this.GridURL);
171 Console.WriteLine("Grid key: " + this.GridSendKey); 130 OpenSim_Main.localcons.WriteLine("Grid key: " + this.GridSendKey);
172 } 131 }
173 132
174 public World LoadWorld() { 133 public World LoadWorld() {
175 Console.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB"); 134 OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB");
176 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World)); 135 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
177 // if(world_result.Count==1) { 136 // if(world_result.Count==1) {
178 // Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading"); 137 // OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
179 //return (World)world_result.Next(); 138 //return (World)world_result.Next();
180 // } else { 139 // } else {
181 Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one"); 140 OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
182 World blank = new World(); 141 World blank = new World();
183 Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk"); 142 OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
184 //db.Set(blank); 143 //db.Set(blank);
185 //db.Commit(); 144 //db.Commit();
186 return blank; 145 return blank;
@@ -188,7 +147,7 @@ namespace OpenSim
188 } 147 }
189 148
190 public void LoadFromGrid() { 149 public void LoadFromGrid() {
191 Console.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); 150 OpenSim_Main.localcons.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
192 // TODO: Make this crap work 151 // TODO: Make this crap work
193 } 152 }
194 153