Ejemplo n.º 1
0
        /// <summary>
        /// Save the database configs
        /// </summary>
        /// <param name="regionInfo"></param>
        private void SaveChangesDatabase(RegionInfo regionInfo)
        {
            IRegionInfoConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IRegionInfoConnector>();

            if (connector != null)
            {
                connector.UpdateRegionInfo(regionInfo);
            }
        }
        public void UpdateRegionInfo(RegionInfo region)
        {
            InternalDoRemote(region);
            if (m_doRemoteOnly)
            {
                return;
            }

            _regionInfoConnector.UpdateRegionInfo(region);
        }
Ejemplo n.º 3
0
        public void UpdateRegionInfo(string oldName, RegionInfo regionInfo)
        {
            IRegionInfoConnector connector = Aurora.DataManager.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);
            }
        }
Ejemplo n.º 4
0
        private void FindOldRegionFiles()
        {
            try
            {
                //Load the file loader and set it up and make sure that we pull any regions from it
                RegionLoaderFileSystem system = new RegionLoaderFileSystem();
                system.Initialise(m_configSource, m_openSim);
                RegionInfo[] regionsToConvert = system.LoadRegions();
                if (regionsToConvert == null)
                {
                    return;
                }

                //Now load all the regions into the database
                IRegionInfoConnector conn = DataManager.RequestPlugin <IRegionInfoConnector>();
                foreach (RegionInfo info in regionsToConvert)
                {
                    conn.UpdateRegionInfo(info);
                }

                //Make sure all the regions got saved
                bool foundAll = true;
                foreach (RegionInfo info in regionsToConvert)
                {
                    if (conn.GetRegionInfo(info.RegionID) == null)
                    {
                        foundAll = false;
                    }
                }
                //Something went really wrong here... so lets not destroy anything
                if (foundAll && regionsToConvert.Length != 0)
                {
                    MessageBox.Show("All region .ini and .xml files have been successfully converted to the new region loader style.");
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 5
0
        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();
        }
        private void FindOldRegionFiles()
        {
            try
            {
                //Load the file loader and set it up and make sure that we pull any regions from it
                RegionLoaderFileSystem system = new RegionLoaderFileSystem();
                system.Initialise(m_configSource, m_openSim);
                RegionInfo[] regionsToConvert = system.InternalLoadRegions(true);
                if (regionsToConvert == null)
                {
                    return;
                }

                bool changed = false;
                //Now load all the regions into the database
                IRegionInfoConnector conn = DataManager.RequestPlugin <IRegionInfoConnector>();
                foreach (RegionInfo info in regionsToConvert)
                {
                    RegionInfo alreadyExists;
                    if ((alreadyExists = conn.GetRegionInfo(info.RegionID)) == null)
                    {
                        changed = true;
                        if (!info.UDPPorts.Contains(info.InternalEndPoint.Port))
                        {
                            info.UDPPorts.Add(info.InternalEndPoint.Port);
                        }
                        info.Disabled = false;
                        conn.UpdateRegionInfo(info);
                    }
                    else
                    {
                        //Update some atributes...
                        alreadyExists.RegionName  = info.RegionName;
                        alreadyExists.RegionLocX  = info.RegionLocX;
                        alreadyExists.RegionLocY  = info.RegionLocY;
                        alreadyExists.RegionSizeX = info.RegionSizeX;
                        alreadyExists.RegionSizeY = info.RegionSizeY;
                        alreadyExists.Disabled    = false;
                        if (!alreadyExists.UDPPorts.Contains(info.InternalEndPoint.Port))
                        {
                            alreadyExists.UDPPorts.Add(info.InternalEndPoint.Port);
                        }
                        conn.UpdateRegionInfo(alreadyExists);
                    }
                }

                //Make sure all the regions got saved
                bool foundAll = true;
                foreach (RegionInfo info in regionsToConvert)
                {
                    if (conn.GetRegionInfo(info.RegionID) == null)
                    {
                        foundAll = false;
                    }
                }
                //We found some new ones, they are all loaded
                if (foundAll && regionsToConvert.Length != 0 && changed)
                {
                    try
                    {
                        MessageBox.Show("All region .ini and .xml files have been successfully converted to the new region loader style.");
                        MessageBox.Show("To change your region settings, type 'open region manager' on the console, and a GUI will pop up for you to use.");
                        DialogResult t = Utilities.InputBox("Remove .ini files", "Do you want to remove your old .ini files?");
                        if (t == DialogResult.OK)
                        {
                            system.DeleteAllRegionFiles();
                        }
                    }
                    catch
                    {
                        //For people who only have consoles, no winforms
                        MainConsole.Instance.Output("All region .ini and .xml files have been successfully converted to the new region loader style.");
                        MainConsole.Instance.Output("To change your region settings, well, you don't have Mono-Winforms installed. Get that, stick with just modifying the .ini files, or get something to modify the region database that isn't a GUI.");
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 7
0
        private void CreateNewRegion(object sender, EventArgs e)
        {
            if (RName.Text == "")
            {
                MessageBox.Show("You must enter a region name!");
                return;
            }
            RegionInfo region = new RegionInfo();

            region.RegionName = RName.Text;
            region.RegionID   = UUID.Random();
            region.RegionLocX = int.Parse(LocX.Text) * Constants.RegionSize;
            region.RegionLocY = int.Parse(LocY.Text) * Constants.RegionSize;

            IPAddress address = IPAddress.Parse("0.0.0.0");
            int       port    = Convert.ToInt32(Port.Text);

            region.InternalEndPoint = new IPEndPoint(address, port);

            string externalName = ExternalIP.Text;

            if (externalName == "DEFAULT")
            {
                externalName = Aurora.Framework.Utilities.GetExternalIp();
                region.FindExternalAutomatically = true;
            }
            else
            {
                region.FindExternalAutomatically = false;
            }
            region.ExternalHostName = externalName;

            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);

            m_connector.UpdateRegionInfo(region);
            if (KillAfterRegionCreation)
            {
                System.Windows.Forms.Application.Exit();
                return;
            }
            else
            {
                IScene scene;
                m_log.Info("[LOADREGIONS]: Creating Region: " + region.RegionName + ")");
                SceneManager manager = m_OpenSimBase.ApplicationRegistry.RequestModuleInterface <SceneManager>();
                manager.CreateRegion(region, out scene);
            }
            RefreshCurrentRegions();
        }