diff options
author | Melanie Thielker | 2009-06-26 11:32:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-06-26 11:32:36 +0000 |
commit | febd54499b5decd9cb58191ead5695b6fab247c8 (patch) | |
tree | 54c48023e13b0a300e905137cb46c597a349bd88 /OpenSim/Framework | |
parent | Make delete-region delete the section from an ini file. Will delete the whole (diff) | |
download | opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.zip opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.tar.gz opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.tar.bz2 opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.tar.xz |
Enable the RemoteAdmin module to save regions as ini files rather than XML
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 504b303..7ac1e62 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -594,6 +594,57 @@ namespace OpenSim.Framework | |||
594 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); | 594 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); |
595 | } | 595 | } |
596 | 596 | ||
597 | private void WriteNiniConfig(IConfigSource source) | ||
598 | { | ||
599 | IConfig config = source.Configs[RegionName]; | ||
600 | |||
601 | if (config != null) | ||
602 | source.Configs.Remove(RegionName); | ||
603 | |||
604 | config = source.AddConfig(RegionName); | ||
605 | |||
606 | config.Set("RegionUUID", RegionID.ToString()); | ||
607 | |||
608 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | ||
609 | config.Set("Location", location); | ||
610 | |||
611 | if (DataStore != String.Empty) | ||
612 | config.Set("Datastore", DataStore); | ||
613 | |||
614 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | ||
615 | config.Set("InternalPort", m_internalEndPoint.Port); | ||
616 | |||
617 | config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); | ||
618 | |||
619 | config.Set("ExternalHostName", m_externalHostName); | ||
620 | |||
621 | if (MasterAvatarAssignedUUID != UUID.Zero) | ||
622 | { | ||
623 | config.Set("MasterAvatarUUID", MasterAvatarAssignedUUID.ToString()); | ||
624 | } | ||
625 | else if (MasterAvatarFirstName != String.Empty && MasterAvatarLastName != String.Empty) | ||
626 | { | ||
627 | config.Set("MasterAvatarFirstName", MasterAvatarFirstName); | ||
628 | config.Set("MasterAvatarLastName", MasterAvatarLastName); | ||
629 | } | ||
630 | if (MasterAvatarSandboxPassword != String.Empty) | ||
631 | { | ||
632 | config.Set("MasterAvatarSandboxPassword", MasterAvatarSandboxPassword); | ||
633 | } | ||
634 | |||
635 | if (m_nonphysPrimMax != 0) | ||
636 | config.Set("NonphysicalPrimMax", m_nonphysPrimMax); | ||
637 | if (m_physPrimMax != 0) | ||
638 | config.Set("PhysicalPrimMax", m_physPrimMax); | ||
639 | config.Set("ClampPrimSize", m_clampPrimSize.ToString()); | ||
640 | |||
641 | if (m_objectCapacity != 0) | ||
642 | config.Set("MaxPrims", m_objectCapacity); | ||
643 | |||
644 | if (ScopeID != UUID.Zero) | ||
645 | config.Set("ScopeID", ScopeID.ToString()); | ||
646 | } | ||
647 | |||
597 | public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) | 648 | public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) |
598 | { | 649 | { |
599 | return true; | 650 | return true; |
@@ -601,6 +652,23 @@ namespace OpenSim.Framework | |||
601 | 652 | ||
602 | public void SaveRegionToFile(string description, string filename) | 653 | public void SaveRegionToFile(string description, string filename) |
603 | { | 654 | { |
655 | if (filename.ToLower().EndsWith(".ini")) | ||
656 | { | ||
657 | IniConfigSource source = new IniConfigSource(); | ||
658 | try | ||
659 | { | ||
660 | source = new IniConfigSource(filename); // Load if it exists | ||
661 | } | ||
662 | catch (Exception) | ||
663 | { | ||
664 | } | ||
665 | |||
666 | WriteNiniConfig(source); | ||
667 | |||
668 | source.Save(filename); | ||
669 | |||
670 | return; | ||
671 | } | ||
604 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, | 672 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, |
605 | ignoreIncomingConfiguration, false); | 673 | ignoreIncomingConfiguration, false); |
606 | configMember.performConfigurationRetrieve(); | 674 | configMember.performConfigurationRetrieve(); |