* Cleanup and CCC (Code Convention Conformance)

0.6.5-rc1
lbsa71 2009-03-10 20:06:25 +00:00
parent a8ae02df4f
commit 63a5a01945
2 changed files with 266 additions and 216 deletions

View File

@ -38,7 +38,6 @@ using OpenSim.Region.CoreModules.Avatar.InstantMessage;
using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
using OpenSim.Region.CoreModules.Scripting.LoadImageURL;
using OpenSim.Region.CoreModules.Scripting.XMLRPC;
using OpenSim.Framework.Servers;
namespace OpenSim.ApplicationPlugins.LoadRegions
{
@ -52,11 +51,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
#region IApplicationPlugin Members
// TODO: required by IPlugin, but likely not at all right
string m_name = "LoadRegionsPlugin";
string m_version = "0.0";
private string m_name = "LoadRegionsPlugin";
private string m_version = "0.0";
public string Version { get { return m_version; } }
public string Name { get { return m_name; } }
public string Version
{
get { return m_version; }
}
public string Name
{
get { return m_name; }
}
protected OpenSimBase m_openSim;
@ -106,7 +112,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
for (int i = 0; i < regionsToLoad.Length; i++)
{
IScene scene;
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() +
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId.ToString() +
")");
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
if (scene != null)
@ -155,7 +162,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
region.RegionName, checkedRegion.RegionName, region.RegionID);
return false;
}
else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY)
else if (region.RegionLocX == checkedRegion.RegionLocX &&
region.RegionLocY == checkedRegion.RegionLocY)
{
m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}",

View File

@ -55,16 +55,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private string requiredPassword = String.Empty;
// TODO: required by IPlugin, but likely not at all right
string m_name = "RemoteAdminPlugin";
string m_version = "0.0";
private string m_name = "RemoteAdminPlugin";
private string m_version = "0.0";
public string Version { get { return m_version; } }
public string Name { get { return m_name; } }
public string Version
{
get { return m_version; }
}
public string Name
{
get { return m_name; }
}
public void Initialise()
{
m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name);
throw new PluginNotInitialisedException(Name);
}
@ -140,14 +147,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
try {
try
{
Hashtable requestData = (Hashtable) request.Params[0];
m_log.Info("[RADMIN]: Request to restart Region.");
checkStringParameters(request, new string[] { "password", "regionID" });
checkStringParameters(request, new string[] {"password", "regionID"});
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
{
throw new Exception("wrong password");
}
@ -167,7 +175,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
response.Value = responseData;
rebootedScene.Restart(30);
}
catch(Exception e)
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
@ -190,7 +198,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
Hashtable requestData = (Hashtable) request.Params[0];
checkStringParameters(request, new string[] { "password", "message" });
checkStringParameters(request, new string[] {"password", "message"});
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@ -211,7 +219,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
dialogModule.SendGeneralAlert(message);
});
}
catch(Exception e)
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
@ -230,8 +238,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
try {
Hashtable requestData = (Hashtable)request.Params[0];
try
{
Hashtable requestData = (Hashtable) request.Params[0];
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
// foreach (string k in requestData.Keys)
@ -240,14 +249,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// k, (string)requestData[k], ((string)requestData[k]).Length);
// }
checkStringParameters(request, new string[] { "password", "filename", "regionid"});
checkStringParameters(request, new string[] {"password", "filename", "regionid"});
if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
throw new Exception("wrong password");
string file = (string)requestData["filename"];
UUID regionID = (UUID)(string) requestData["regionid"];
string file = (string) requestData["filename"];
UUID regionID = (UUID) (string) requestData["regionid"];
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
responseData["accepted"] = "true";
@ -283,7 +292,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
try {
try
{
Hashtable requestData = (Hashtable) request.Params[0];
if (requiredPassword != String.Empty &&
@ -353,7 +363,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
if (!requestData.Contains(p))
throw new Exception(String.Format("missing string parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p]))
if (String.IsNullOrEmpty((string) requestData[p]))
throw new Exception(String.Format("parameter {0} is empty", p));
}
}
@ -427,19 +437,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
int m_regionLimit = m_config.GetInt("region_limit", 0);
try {
try
{
Hashtable requestData = (Hashtable) request.Params[0];
checkStringParameters(request, new string[] { "password",
checkStringParameters(request, new string[]
{
"password",
"region_name",
"region_master_first", "region_master_last",
"region_master_password",
"listen_ip", "external_address"});
"listen_ip", "external_address"
});
checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
// check whether we still have space left (iff we are using limits)
if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit)
@ -450,11 +464,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Scene scene = null;
UUID regionID = UUID.Zero;
if (requestData.ContainsKey("region_id") &&
!String.IsNullOrEmpty((string)requestData["region_id"]))
!String.IsNullOrEmpty((string) requestData["region_id"]))
{
regionID = (UUID)(string)requestData["region_id"];
regionID = (UUID) (string) requestData["region_id"];
if (m_app.SceneManager.TryGetScene(regionID, out scene))
throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
throw new Exception(
String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
}
@ -475,12 +490,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// check for collisions: region name, region UUID,
// region location
if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
throw new Exception(
String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene))
throw new Exception(String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>",
throw new Exception(
String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>",
region.RegionLocX, region.RegionLocY,
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
@ -491,25 +508,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]);
if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
throw new Exception(
String.Format(
"region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
region.InternalEndPoint.Address,
region.InternalEndPoint.Port,
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
region.ExternalHostName = (string)requestData["external_address"];
region.ExternalHostName = (string) requestData["external_address"];
string masterFirst = (string)requestData["region_master_first"];
string masterLast = (string)requestData["region_master_last"];
string masterPassword = (string)requestData["region_master_password"];
string masterFirst = (string) requestData["region_master_first"];
string masterLast = (string) requestData["region_master_last"];
string masterPassword = (string) requestData["region_master_password"];
UUID userID = UUID.Zero;
if (requestData.ContainsKey("region_master_uuid"))
{
// ok, client wants us to use an explicit UUID
// regardless of what the avatar name provided
userID = new UUID((string)requestData["region_master_uuid"]);
userID = new UUID((string) requestData["region_master_uuid"]);
}
else
{
@ -522,7 +541,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
userID = m_app.CommunicationsManager.UserAdminService.AddUser(
masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
if (userID == UUID.Zero)
throw new Exception(String.Format("failed to create new user {0} {1}",
masterFirst, masterLast));
}
else
@ -536,7 +556,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.MasterAvatarSandboxPassword = masterPassword;
region.MasterAvatarAssignedUUID = userID;
bool persist = Convert.ToBoolean((string)requestData["persist"]);
bool persist = Convert.ToBoolean((string) requestData["persist"]);
if (persist)
{
// default place for region XML files is in the
@ -545,7 +565,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
// OpenSim.ini can specify a different regions dir
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
}
catch (Exception)
@ -553,12 +573,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// No INI setting recorded.
}
string regionXmlPath = Path.Combine(regionConfigPath,
String.Format(m_config.GetString("region_file_template", "{0}x{1}-{2}.xml"),
String.Format(
m_config.GetString("region_file_template",
"{0}x{1}-{2}.xml"),
region.RegionLocX.ToString(),
region.RegionLocY.ToString(),
regionID.ToString(),
region.InternalEndPoint.Port.ToString(),
region.RegionName.Replace(" ", "_").Replace(":", "_").Replace("/", "_")));
region.RegionName.Replace(" ", "_").Replace(":", "_").
Replace("/", "_")));
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionXmlPath);
region.SaveRegionToFile("dynamic region", regionXmlPath);
@ -620,12 +643,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
lock (this)
{
try {
try
{
Hashtable requestData = (Hashtable) request.Params[0];
checkStringParameters(request, new string[] {"password", "region_name"});
Scene scene = null;
string regionName = (string)requestData["region_name"];
string regionName = (string) requestData["region_name"];
if (!m_app.SceneManager.TryGetScene(regionName, out scene))
throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
@ -648,7 +672,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
return response;
}
}
@ -701,21 +724,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname", "user_password", });
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
checkStringParameters(request, new string[]
{
"password", "user_firstname",
"user_lastname", "user_password",
});
checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"});
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
// do the job
string firstname = (string) requestData["user_firstname"];
string lastname = (string) requestData["user_lastname"];
string passwd = (string) requestData["user_password"];
string email = ""; //Empty string for email
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
if (null != userProfile)
@ -724,7 +750,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
UUID userID = m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname,
passwd, email, regX, regY);
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
if (userID == UUID.Zero)
throw new Exception(String.Format("failed to create new user {0} {1}",
firstname, lastname));
responseData["success"] = "true";
@ -746,7 +773,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
response.Value = responseData;
}
return response;
}
}
@ -798,26 +824,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
try
{
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname", "user_password", "user_email" });
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
checkStringParameters(request, new string[]
{
"password", "user_firstname",
"user_lastname", "user_password", "user_email"
});
checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"});
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
// do the job
string firstname = (string)requestData["user_firstname"];
string lastname = (string)requestData["user_lastname"];
string passwd = (string)requestData["user_password"];
string email = (string)requestData["user_email"];
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
string firstname = (string) requestData["user_firstname"];
string lastname = (string) requestData["user_lastname"];
string passwd = (string) requestData["user_password"];
string email = (string) requestData["user_email"];
uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
UserProfileData userProfile =
m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
if (null != userProfile)
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
@ -825,7 +855,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
= m_app.CommunicationsManager.UserAdminService.AddUser(
firstname, lastname, passwd, email, regX, regY);
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
if (userID == UUID.Zero)
throw new Exception(String.Format("failed to create new user {0} {1}",
firstname, lastname));
responseData["success"] = "true";
@ -847,7 +878,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
response.Value = responseData;
}
return response;
}
}
@ -892,7 +922,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
checkStringParameters(request, new string[] { "password", "user_firstname", "user_lastname"});
checkStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"});
string firstname = (string) requestData["user_firstname"];
string lastname = (string) requestData["user_lastname"];
@ -970,12 +1000,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname" });
checkStringParameters(request, new string[]
{
"password", "user_firstname",
"user_lastname"
});
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
// do the job
string firstname = (string) requestData["user_firstname"];
@ -994,16 +1027,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
if (requestData.ContainsKey("start_region_x")) regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
if (requestData.ContainsKey("start_region_y")) regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
if (requestData.ContainsKey("start_region_x"))
regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
if (requestData.ContainsKey("start_region_y"))
regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
if (requestData.ContainsKey("start_lookat_x")) ulaX = Convert.ToUInt32((Int32)requestData["start_lookat_x"]);
if (requestData.ContainsKey("start_lookat_y")) ulaY = Convert.ToUInt32((Int32)requestData["start_lookat_y"]);
if (requestData.ContainsKey("start_lookat_z")) ulaZ = Convert.ToUInt32((Int32)requestData["start_lookat_z"]);
if (requestData.ContainsKey("start_lookat_x"))
ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
if (requestData.ContainsKey("start_lookat_y"))
ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
if (requestData.ContainsKey("start_lookat_z"))
ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
if (requestData.ContainsKey("start_standat_x")) usaX = Convert.ToUInt32((Int32)requestData["start_standat_x"]);
if (requestData.ContainsKey("start_standat_y")) usaY = Convert.ToUInt32((Int32)requestData["start_standat_y"]);
if (requestData.ContainsKey("start_standat_z")) usaZ = Convert.ToUInt32((Int32)requestData["start_standat_z"]);
if (requestData.ContainsKey("start_standat_x"))
usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
if (requestData.ContainsKey("start_standat_y"))
usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
if (requestData.ContainsKey("start_standat_z"))
usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
@ -1016,16 +1057,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
userProfile.PasswordHash = md5PasswdHash;
}
if (null != regX) userProfile.HomeRegionX = (uint)regX;
if (null != regY) userProfile.HomeRegionY = (uint)regY;
if (null != regX) userProfile.HomeRegionX = (uint) regX;
if (null != regY) userProfile.HomeRegionY = (uint) regY;
if (null != usaX) userProfile.HomeLocationX = (uint)usaX;
if (null != usaY) userProfile.HomeLocationY = (uint)usaY;
if (null != usaZ) userProfile.HomeLocationZ = (uint)usaZ;
if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
if (null != ulaX) userProfile.HomeLookAtX = (uint)ulaX;
if (null != ulaY) userProfile.HomeLookAtY = (uint)ulaY;
if (null != ulaZ) userProfile.HomeLookAtZ = (uint)ulaZ;
if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
throw new Exception("did not manage to update user profile");
@ -1034,7 +1075,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
response.Value = responseData;
m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", firstname, lastname,
m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
firstname, lastname,
userProfile.ID);
}
catch (Exception e)
@ -1097,29 +1139,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
foreach (string p in new string[] { "password", "filename" })
foreach (string p in new string[] {"password", "filename"})
{
if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p]))
if (String.IsNullOrEmpty((string) requestData[p]))
throw new Exception(String.Format("parameter {0} is empty"));
}
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
string filename = (string)requestData["filename"];
string filename = (string) requestData["filename"];
Scene scene = null;
if (requestData.Contains("region_uuid"))
{
UUID region_uuid = (UUID)(string)requestData["region_uuid"];
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
if (!m_app.SceneManager.TryGetScene(region_uuid, out scene))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
}
else if (requestData.Contains("region_name"))
{
string region_name = (string)requestData["region_name"];
string region_name = (string) requestData["region_name"];
if (!m_app.SceneManager.TryGetScene(region_name, out scene))
throw new Exception(String.Format("failed to switch to region {0}", region_name));
}
@ -1193,29 +1235,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
foreach (string p in new string[] { "password", "filename" })
foreach (string p in new string[] {"password", "filename"})
{
if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p]))
if (String.IsNullOrEmpty((string) requestData[p]))
throw new Exception(String.Format("parameter {0} is empty"));
}
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
string filename = (string)requestData["filename"];
string filename = (string) requestData["filename"];
Scene scene = null;
if (requestData.Contains("region_uuid"))
{
UUID region_uuid = (UUID)(string)requestData["region_uuid"];
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
if (!m_app.SceneManager.TryGetScene(region_uuid, out scene))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
}
else if (requestData.Contains("region_name"))
{
string region_name = (string)requestData["region_name"];
string region_name = (string) requestData["region_name"];
if (!m_app.SceneManager.TryGetScene(region_name, out scene))
throw new Exception(String.Format("failed to switch to region {0}", region_name));
}
@ -1258,29 +1300,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
foreach (string p in new string[] { "password", "filename" })
foreach (string p in new string[] {"password", "filename"})
{
if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p]))
if (String.IsNullOrEmpty((string) requestData[p]))
throw new Exception(String.Format("parameter {0} is empty"));
}
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
string filename = (string)requestData["filename"];
string filename = (string) requestData["filename"];
if (requestData.Contains("region_uuid"))
{
UUID region_uuid = (UUID)(string)requestData["region_uuid"];
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
}
else if (requestData.Contains("region_name"))
{
string region_name = (string)requestData["region_name"];
string region_name = (string) requestData["region_name"];
if (!m_app.SceneManager.TrySetCurrentScene(region_name))
throw new Exception(String.Format("failed to switch to region {0}", region_name));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
@ -1292,7 +1334,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
string xml_version = "1";
if (requestData.Contains("xml_version"))
{
xml_version = (string)requestData["xml_version"];
xml_version = (string) requestData["xml_version"];
}
switch (xml_version)
@ -1337,32 +1379,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
foreach (string p in new string[] { "password", "filename" })
foreach (string p in new string[] {"password", "filename"})
{
if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p]))
if (String.IsNullOrEmpty((string) requestData[p]))
throw new Exception(String.Format("parameter {0} is empty"));
}
// check password
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
string filename = (string)requestData["filename"];
string filename = (string) requestData["filename"];
if (requestData.Contains("region_uuid"))
{
UUID region_uuid = (UUID)(string)requestData["region_uuid"];
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
}
else if (requestData.Contains("region_name"))
{
string region_name = (string)requestData["region_name"];
string region_name = (string) requestData["region_name"];
if (!m_app.SceneManager.TrySetCurrentScene(region_name))
throw new Exception(String.Format("failed to switch to region {0}", region_name));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
@ -1374,7 +1416,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
string xml_version = "1";
if (requestData.Contains("xml_version"))
{
xml_version = (string)requestData["xml_version"];
xml_version = (string) requestData["xml_version"];
}
switch (xml_version)
@ -1420,24 +1462,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
responseData["success"] = "true";
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable requestData = (Hashtable) request.Params[0];
// check completeness
if (!requestData.Contains("password"))
throw new Exception(String.Format("missing required parameter"));
if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
if (requestData.Contains("region_uuid"))
{
UUID region_uuid = (UUID)(string)requestData["region_uuid"];
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
}
else if (requestData.Contains("region_name"))
{
string region_name = (string)requestData["region_name"];
string region_name = (string) requestData["region_name"];
if (!m_app.SceneManager.TrySetCurrentScene(region_name))
throw new Exception(String.Format("failed to switch to region {0}", region_name));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);