public void UpdateRegionInfo(RegionInfo region) { RegionInfo oldRegion = GetRegionInfo(region.RegionID); if (oldRegion != null) { m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("RegionInfoChanged", new[] { oldRegion, region }); } Dictionary<string, object> row = new Dictionary<string, object>(4); row["RegionID"] = region.RegionID; row["RegionName"] = region.RegionName.MySqlEscape(50); row["RegionInfo"] = OSDParser.SerializeJsonString(region.PackRegionInfoData(true)); row["DisableD"] = region.Disabled ? 1 : 0; GD.Replace("simulator", row); }
public RegionManager(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement, RegionInfo startingRegionInfo) { _regionManager = regionManagement; _config = config; _startingRegionInfo = startingRegionInfo; RegionInfo = _startingRegionInfo; KillAfterRegionCreation = killWindowOnRegionCreation; _pageToStart = page; InitializeComponent(); ChangeRegionInfo(_startingRegionInfo); if (_startingRegionInfo == null) groupBox5.Visible = false; tabControl1.SelectedIndex = (int)_pageToStart; changeEstateBox.Visible = false; _timer.Interval = 100; _timer.Tick += m_timer_Tick; _timer.Start (); }
protected internal SceneGraph(IScene parent, RegionInfo regInfo) { Random random = new Random(); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (uint.MaxValue / 2)) + uint.MaxValue / 4; m_parentScene = parent; m_regInfo = regInfo; //Subscript to the scene events m_parentScene.EventManager.OnNewClient += SubscribeToClientEvents; m_parentScene.EventManager.OnClosingClient += UnSubscribeToClientEvents; IConfig aurorastartupConfig = parent.Config.Configs["AuroraStartup"]; if (aurorastartupConfig != null) { m_DefaultObjectName = aurorastartupConfig.GetString("DefaultObjectName", m_DefaultObjectName); EnableFakeRaycasting = aurorastartupConfig.GetBoolean("EnableFakeRaycasting", false); } }
/// <summary> /// Create a scene and its initial base structures. /// </summary> /// <param name = "regionInfo"></param> /// <param name = "proxyOffset"></param> /// <param name = "configSource"></param> /// <param name = "clientServer"> </param> /// <returns></returns> protected IScene SetupScene(RegionInfo regionInfo, IConfigSource configSource) { AgentCircuitManager circuitManager = new AgentCircuitManager(); List<IClientNetworkServer> clientServers = AuroraModuleLoader.PickupModules<IClientNetworkServer>(); List<IClientNetworkServer> allClientServers = new List<IClientNetworkServer>(); foreach (IClientNetworkServer clientServer in clientServers) { foreach (int port in regionInfo.UDPPorts) { IClientNetworkServer copy = clientServer.Copy(); copy.Initialise(port, m_configSource, circuitManager); allClientServers.Add(copy); } } Scene scene = new Scene(); scene.AddModuleInterfaces(m_openSimBase.ApplicationRegistry.GetInterfaces()); scene.Initialize(regionInfo, circuitManager, allClientServers); return scene; }
public void UpdateRegionInfo(RegionInfo region) { RegionInfo oldRegion = GetRegionInfo(region.RegionID); if (oldRegion != null) { m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("RegionInfoChanged", new[] { oldRegion, region }); } List<object> Values = new List<object> { region.RegionID, region.RegionName.MySqlEscape(50), OSDParser.SerializeJsonString(region.PackRegionInfoData(true)), region.Disabled ? 1 : 0 }; GD.Replace("simulator", new[]{"RegionID","RegionName", "RegionInfo","Disabled"}, Values.ToArray()); }
/// <summary> /// Get a physics scene for the given physics engine and mesher. /// </summary> /// <param name = "physEngineName"></param> /// <param name = "meshEngineName"></param> /// <param name = "config"></param> /// <returns></returns> public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, RegionInfo region, IRegistryCore registry) { if (String.IsNullOrEmpty(physEngineName)) { return new NullPhysicsScene(); } if (String.IsNullOrEmpty(meshEngineName)) { return new NullPhysicsScene(); } IMesher meshEngine = null; if (_MeshPlugins.ContainsKey(meshEngineName)) { MainConsole.Instance.Debug("[Physics]: Loading meshing engine: " + meshEngineName); meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); } else { MainConsole.Instance.WarnFormat("[Physics]: Couldn't find meshing engine: {0}", meshEngineName); throw new ArgumentException(String.Format("couldn't find meshing engine: {0}", meshEngineName)); } if (_PhysPlugins.ContainsKey(physEngineName)) { MainConsole.Instance.Debug("[Physics]: Loading physics engine: " + physEngineName); PhysicsScene result = _PhysPlugins[physEngineName].GetScene(region.RegionName); result.Initialise(meshEngine, region, registry); result.PostInitialise(config); return result; } else { MainConsole.Instance.WarnFormat("[Physics]: Couldn't find physics engine: {0}", physEngineName); throw new ArgumentException(String.Format("couldn't find physics engine: {0}", physEngineName)); } }
public void UpdateRegionInfo(string oldName, RegionInfo regionInfo) { IRegionInfoConnector connector = DataManager.RequestPlugin<IRegionInfoConnector>(); if (connector != null) { //Make sure we have this region in the database if (connector.GetRegionInfo(oldName) == null) return; RegionInfo copy = new RegionInfo(); //Make an exact copy copy.UnpackRegionInfoData(regionInfo.PackRegionInfoData(true)); //Fix the name of the region so we can delete the old one copy.RegionName = oldName; DeleteRegion(copy); //Now add the new one connector.UpdateRegionInfo(regionInfo); } }
// Initialize the mesh plugin public override void Initialise(IMesher meshmerizer, RegionInfo region, IRegistryCore registry) { mesher = meshmerizer; m_region = region; m_registry = registry; WorldExtents = new Vector2(region.RegionSizeX, region.RegionSizeY); }
public void DeleteRegion(RegionInfo regionInfo) { IRegionInfoConnector connector = DataManager.RequestPlugin<IRegionInfoConnector>(); if (connector != null) { connector.Delete(regionInfo); } }
public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type, IScene scene) { if (filePath.StartsWith("estate/")) { string estateData = Encoding.UTF8.GetString(data); EstateSettings settings = new EstateSettings(WebUtils.ParseXmlResponse(estateData)); scene.RegionInfo.EstateSettings = settings; } else if (filePath.StartsWith("regioninfo/")) { string m_merge = MainConsole.Instance.Prompt("Should we load the region information from the archive (region name, region position, etc)?", "false"); RegionInfo settings = new RegionInfo(); settings.UnpackRegionInfoData((OSDMap)OSDParser.DeserializeLLSDBinary(data)); if (m_merge == "false") { //Still load the region settings though scene.RegionInfo.RegionSettings = settings.RegionSettings; return; } settings.RegionSettings = scene.RegionInfo.RegionSettings; settings.EstateSettings = scene.RegionInfo.EstateSettings; scene.RegionInfo = settings; } }
/// <summary> /// Use the asset set information at path to load assets /// </summary> /// <param name = "path"></param> /// <param name = "assets"></param> protected void LoadLibraries(string iarFileName) { RegionInfo regInfo = new RegionInfo(); IScene m_MockScene = null; //Make the scene for the IAR loader if (m_registry is IScene) m_MockScene = (IScene)m_registry; else { m_MockScene = new Scene(); m_MockScene.Initialize(regInfo); m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces()); } UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner); //Make the user account for the default IAR if (uinfo == null) { MainConsole.Instance.Warn("Creating user " + m_service.LibraryOwnerName); m_MockScene.UserAccountService.CreateUser(m_service.LibraryOwner, UUID.Zero, m_service.LibraryOwnerName, "", ""); uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner); m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false); } if (m_MockScene.InventoryService.GetRootFolder(m_service.LibraryOwner) == null) m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false); List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetFolderFolders(uinfo.PrincipalID, UUID.Zero); #if (!ISWIN) bool alreadyExists = false; foreach (InventoryFolderBase folder in rootFolders) { if (folder.Name == iarFileName) { alreadyExists = true; break; } } #else bool alreadyExists = rootFolders.Any(folder => folder.Name == iarFileName); #endif if (alreadyExists) { MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Found previously loaded iar file {0}, ignoring.", iarFileName); return; } MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Loading iar file {0}", iarFileName); InventoryFolderBase rootFolder = m_MockScene.InventoryService.GetRootFolder(uinfo.PrincipalID); if (null == rootFolder) { //We need to create the root folder, otherwise the IAR freaks m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false); } InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false, m_service.LibraryOwner); try { archread.ReplaceAssets = true;//Replace any old assets List<InventoryNodeBase> nodes = new List<InventoryNodeBase>(archread.Execute(true)); if (nodes.Count == 0) return; InventoryFolderBase f = (InventoryFolderBase)nodes[0]; UUID IARRootID = f.ID; TraverseFolders(IARRootID, m_MockScene); FixParent(IARRootID, m_MockScene, m_service.LibraryRootFolderID); f.Name = iarFileName; f.ParentID = UUID.Zero; f.ID = m_service.LibraryRootFolderID; f.Type = (int)AssetType.RootFolder; f.Version = 1; m_MockScene.InventoryService.UpdateFolder(f); } catch (Exception e) { MainConsole.Instance.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.StackTrace); } finally { archread.Close(); } }
private int RegionInfoStartupSorter(RegionInfo A, RegionInfo B) { return A.NumberStartup.CompareTo(B.NumberStartup); }
public RegionInfo GetRegionInfo(string regionName) { QueryFilter filter = new QueryFilter(); filter.andFilters["RegionName"] = regionName.MySqlEscape(50); List<string> RetVal = GD.Query(new[] { "RegionInfo" }, "simulator", filter, null, null, null); if (RetVal.Count == 0) { return null; } RegionInfo replyData = new RegionInfo(); replyData.UnpackRegionInfoData((OSDMap)OSDParser.DeserializeJson(RetVal[0])); return replyData; }
private Bitmap FixVariableSizedRegionTerrainSize(RegionInfo region, Bitmap image) { if(region.RegionSizeX == Constants.RegionSize && region.RegionSizeY == Constants.RegionSize) return image; Bitmap destImage = new Bitmap(region.RegionSizeX, region.RegionSizeY); using (TextureBrush brush = new TextureBrush(image, WrapMode.Tile)) using (Graphics g = Graphics.FromImage(destImage)) { // do your painting in here g.FillRectangle(brush, 0, 0, destImage.Width, destImage.Height); } image.Dispose(); return destImage; }
private void ChangeRegionInfo (RegionInfo region) { m_changingRegion = true; if (region == null) { button20.Enabled = false; CurrentRegionID = UUID.Zero; m_changingRegion = false; textBox11.Text = ""; textBox6.Text = ""; textBox4.Text = ""; DisabledEdit.Checked = false; textBox7.Text = ""; textBox3.Text = ""; textBox5.Text = ""; textBox1.Text = ""; RegionSizeX.Text = ""; RegionSizeY.Text = ""; startupType.SelectedIndex = 0; einfiniteRegion.Checked = false; return; } button20.Enabled = true; CurrentRegionID = region.RegionID; textBox11.Text = region.RegionType; textBox6.Text = region.ObjectCapacity.ToString (); uint maturityLevel = Util.ConvertAccessLevelToMaturity (region.AccessLevel); if (maturityLevel == 0) textBox4.Text = "PG"; else if (maturityLevel == 1) textBox4.Text = "Mature"; else textBox4.Text = "Adult"; DisabledEdit.Checked = region.Disabled; #if (!ISWIN) textBox7.Text = string.Join(", ", region.UDPPorts.ConvertAll<string>(delegate(int i) { return i.ToString(); }).ToArray()); #else textBox7.Text = string.Join (", ", region.UDPPorts.ConvertAll (i => i.ToString()).ToArray ()); #endif textBox3.Text = (region.RegionLocX / Constants.RegionSize).ToString (); textBox5.Text = (region.RegionLocY / Constants.RegionSize).ToString (); textBox1.Text = region.RegionName; RegionSizeX.Text = region.RegionSizeX.ToString (); RegionSizeY.Text = region.RegionSizeY.ToString (); startupType.SelectedIndex = ConvertStartupType (region.Startup); einfiniteRegion.Checked = region.InfiniteRegion; IScene scene; if (m_sceneManager.TryGetScene (region.RegionID, out scene)) SetOnlineStatus (); else SetOfflineStatus (); m_changingRegion = false; }
/// <summary> /// This deletes the region from the region.ini file or region.xml file and removes the file if there are no other regions in the file /// </summary> /// <param name="regionInfo"></param> public void DeleteRegion(RegionInfo regionInfo) { if (!String.IsNullOrEmpty(regionInfo.RegionFile)) { if (regionInfo.RegionFile.ToLower().EndsWith(".xml")) { File.Delete(regionInfo.RegionFile); MainConsole.Instance.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", regionInfo.RegionFile); } if (regionInfo.RegionFile.ToLower().EndsWith(".ini")) { try { IniConfigSource source = new IniConfigSource(regionInfo.RegionFile, Nini.Ini.IniFileType.AuroraStyle); if (source.Configs[regionInfo.RegionName] != null) { source.Configs.Remove(regionInfo.RegionName); if (source.Configs.Count == 0) { File.Delete(regionInfo.RegionFile); } else { source.Save(regionInfo.RegionFile); } } } catch (Exception) { } } } }
private void CreateNewRegion(object sender, EventArgs e) { if (RName.Text == "") { MessageBox.Show("You must enter a region name!"); return; } RegionInfo region = new RegionInfo { RegionName = RName.Text, RegionID = UUID.Random(), RegionLocX = int.Parse(LocX.Text)*Constants.RegionSize, RegionLocY = int.Parse(LocY.Text)*Constants.RegionSize }; IPAddress address = IPAddress.Parse("0.0.0.0"); string[] ports = Port.Text.Split (','); foreach (string port in ports) { string tPort = port.Trim (); int iPort = 0; if (int.TryParse (tPort, out iPort)) region.UDPPorts.Add (iPort); } region.InternalEndPoint = new IPEndPoint (address, region.UDPPorts[0]); region.RegionType = Type.Text; region.ObjectCapacity = int.Parse(ObjectCount.Text); int maturityLevel = 0; if (!int.TryParse(Maturity.Text, out maturityLevel)) { if (Maturity.Text == "Adult") maturityLevel = 2; else if (Maturity.Text == "Mature") maturityLevel = 1; else //Leave it as PG by default if they do not select a valid option maturityLevel = 0; } region.RegionSettings.Maturity = maturityLevel; region.Disabled = DisabledEdit.Checked; region.RegionSizeX = int.Parse(CRegionSizeX.Text); region.RegionSizeY = int.Parse(CRegionSizeY.Text); if ((region.RegionSizeX % Constants.MinRegionSize) != 0 || (region.RegionSizeY % Constants.MinRegionSize) != 0) { MessageBox.Show ("You must enter a valid region size (multiple of " + Constants.MinRegionSize + "!"); return; } region.Startup = ConvertIntToStartupType(CStartupType.SelectedIndex); region.InfiniteRegion = cInfiniteRegion.Checked; _regionManager.UpdateRegionInfo(region); CopyOverDefaultRegion (region.RegionName); MessageBox.Show("You must now set up an estate for the new region"); RefreshCurrentRegions(); tabControl1.SelectedIndex = 2; estateRegionSelection.SelectedItem = region.RegionName; RegionHasBeenCreated = true; RegionCreatedID = region.RegionID; }
/// <summary> /// Save the changes to the RegionInfo to the file that it came from in the Regions/ directory /// </summary> /// <param name="oldName"></param> /// <param name="regionInfo"></param> public void UpdateRegionInfo(string oldName, RegionInfo regionInfo) { string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); if (oldName == "") oldName = regionInfo.RegionName; try { IConfig config = m_configSource.Configs["RegionStartup"]; if (config != null) { regionConfigPath = config.GetString("RegionsDirectory", regionConfigPath).Trim(); } } catch (Exception) { // No INI setting recorded. } if (!Directory.Exists(regionConfigPath)) return; string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); foreach (string file in iniFiles) { IConfigSource source = new IniConfigSource(file, Nini.Ini.IniFileType.AuroraStyle); IConfig cnf = source.Configs[oldName]; if (cnf != null) { try { source.Configs.Remove(cnf); cnf.Set("Location", regionInfo.RegionLocX / Constants.RegionSize + "," + regionInfo.RegionLocY / Constants.RegionSize); cnf.Set("RegionType", regionInfo.RegionType); cnf.Name = regionInfo.RegionName; source.Configs.Add(cnf); } catch { } source.Save(); break; } } }
//Returns true if the source should be updated. Returns false if it does not. public bool ReadNiniConfig(RegionInfo region, IConfigSource source, string name) { // bool creatingNew = false; if (name == String.Empty || source.Configs.Count == 0) { MainConsole.Instance.Info ("=====================================\n"); MainConsole.Instance.Info ("We are now going to ask a couple of questions about your region.\n"); MainConsole.Instance.Info ("You can press 'enter' without typing anything to use the default\n"); MainConsole.Instance.Info ("the default is displayed between [ ] brackets.\n"); MainConsole.Instance.Info ("=====================================\n"); } bool NeedsUpdate = false; if (name == String.Empty) name = MainConsole.Instance.Prompt("New region name", name); if (name == String.Empty) throw new Exception("Cannot interactively create region with no name"); if (source.Configs.Count == 0) { source.AddConfig(name); // creatingNew = true; NeedsUpdate = true; } if (source.Configs[name] == null) { source.AddConfig(name); NeedsUpdate = true; // creatingNew = true; } IConfig config = source.Configs[name]; // UUID // string regionUUID = config.GetString("RegionUUID", string.Empty); if (regionUUID == String.Empty) { NeedsUpdate = true; UUID newID = UUID.Random(); regionUUID = MainConsole.Instance.Prompt("Region UUID for region " + name, newID.ToString()); config.Set("RegionUUID", regionUUID); } region.RegionID = new UUID(regionUUID); region.RegionName = name; string location = config.GetString("Location", String.Empty); if (location == String.Empty) { NeedsUpdate = true; location = MainConsole.Instance.Prompt("Region Location for region " + name, "1000,1000"); config.Set("Location", location); } string[] locationElements = location.Split(new[] { ',' }); region.RegionLocX = Convert.ToInt32(locationElements[0]) * Constants.RegionSize; region.RegionLocY = Convert.ToInt32(locationElements[1]) * Constants.RegionSize; int regionSizeX = config.GetInt("RegionSizeX", 0); if (regionSizeX == 0 || ((region.RegionSizeX % Constants.MinRegionSize) != 0)) { NeedsUpdate = true; while (true) { if (int.TryParse(MainConsole.Instance.Prompt("Region X Size for region " + name, "256"), out regionSizeX)) break; } config.Set("RegionSizeX", regionSizeX); } region.RegionSizeX = Convert.ToInt32(regionSizeX); int regionSizeY = config.GetInt("RegionSizeY", 0); if (regionSizeY == 0 || ((region.RegionSizeY % Constants.MinRegionSize) != 0)) { NeedsUpdate = true; while(true) { if(int.TryParse(MainConsole.Instance.Prompt("Region Y Size for region " + name, "256"), out regionSizeY)) break; } config.Set("RegionSizeY", regionSizeY); } region.RegionSizeY = regionSizeY; int regionSizeZ = config.GetInt("RegionSizeZ", 1024); //if (regionSizeZ == String.Empty) //{ // NeedsUpdate = true; // regionSizeZ = MainConsole.Instance.CmdPrompt("Region Z Size for region " + name, "1024"); // config.Set("RegionSizeZ", regionSizeZ); //} region.RegionSizeZ = regionSizeZ; // Internal IP IPAddress address; if (config.Contains("InternalAddress")) { address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); } else { NeedsUpdate = true; address = IPAddress.Parse(MainConsole.Instance.Prompt("Internal IP address for region " + name, "0.0.0.0")); config.Set("InternalAddress", address.ToString()); } int port; if (config.Contains("InternalPort")) { port = config.GetInt("InternalPort", 9000); } else { NeedsUpdate = true; port = Convert.ToInt32(MainConsole.Instance.Prompt("Internal port for region " + name, "9000")); config.Set("InternalPort", port); } region.UDPPorts.Add (port); region.InternalEndPoint = new IPEndPoint(address, port); // External IP // string externalName; if (config.Contains("ExternalHostName")) { //Let's know our external IP (by Enrico Nirvana) externalName = config.GetString("ExternalHostName", Aurora.Framework.Utilities.GetExternalIp()); } else { NeedsUpdate = true; //Let's know our external IP (by Enrico Nirvana) externalName = MainConsole.Instance.Prompt("External host name for region " + name, Aurora.Framework.Utilities.GetExternalIp()); config.Set("ExternalHostName", externalName); //ended here (by Enrico Nirvana) } region.RegionType = config.GetString("RegionType", region.RegionType); if (region.RegionType == String.Empty) { NeedsUpdate = true; region.RegionType = MainConsole.Instance.Prompt("Region Type for region " + name, "Mainland"); config.Set("RegionType", region.RegionType); } region.AllowPhysicalPrims = config.GetBoolean("AllowPhysicalPrims", region.AllowPhysicalPrims); region.AllowScriptCrossing = config.GetBoolean("AllowScriptCrossing", region.AllowScriptCrossing); region.TrustBinariesFromForeignSims = config.GetBoolean("TrustBinariesFromForeignSims", region.TrustBinariesFromForeignSims); region.SeeIntoThisSimFromNeighbor = config.GetBoolean("SeeIntoThisSimFromNeighbor", region.SeeIntoThisSimFromNeighbor); region.ObjectCapacity = config.GetInt ("MaxPrims", region.ObjectCapacity); region.Startup = (StartupType)Enum.Parse(typeof(StartupType), config.GetString ("StartupType", region.Startup.ToString())); // Multi-tenancy // region.ScopeID = new UUID(config.GetString("ScopeID", region.ScopeID.ToString())); //Do this last so that we can save the password immediately if it doesn't exist UUID password = region.Password; //Save the pass as this TryParse will wipe it out if (!UUID.TryParse(config.GetString("NeighborPassword", ""), out region.Password)) { region.Password = password; config.Set("NeighborPassword", password); region.WriteNiniConfig(source); } return NeedsUpdate; }
// File based loading // public RegionInfo LoadRegionFromFile(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName) { // m_configSource = configSource; RegionInfo region = new RegionInfo(); if (filename.ToLower().EndsWith(".ini")) { if (!File.Exists(filename)) // New region config request { IniConfigSource newFile = new IniConfigSource(); region.RegionFile = filename; ReadNiniConfig(region, newFile, configName); newFile.Save(filename); return region; } IniConfigSource m_source = new IniConfigSource(filename, Nini.Ini.IniFileType.AuroraStyle); bool saveFile = false; if (m_source.Configs[configName] == null) saveFile = true; region.RegionFile = filename; bool update = ReadNiniConfig(region, m_source, configName); if (configName != String.Empty && (saveFile || update)) m_source.Save(filename); return region; } try { // This will throw if it's not legal Nini XML format // and thereby toss it to the legacy loader // IConfigSource xmlsource = new XmlConfigSource(filename); ReadNiniConfig(region, xmlsource, configName); region.RegionFile = filename; return region; } catch (Exception) { } return null; }
public override void Initialise(IMesher meshmerizer, RegionInfo region, IRegistryCore registry) { m_region = region; }
public void Initialize (RegionInfo regionInfo) { m_regInfo = regionInfo; }
public RegionInfo[] GetRegionInfos(bool nonDisabledOnly) { QueryFilter filter = new QueryFilter(); if (nonDisabledOnly) { filter.andFilters["Disabled"] = 0; } List<string> RetVal = GD.Query(new[] { "RegionInfo" }, "simulator", filter, null, null, null); if (RetVal.Count == 0) { return new RegionInfo[]{}; } List<RegionInfo> Infos = new List<RegionInfo>(); foreach (string t in RetVal) { RegionInfo replyData = new RegionInfo(); replyData.UnpackRegionInfoData((OSDMap)OSDParser.DeserializeJson(t)); Infos.Add(replyData); } //Sort by startup number Infos.Sort(RegionInfoStartupSorter); return Infos.ToArray(); }
public void UpdateRegionInfo(RegionInfo region) { InternalDoRemote(region); if (m_doRemoteOnly) return; _regionInfoConnector.UpdateRegionInfo(region); }
public void Delete(RegionInfo region) { QueryFilter filter = new QueryFilter(); filter.andFilters["RegionID"] = region.RegionID; GD.Delete("simulator", filter); }
/// <summary> /// Create a new region. /// <summary> /// <param name="request">incoming XML RPC request</param> /// <remarks> /// XmlRpcCreateRegionMethod takes the following XMLRPC /// parameters /// <list type="table"> /// <listheader><term>parameter name</term><description>description</description></listheader> /// <item><term>password</term> /// <description>admin password as set in Aurora.ini</description></item> /// <item><term>region_name</term> /// <description>desired region name</description></item> /// <item><term>region_id</term> /// <description>(optional) desired region UUID</description></item> /// <item><term>region_x</term> /// <description>desired region X coordinate (integer)</description></item> /// <item><term>region_y</term> /// <description>desired region Y coordinate (integer)</description></item> /// <item><term>estate_owner_first</term> /// <description>firstname of estate owner (formerly region master) /// (required if new estate is being created, optional otherwise)</description></item> /// <item><term>estate_owner_last</term> /// <description>lastname of estate owner (formerly region master) /// (required if new estate is being created, optional otherwise)</description></item> /// <item><term>estate_owner_uuid</term> /// <description>explicit UUID to use for estate owner (optional)</description></item> /// <item><term>listen_ip</term> /// <description>internal IP address (dotted quad)</description></item> /// <item><term>listen_port</term> /// <description>internal port (integer)</description></item> /// <item><term>external_address</term> /// <description>external IP address</description></item> /// <item><term>persist</term> /// <description>if true, persist the region info /// ('true' or 'false')</description></item> /// <item><term>public</term> /// <description>if true, the region is public /// ('true' or 'false') (optional, default: true)</description></item> /// <item><term>enable_voice</term> /// <description>if true, enable voice on all parcels, /// ('true' or 'false') (optional, default: false)</description></item> /// <item><term>estate_name</term> /// <description>the name of the estate to join (or to create if it doesn't /// already exist)</description></item> /// <item><term>region_file</term> /// <description>The name of the file to persist the region specifications to. /// If omitted, the region_file_template setting from Aurora.ini will be used. (optional)</description></item> /// </list> /// /// XmlRpcCreateRegionMethod returns /// <list type="table"> /// <listheader><term>name</term><description>description</description></listheader> /// <item><term>success</term> /// <description>true or false</description></item> /// <item><term>error</term> /// <description>error message if success is false</description></item> /// <item><term>region_uuid</term> /// <description>UUID of the newly created region</description></item> /// <item><term>region_name</term> /// <description>name of the newly created region</description></item> /// </list> /// </remarks> public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) { MainConsole.Instance.Info("[RADMIN]: CreateRegion: new request"); FailIfRemoteAdminDisabled("CreateRegion"); XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); lock (m_requestLock) { int m_regionLimit = m_config.GetInt("region_limit", 0); bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false); bool m_publicAccess = m_config.GetBoolean("create_region_public", true); try { Hashtable requestData = (Hashtable)request.Params[0]; CheckStringParameters(request, new[] { "password", "region_name", "listen_ip", "external_address", "estate_name" }); CheckIntegerParams(request, new[] { "region_x", "region_y", "listen_port" }); // check password if (!String.IsNullOrEmpty(m_requiredPassword) && (string)requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); // check whether we still have space left (iff we are using limits) if (m_regionLimit != 0 && manager.Scenes.Count >= m_regionLimit) throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", m_regionLimit)); // extract or generate region ID now IScene scene = null; UUID regionID = UUID.Zero; if (requestData.ContainsKey("region_id") && !String.IsNullOrEmpty((string)requestData["region_id"])) { regionID = (UUID)(string)requestData["region_id"]; if (manager.TryGetScene(regionID, out scene)) 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 / Constants.RegionSize, scene.RegionInfo.RegionLocY / Constants.RegionSize)); } else { regionID = UUID.Random(); MainConsole.Instance.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID); } // create volatile or persistent region info RegionInfo region = new RegionInfo { RegionID = regionID, RegionName = (string) requestData["region_name"], RegionLocX = Convert.ToInt32(requestData["region_x"])*Constants.RegionSize, RegionLocY = Convert.ToInt32(requestData["region_y"])*Constants.RegionSize }; // check for collisions: region name, region UUID, // region location if (manager.TryGetScene(region.RegionName, out scene)) throw new Exception( String.Format("region name already in use by region {0}", scene)); if (manager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) throw new Exception( String.Format("region location <{0},{1}> already in use by region {2}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize, scene)); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0) {Port = Convert.ToInt32(requestData["listen_port"])}; if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); // default place for region configuration files is in the // Regions directory of the config dir (aka /bin) string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); try { // Aurora.ini can specify a different regions dir IConfig config = m_configSource.Configs["RegionStartup"]; if (config != null) { regionConfigPath = config.GetString("RegionsDirectory", regionConfigPath).Trim(); } } catch (Exception) { // No INI setting recorded. } string regionIniPath; if (requestData.Contains("region_file")) { // Make sure that the file to be created is in a subdirectory of the region storage directory. string requestedFilePath = Path.Combine(regionConfigPath, (string)requestData["region_file"]); string requestedDirectory = Path.GetDirectoryName(Util.BasePathCombine(requestedFilePath)); if (requestedDirectory != null && requestedDirectory.StartsWith(Util.BasePathCombine(regionConfigPath))) regionIniPath = requestedFilePath; else throw new Exception("Invalid location for region file."); } else { regionIniPath = Path.Combine(regionConfigPath, String.Format( m_config.GetString("region_file_template", "{0}x{1}-{2}.ini"), (region.RegionLocX / Constants.RegionSize).ToString(), (region.RegionLocY / Constants.RegionSize).ToString(), regionID.ToString(), region.InternalEndPoint.Port.ToString(), region.RegionName.Replace(" ", "_").Replace(":", "_"). Replace("/", "_"))); } MainConsole.Instance.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", region.RegionID, regionIniPath); region.SaveRegionToFile("dynamic region", regionIniPath); // Set the estate // Check for an existing estate Aurora.Framework.IEstateConnector estateService = Aurora.DataManager.DataManager.RequestPlugin<Aurora.Framework.IEstateConnector>(); if (estateService == null) throw new Exception("No estate service available."); UUID userID = UUID.Zero; if (requestData.ContainsKey("estate_owner_uuid")) { // ok, client wants us to use an explicit UUID // regardless of what the avatar name provided userID = new UUID((string)requestData["estate_owner_uuid"]); } else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last")) { // We need to look up the UUID for the avatar with the provided name. string ownerFirst = (string)requestData["estate_owner_first"]; string ownerLast = (string)requestData["estate_owner_last"]; IScene currentOrFirst = manager.CurrentOrFirstScene; IUserAccountService accountService = currentOrFirst.UserAccountService; UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, ownerFirst, ownerLast); userID = user.PrincipalID; } else { throw new Exception("Estate owner details not provided."); } int estateID = estateService.GetEstate(userID, (string)requestData["estate_name"]); if (estateID != 0) { // Create a new estate with the name provided //region.EstateSettings = estateService.LoadEstateSettings(region.RegionID); region.EstateSettings.EstateName = (string)requestData["estate_name"]; region.EstateSettings.EstateOwner = userID; // Persistence does not seem to effect the need to save a new estate region.EstateSettings.Save(); } // Create the region and perform any initial initialization IScene newScene = manager.StartNewRegion(region); // If an access specification was provided, use it. // Otherwise accept the default. newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); newScene.RegionInfo.EstateSettings.Save(); // enable voice on newly created region if // requested by either the XmlRpc request or the // configuration if (GetBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions)) { IParcelManagementModule parcelManagement = newScene.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { List<ILandObject> parcels = parcelManagement.AllParcels(); foreach (ILandObject parcel in parcels) { parcel.LandData.Flags |= (uint)ParcelFlags.AllowVoiceChat; parcel.LandData.Flags |= (uint)ParcelFlags.UseEstateVoiceChan; parcelManagement.UpdateLandObject(parcel); } } } responseData["success"] = true; responseData["region_name"] = region.RegionName; responseData["region_uuid"] = region.RegionID.ToString(); response.Value = responseData; } catch (Exception e) { MainConsole.Instance.ErrorFormat("[RADMIN] CreateRegion: failed {0}", e.Message); MainConsole.Instance.DebugFormat("[RADMIN] CreateRegion: failed {0}", e); responseData["success"] = false; responseData["error"] = e.Message; response.Value = responseData; } MainConsole.Instance.Info("[RADMIN]: CreateRegion: request complete"); return response; } }
private void CreateNewRegion(object sender, EventArgs e) { if (RName.Text == "") { MessageBox.Show("You must enter a region name!"); return; } RegionInfo region = new RegionInfo { RegionName = RName.Text, RegionID = UUID.Random(), RegionLocX = int.Parse(LocX.Text)*Constants.RegionSize, RegionLocY = int.Parse(LocY.Text)*Constants.RegionSize }; IPAddress address = IPAddress.Parse("0.0.0.0"); string[] ports = Port.Text.Split (','); foreach (string port in ports) { string tPort = port.Trim (); int iPort = 0; if (int.TryParse (tPort, out iPort)) region.UDPPorts.Add (iPort); } region.InternalEndPoint = new IPEndPoint (address, region.UDPPorts[0]); region.RegionType = Type.Text; region.ObjectCapacity = int.Parse(ObjectCount.Text); int maturityLevel = 0; if (!int.TryParse(Maturity.Text, out maturityLevel)) { if (Maturity.Text == "Adult") maturityLevel = 2; else if (Maturity.Text == "Mature") maturityLevel = 1; else //Leave it as PG by default if they do not select a valid option maturityLevel = 0; } region.RegionSettings.Maturity = maturityLevel; region.Disabled = DisabledEdit.Checked; region.RegionSizeX = int.Parse(CRegionSizeX.Text); region.RegionSizeY = int.Parse(CRegionSizeY.Text); if ((region.RegionSizeX % Constants.MinRegionSize) != 0 || (region.RegionSizeY % Constants.MinRegionSize) != 0) { MessageBox.Show ("You must enter a valid region size (multiple of " + Constants.MinRegionSize + "!"); return; } region.NumberStartup = int.Parse (CStartNum.Text); region.Startup = ConvertIntToStartupType(CStartupType.SelectedIndex); region.InfiniteRegion = cInfiniteRegion.Checked; m_connector.UpdateRegionInfo(region); CopyOverDefaultRegion (region.RegionName); if (KillAfterRegionCreation) { Application.Exit(); return; } MainConsole.Instance.Info("[LOADREGIONS]: Creating Region: " + region.RegionName + ")"); SceneManager manager = m_OpenSimBase.ApplicationRegistry.RequestModuleInterface<SceneManager>(); manager.AllRegions++; manager.StartNewRegion(region); RefreshCurrentRegions(); }
public void Initialize (RegionInfo regionInfo, AgentCircuitManager authen, List<IClientNetworkServer> clientServers) { Initialize (regionInfo); //Set up the clientServer m_clientServers = clientServers; foreach (IClientNetworkServer clientServer in clientServers) { clientServer.AddScene (this); } m_sceneManager = RequestModuleInterface<SceneManager> (); m_simDataStore = m_sceneManager.GetNewSimulationDataStore (); m_config = m_sceneManager.ConfigSource; m_authenticateHandler = authen; m_AuroraEventManager = new AuroraEventManager(); m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); // Load region settings m_regInfo.RegionSettings = Aurora.DataManager.DataManager.RequestPlugin<IRegionInfoConnector> ().LoadRegionSettings (m_regInfo.RegionID); m_sceneGraph = new SceneGraph(this, m_regInfo) {Entities = new AsyncEntityManager(this)}; #region Region Config IConfig aurorastartupConfig = m_config.Configs["AuroraStartup"]; if (aurorastartupConfig != null) { //Region specific is still honored here, the RegionInfo checks for it, and if it is 0, it didn't set it if(RegionInfo.ObjectCapacity == 0) RegionInfo.ObjectCapacity = aurorastartupConfig.GetInt("ObjectCapacity", 80000); } IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } #endregion Region Config m_basesimfps = 45f; m_basesimphysfps = 45f; m_basesimphysfps = Config.Configs["Physics"].GetFloat("BasePhysicsFPS", 45f); if (m_basesimphysfps > 45f) m_basesimphysfps = 45f; m_basesimfps = Config.Configs["Protection"].GetFloat("BaseRateFramesPerSecond", 45f); if (m_basesimfps > 45f) m_basesimfps = 45f; if (m_basesimphysfps > m_basesimfps) m_basesimphysfps = m_basesimfps; m_updatetimespan = 1000 / m_basesimfps; m_physicstimespan = 1000 / m_basesimphysfps; #region Startup Complete config EventManager.OnAddToStartupQueue += AddToStartupQueue; EventManager.OnModuleFinishedStartup += FinishedStartup; //EventManager.OnStartupComplete += StartupComplete; AddToStartupQueue("Startup"); #endregion }
private GridRegion BuildGridRegion(RegionInfo regionInfo) { GridRegion region = new GridRegion(regionInfo); OSDMap map = new OSDMap(); foreach (KeyValuePair<string, string> kvp in genericInfo) { map[kvp.Key] = kvp.Value; } region.GenericMap = map; return region; }
public void StartRegion(RegionInfo region) { InternalDoRemote(region); if (m_doRemoteOnly) return; _sceneManager.AllRegions++; Util.FireAndForget(delegate(object o) { _sceneManager.StartNewRegion(region); }); }