private bool saveZigFile()
        {
            bool retVal = false;
            try
            {
                IniConfigSource source = new IniConfigSource();
                string appDataPath = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ZigGIS";
                if (!System.IO.Directory.Exists(appDataPath))
                {
                    System.IO.Directory.CreateDirectory(appDataPath);
                }
                IConfig config = source.AddConfig("connection");
                config.Set("server", this.txtServer.Text);
                config.Set("port", this.txtSchema.Text);
                config.Set("database", this.txtDatabase.Text);
                config.Set("user", this.txtUserName.Text);
                config.Set("password", this.txtPassword.Text);

                config = source.AddConfig("logging");
                config.Set("configfile", this.txtLogFile.Text);

                string zigFileName = this.txtServer.Text + "." + this.txtDatabase.Text + "." + this.txtUserName.Text + "." + System.Guid.NewGuid().ToString() + ".zig";
                source.Save(appDataPath + "\\" + zigFileName);
                return retVal;
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return false;
            }
        }
        public void EmptyConstructor()
        {
            string filePath = "EmptyConstructor.ini";
            IniConfigSource source = new IniConfigSource ();

            IConfig config = source.AddConfig ("Pets");
            config.Set ("cat", "Muffy");
            config.Set ("dog", "Rover");
            config.Set ("bird", "Tweety");
            source.Save (filePath);

            Assert.AreEqual (3, config.GetKeys ().Length);
            Assert.AreEqual ("Muffy", config.Get ("cat"));
            Assert.AreEqual ("Rover", config.Get ("dog"));
            Assert.AreEqual ("Tweety", config.Get ("bird"));

            source = new IniConfigSource (filePath);
            config = source.Configs["Pets"];

            Assert.AreEqual (3, config.GetKeys ().Length);
            Assert.AreEqual ("Muffy", config.Get ("cat"));
            Assert.AreEqual ("Rover", config.Get ("dog"));
            Assert.AreEqual ("Tweety", config.Get ("bird"));

            File.Delete (filePath);
        }
		public void SetAndSave ()
		{
			string filePath = "Test.ini";

			StreamWriter writer = new StreamWriter (filePath);
			writer.WriteLine ("; some comment");
			writer.WriteLine ("[new section]");
			writer.WriteLine (" dog = Rover");
			writer.WriteLine (""); // empty line
			writer.WriteLine ("; a comment");
			writer.WriteLine (" cat = Muffy");
			writer.Close ();
			
			IniConfigSource source = new IniConfigSource (filePath);
			IConfig config = source.Configs["new section"];
			Assert.AreEqual ("Rover", config.Get ("dog"));
			Assert.AreEqual ("Muffy", config.Get ("cat"));
			
			config.Set ("dog", "Spots");
			config.Set ("cat", "Misha");
			config.Set ("DoesNotExist", "SomeValue");
			
			Assert.AreEqual ("Spots", config.Get ("dog"));
			Assert.AreEqual ("Misha", config.Get ("cat"));
			Assert.AreEqual ("SomeValue", config.Get ("DoesNotExist"));
			source.Save ();
			
			source = new IniConfigSource (filePath);
			config = source.Configs["new section"];
			Assert.AreEqual ("Spots", config.Get ("dog"));
			Assert.AreEqual ("Misha", config.Get ("cat"));
			Assert.AreEqual ("SomeValue", config.Get ("DoesNotExist"));
			
			File.Delete (filePath);
		}
Exemple #4
0
 internal static void UpdateMooegeIni(Repository repository)
 {
     var repoIniPath = new IniConfigSource(Paths.GetMooegeIniPath(repository));
     //For each selection we set the correct MPQ storage path & PacketLog|ServerLog settings on the config INI, this is the best way I could think to have the paths updated at everytime
     //We CANNOT call variable Compile.mooegeINI because that variable only saves latest compiled ini path for INSTANT writting after compiling a repository.
     //WE do not need to write different IPS / PORTS for this since its LOCAL function, We do that over RepositorySelectionSERVER.
     #region SetSettings
     repoIniPath.Configs["Storage"].Set("MPQRoot", MadCow.MpqServer);
     repoIniPath.Configs["ServerLog"].Set("Enabled", Mooege.FileLogging);
     repoIniPath.Configs["PacketLog"].Set("Enabled", Mooege.PacketLogging);
     repoIniPath.Configs["Storage"].Set("EnableTasks", Mooege.Tasks);
     repoIniPath.Configs["Storage"].Set("LazyLoading", Mooege.LazyLoading);
     repoIniPath.Configs["Authentication"].Set("DisablePasswordChecks", Mooege.PasswordCheck);
     //We set the server variables:
     //MooNet-Server IP
     repoIniPath.Configs["MooNet-Server"].Set("BindIP", MadCow.CurrentProfile.MooNetServerIp);
     //Game-Server IP
     repoIniPath.Configs["Game-Server"].Set("BindIP", MadCow.CurrentProfile.GameServerIp);
     //Public IP
     repoIniPath.Configs["NAT"].Set("PublicIP", MadCow.CurrentProfile.NatIp);
     //MooNet-Server Port
     repoIniPath.Configs["MooNet-Server"].Set("Port", MadCow.CurrentProfile.MooNetServerPort);
     //Game-Server Port
     repoIniPath.Configs["Game-Server"].Set("Port", MadCow.CurrentProfile.GameServerPort);
     //MOTD
     repoIniPath.Configs["MooNet-Server"].Set("MOTD", MadCow.CurrentProfile.MooNetServerMotd);
     //NAT
     repoIniPath.Configs["NAT"].Set("Enabled", MadCow.CurrentProfile.NatEnabled);
     repoIniPath.Save();
     #endregion
     Console.WriteLine("Current Profile: " + MadCow.CurrentProfile);
     Console.WriteLine("Set Mooege config.ini according to your profile " + MadCow.CurrentProfile);
     Console.WriteLine(repository + " is ready to go.");
 }
        /// <summary>
        /// Initialises the somer blink configuration file at path.
        /// </summary>
        /// <param name="path">The path.</param>
        public static void InitialiseSomerBlinkConfigFileAtPath(string path)
        {
            var source = new IniConfigSource();
            source.AddConfig("Credentials");
            source.Configs["Credentials"].Set("Username", "");
            source.Configs["Credentials"].Set("Password", "");

            source.AddConfig("Settings");
            source.Configs["Settings"].Set("MinWaitTime", "2000");
            source.Configs["Settings"].Set("MaxWaitTime", "60000");
            source.Configs["Settings"].Set("MinBlinkBidIsk", "2500000");
            source.Configs["Settings"].Set("MaxBlinkBidIsk", "10000000");
            source.Configs["Settings"].Set("DownTime", "4");
            source.Configs["Settings"].Set("RunTime", "4");

            source.AddConfig("Extra");
            source.Configs["Settings"].Set("DebugMode", "0");
            source.Configs["Settings"].Set("proxyIp", "x.x.x.x");
            source.Configs["Settings"].Set("proxyPort", "8080");
            source.Configs["Settings"].Set("proxyUser", "");
            source.Configs["Settings"].Set("proxyPass", "");
            source.Configs["Settings"].Set("useProxy", "false");

            source.Save(path);

            SaveToDesktop(path);
            Logger.LogMessage();
            Logger.LogMessage("--------------------");
            Logger.LogMessage("ConfigFile shortcut created on desktop");
        }
        /// <summary>
        /// Augments the configuration file.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">path</exception>
        public static bool AugmentConfigFile(string path)
        {
            if (path.IsNullOrBlank())
            {
                throw new ArgumentNullException("path");
            }

            var changed = false;

            var source = new IniConfigSource(path);

            var configs = source.Configs["Settings"];

            var proxyType = configs.Get("proxyType");

            if (proxyType.IsNullOrBlank())
            {
                configs.Set("proxyType", 0);
                changed = true;
            }

            source.Save(path);

            return changed;
        }
 public static void ReloadConfigFile()
 {
     if(System.IO.File.Exists (FullConfigPath))
     {
         ConfigSource = new IniConfigSource (FullConfigPath);
         ConfigSource.Reload ();
     }
     else
     {
         logger.Warn ("Конфигурационный фаил {0} не найден. Конфигурация не загружена.");
         ConfigSource = new IniConfigSource ();
         ConfigSource.Save (FullConfigPath);
     }
 }
Exemple #8
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            // Write config file settings for [ToonItems]
            IConfigSource source = new IniConfigSource("config.ini");
            IConfig config = source.Configs["ToonItems"];
            config.Set("Head", lblHead.Text);
            config.Set("Chest", lblChest.Text);
            config.Set("Feet", lblFeet.Text);
            config.Set("Hands", lblHands.Text);
            config.Set("Weapon1", lblWeapon1.Text);
            config.Set("Weapon2", lblWeapon2.Text);
            config.Set("Shoulders", lblShoulders.Text);
            config.Set("Legs", lblLegs.Text);
            source.Save();

            var main = new Program(); // startup.
            main.StartupServers();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            #if (DEBUG)
            IConfigSource source = new IniConfigSource("C:\\UDK\\Gladiator2_2012022322222222\\UDKGame\\Config\\UDKEngine.ini");
            #else
            IConfigSource source = new IniConfigSource(Application.StartupPath + "UDKGame\\Config\\UDKEngine.ini");
            #endif

            source.Configs["SystemSettings"].Set("ResX", cmbResolution.Text.Split('x').ElementAt(0));
            source.Configs["SystemSettings"].Set("ResY", cmbResolution.Text.Split('x').ElementAt(1));
            source.Configs["SystemSettings"].Set("Fullscreen", (chkEnableWindowedMode.Checked == true) ? "False" : "True");
            source.Configs["SystemSettings"].Set("AmbientOcclusion", (chkEnableAmbientOcclusion.Checked == true) ? "True" : "False");
            source.Save();

            Properties.Settings.Default.Resolution = cmbResolution.Text.Trim();
            Properties.Settings.Default.AmbientOcc = chkEnableAmbientOcclusion.Checked;
            Properties.Settings.Default.EnableWindowedMode = !chkEnableWindowedMode.Checked;
            Properties.Settings.Default.ServerLog = chkLog.Checked;
            this.Close();
        }
        private void SaveChangesFile(RegionInfo regionInfo)
        {
            string regionConfigPath = Path.Combine(Util.configDir(), "Regions");

            try
            {
                IConfig config = m_config.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[regionInfo.RegionName];
                if (cnf != null)
                {
                    cnf.Set("Location", regionInfo.RegionLocX + "," + regionInfo.RegionLocY);
                    cnf.Set("RegionType", regionInfo.RegionType);
                    cnf.Name = regionInfo.RegionName;
                    source.Save();
                    break;
                }
            }
        }
Exemple #11
0
 public static void SaveFigureTools()
 {
     IniConfigSource source = new IniConfigSource();
     WorkBookUtils.WriteDapToConfig(dapPolyline, source.AddConfig(POLYLINE_SECT));
     WorkBookUtils.WriteDapToConfig(dapRect, source.AddConfig(RECT_SECT));
     WorkBookUtils.WriteDapToConfig(dapEllipse, source.AddConfig(ELLIPSE_SECT));
     WorkBookUtils.WriteDapToConfig(dapTextBox, source.AddConfig(TEXTBOX_SECT));
     WorkBookUtils.WriteDapToConfig(dapText, source.AddConfig(TEXT_SECT));
     WorkBookUtils.WriteDapToConfig(dapClock, source.AddConfig(CLOCK_SECT));
     WorkBookUtils.WriteDapToConfig(dapTriangle, source.AddConfig(TRIANGLE_SECT));
     WorkBookUtils.WriteDapToConfig(dapRightAngleTriangle, source.AddConfig(RIGHTANGLETRIANGLE_SECT));
     WorkBookUtils.WriteDapToConfig(dapDiamond, source.AddConfig(DIAMOND_SECT));
     WorkBookUtils.WriteDapToConfig(dapPentagon, source.AddConfig(PENTAGON_SECT));
     WorkBookUtils.WriteDapToConfig(dapLine, source.AddConfig(LINE_SECT));
     source.Save(IniFile);
 }
Exemple #12
0
        /// <summary>
        /// Creates a new config file.
        /// </summary>
        private void CreateNewFile()
        {
            string type = null;;

            if (IsArg ("set-type")) {
                type = GetArg ("set-type").ToLower ();
            } else {
                ThrowError ("You must supply a type (--set-type)");
            }

            switch (type)
            {
            case "ini":
                IniConfigSource iniSource = new IniConfigSource ();
                iniSource.Save (configPath);
                break;
            case "xml":
                XmlConfigSource xmlSource = new XmlConfigSource ();
                xmlSource.Save (configPath);
                break;
            case "config":
                DotNetConfigSource dotnetSource = new DotNetConfigSource ();
                dotnetSource.Save (configPath);
                break;
            default:
                ThrowError ("Unknown type");
                break;
            }
        }
Exemple #13
0
        public void SaveRegionToFile(string description, string filename)
        {
            if (filename.ToLower().EndsWith(".ini"))
            {
                IniConfigSource source = new IniConfigSource();
                try
                {
                    source = new IniConfigSource(filename); // Load if it exists
                }
                catch (Exception)
                {
                }

                WriteNiniConfig(source);

                source.Save(filename);

                return;
            }
            else if (filename.ToLower().EndsWith(".xml"))
            {
                configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
                                                       ignoreIncomingConfiguration, false);
                configMember.performConfigurationRetrieve();
                RegionFile = filename;
            }
            else
                throw new Exception("Invalid file type for region persistence.");
        }
Exemple #14
0
        public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
        {
            // m_configSource = configSource;

            if (filename.ToLower().EndsWith(".ini"))
            {
                if (!File.Exists(filename)) // New region config request
                {
                    IniConfigSource newFile = new IniConfigSource();
                    ReadNiniConfig(newFile, configName);

                    newFile.Save(filename);

                    RegionFile = filename;

                    return;
                }

                IniConfigSource source = new IniConfigSource(filename);

                bool saveFile = false;
                if (source.Configs[configName] == null)
                    saveFile = true;

                ReadNiniConfig(source, configName);

                if (configName != String.Empty && saveFile)
                    source.Save(filename);

                RegionFile = filename;

                return;
            }

            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(xmlsource, configName);

                RegionFile = filename;

                return;
            }
            catch (Exception)
            {
            }

            configMember =
                new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
            configMember.performConfigurationRetrieve();
            RegionFile = filename;
        }
Exemple #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (File.Exists(Program.madcowINI))
            {
                try
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String Src = source.Configs["ShortCut"].Get("Shortcut");

                    if (Src.Contains("1"))
                    {
                        source.Configs["ShortCut"].Set("Shortcut", 0);
                        source.Save();
                        SrtCutStatusLabel.ResetText();
                        SrtCutStatusLabel.Text = "Disabled";
                        SrtCutStatusLabel.ForeColor = Color.DimGray;
                    }
                    else
                    {
                        source.Configs["ShortCut"].Set("Shortcut", 1);
                        source.Save();
                        SrtCutStatusLabel.ResetText();
                        SrtCutStatusLabel.Text = "Enabled";
                        SrtCutStatusLabel.ForeColor = Color.SeaGreen;
                    }
                }
                catch
                {
                    Console.WriteLine("[Error] At ShortCut Disabler.");
                }
            }
        }
Exemple #16
0
        public void RemoveRegion(Scene scene, bool cleanup)
        {
            // only need to check this if we are not at the
            // root level
            if ((SceneManager.CurrentScene != null) &&
                (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
            {
                SceneManager.TrySetCurrentScene("..");
            }

            if (cleanup)
            {
                scene.DeleteAllSceneObjects();
			}
            SceneManager.CloseScene(scene);
            ShutdownClientServer(scene.RegionInfo);
            
            if (!cleanup)
                return;

            if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
            {
                if (scene.RegionInfo.RegionFile.ToLower().EndsWith(".xml"))
                {
                    File.Delete(scene.RegionInfo.RegionFile);
                    m_log.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", scene.RegionInfo.RegionFile);
                }
                if (scene.RegionInfo.RegionFile.ToLower().EndsWith(".ini"))
                {
                    try
                    {
                        IniConfigSource source = new IniConfigSource(scene.RegionInfo.RegionFile);
                        if (source.Configs[scene.RegionInfo.RegionName] != null)
                        {
                            source.Configs.Remove(scene.RegionInfo.RegionName);

                            if (source.Configs.Count == 0)
                            {
                                File.Delete(scene.RegionInfo.RegionFile);
                            }
                            else
                            {
                                source.Save(scene.RegionInfo.RegionFile);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
        /// <summary>
        /// Either Add or Update a particular section/key/value.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="type">The type.</param>
        private void AddorUpdate(string section, string key, string value, string type)
        {
            try
            {
                
                IConfigSource target = new IniConfigSource(targetFile);
                if (target.Configs[section] == null)
                {
                    target.AddConfig(section);
                }

                //If we want to break on no match, check
                if (config.BreakOnNoMatch && type == "Update" && !target.Configs[section].Contains(key))
                {
                    throw new Exception("Could not match section");
                }
                target.Configs[section].Set(key, value);
                target.Save();

                LogCount(log);
            }
            catch (Exception inner)
            {
                throw new Exception("Failed to process " + type + " modification to Section/Key = " + section + "/" + key, inner);
            }
        }
 private void Export_Click(object sender, EventArgs e)
 {
     if(CurrentRegionID == UUID.Zero)
     {
         MessageBox.Show("Select a region before attempting to export.");
         return;
     }
     RegionInfo region = m_connector.GetRegionInfo(CurrentRegionID);
     if (region != null) //It never should be, but who knows
     {
         //Make sure the directory exists
         if (!Directory.Exists("Regions"))
             Directory.CreateDirectory("Regions");
         if (!File.Exists ("Regions\\" + ExportFileName.Text))
              File.Create ("Regions\\" + ExportFileName.Text).Close();
         IniConfigSource source = new IniConfigSource("Regions\\" + ExportFileName.Text, IniFileType.AuroraStyle);
         if (source.Configs[region.RegionName] != null)
         {
             source.Configs.Remove(region.RegionName);
         }
         //Add the config to the given source
         region.CreateIConfig(source);
         source.Save();
     }
 }
        public void WriteNiniConfig(IConfigSource source)
        {
            try
            {
                //MUST reload or it will overwrite other changes!
                source = new IniConfigSource(RegionFile, Nini.Ini.IniFileType.AuroraStyle);
            }
            catch (FileNotFoundException)
            {
                //If this happens, it is the first time a user has opened Aurora and the RegionFile doesn't exist 
                // yet, so just let it gracefully fail and create itself later
                return;
            }

            CreateIConfig(source);

            source.Save();
        }
Exemple #20
0
        //After Asyn download complete, we proceed to parse the required version by Mooege in VersionInfo.cs.
        private void Checkversions(Object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (File.Exists(Diablo3UserPathSelection.Text))
                {
                    String parseVersion = e.Result;
                    FileVersionInfo d3Version = FileVersionInfo.GetVersionInfo(Diablo3UserPathSelection.Text);
                    Int32 ParsePointer = parseVersion.IndexOf("RequiredPatchVersion = ");
                    String MooegeVersion = parseVersion.Substring(ParsePointer + 23, 4); //Gets required version by Mooege
                    MooegeSupportedVersion = MooegeVersion; //Public String to display over D3 path validation.
                    int CurrentD3VersionSupported = Convert.ToInt32(MooegeVersion);
                    int LocalD3Version = d3Version.FilePrivatePart;

                    //DISABLED MATCHING CLIENT VERSIONS FOR NOW.
                    if (LocalD3Version == CurrentD3VersionSupported || LocalD3Version != CurrentD3VersionSupported)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Found the correct Mooege supported version of Diablo III [" + CurrentD3VersionSupported + "]");
                        Console.ForegroundColor = ConsoleColor.White;
                        PlayDiabloButton.Invoke(new Action(() =>
                        {
                            PlayDiabloButton.Enabled = true;
                        }
                        ));
                        CopyMPQButton.Invoke(new Action(() =>
                        {
                            CopyMPQButton.Enabled = true;
                        }
                        ));
                    }
                    //If the versions missmatch:
                    /*else if (LocalD3Version != CurrentD3VersionSupported)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Wrong client version FOUND!");
                        Console.ForegroundColor = ConsoleColor.White;
                        MessageBox.Show("You need Diablo III Client version [" + MooegeSupportedVersion + "] in order to play over Mooege.\nPlease Update.", "Warning",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        PlayDiabloButton.Invoke(new Action(() =>
                        {
                            PlayDiabloButton.Enabled = false;
                        }
                        ));
                        CopyMPQButton.Invoke(new Action(() =>
                        {
                            CopyMPQButton.Enabled = false;
                        }
                        ));
                    }*/
                }
                else //If the user, once a Diablo 3 client path saved, deletes the Folder or moves it to another place, we go back to blank values over Diablo 3 path.
                {
                    IConfigSource madcowIni = new IniConfigSource(Program.madcowINI);
                    madcowIni.Configs["DiabloPath"].Set("D3Path", "MODIFY");
                    madcowIni.Configs["DiabloPath"].Set("MPQpath", "");
                    madcowIni.ReplaceKeyValues();
                    madcowIni.Save();
                    MessageBox.Show("Could not find Diablo III.exe, please select the proper path again.", "Warning",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Diablo3UserPathSelection.Invoke(new Action(() => { this.Diablo3UserPathSelection.Text = "Please Select your Diablo III path."; }));
                    PlayDiabloButton.Invoke(new Action(() => { PlayDiabloButton.Enabled = false; }));
                    CopyMPQButton.Invoke(new Action(() => { CopyMPQButton.Enabled = false; }));
                }
            }
            catch
            {
                Console.WriteLine("[ERROR] Internet connection failed or GitHub site is down!");
            }
        }
Exemple #21
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (File.Exists(Program.madcowINI))
            {
                try
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String Src = source.Configs["Tray"].Get("Enabled");

                    if (Src.Contains("1"))
                    {
                        //Tray Icon Functionality.
                        source.Configs["Tray"].Set("Enabled", 0);
                        source.Save();
                        MinimizeTrayStatusLabel.ResetText();
                        MinimizeTrayStatusLabel.Text = "Disabled";
                        MinimizeTrayStatusLabel.ForeColor = Color.DimGray;
                        //Balloons (We dont want balloons if we dont want tray icon)
                        source.Configs["Balloons"].Set("ShowBalloons", 0);
                        source.Save();
                        TrayNotificationsStatusLabel.ResetText();
                        TrayNotificationsStatusLabel.Text = "Disabled";
                        TrayNotificationsStatusLabel.ForeColor = Color.DimGray;
                        ChainPicture.Visible = true;

                    }
                    else
                    {
                        source.Configs["Tray"].Set("Enabled", 1);
                        source.Save();
                        MinimizeTrayStatusLabel.ResetText();
                        MinimizeTrayStatusLabel.Text = "Enabled";
                        MinimizeTrayStatusLabel.ForeColor = Color.SeaGreen;
                        ChainPicture.Visible = false;
                    }
                }
                catch
                {
                    Console.WriteLine("[Error] At LastRepository Disabler.");
                }
            }
        }
Exemple #22
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (File.Exists(Program.madcowINI))
            {
                try
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String Src = source.Configs["LastPlay"].Get("Enabled");

                    if (Src.Contains("1"))
                    {
                        source.Configs["LastPlay"].Set("Enabled", 0);
                        source.Save();
                        RememberLastRepoStatusLabel.ResetText();
                        RememberLastRepoStatusLabel.Text = "Disabled";
                        RememberLastRepoStatusLabel.ForeColor = Color.DimGray;
                        LastPlayedRepoReminderLabel.Visible = false;
                        ChainPicture.Visible = false;
                        BrowseMPQPathButton.Enabled = true;
                        MPQDestTextBox.Visible = true;
                        BrowseMPQPathButton.Visible = true;
                        mpqDestinationDisableLabel.Visible = false;
                        MPQDestTextBox.Text = source.Configs["DiabloPath"].Get("MPQDest");
                    }
                    else
                    {
                        source.Configs["LastPlay"].Set("Enabled", 1);
                        source.Save();
                        RememberLastRepoStatusLabel.ResetText();
                        RememberLastRepoStatusLabel.Text = "Enabled";
                        RememberLastRepoStatusLabel.ForeColor = Color.SeaGreen;
                        LastPlayedRepoReminderLabel.Visible = true;
                        ChainPicture.Visible = false;
                        BrowseMPQPathButton.Enabled = false;
                        mpqDestinationDisableLabel.Visible = true;
                        //MPQDestTextBox.Text = "To modify this, disable Remember Last Repository over Help.";
                    }
                }
                catch
                {
                    Console.WriteLine("[Error] At LastRepository Disabler.");
                }
            }
        }
        public void SaveRegionToFile(string description, string filename)
        {
            if (filename.ToLower().EndsWith(".ini"))
            {
                IniConfigSource source = new IniConfigSource();
                try
                {
                    source = new IniConfigSource(filename, Nini.Ini.IniFileType.AuroraStyle); // Load if it exists
                }
                catch (Exception)
                {
                }

                WriteNiniConfig(source);

                source.Save(filename);
            }
        }
        public static void Configure(bool requested)
        {
            string Universe_ConfigDir = Constants.DEFAULT_CONFIG_DIR;
            bool isUniverseExe = AppDomain.CurrentDomain.FriendlyName == "Universe.exe" ||
                               AppDomain.CurrentDomain.FriendlyName == "Universe.vshost.exe";

             bool existingConfig = (
                File.Exists(Path.Combine(Universe_ConfigDir,"MyWorld.ini")) ||
                File.Exists(Path.Combine(Universe_ConfigDir,"Universe.ini")) ||
                File.Exists(Path.Combine(Universe_ConfigDir,"Universe.Server.ini"))
                );

            if ( requested || !existingConfig )
            {
                string resp = "no";
                if (!requested)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("\n\n************* Universe initial run. *************");
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(
                        "\n\n   This appears to be your first time running Virtual Universe.\n"+
                        "If you have already configured your *.ini files, please ignore this warning and press enter;\n" +
                        "Otherwise type 'yes' and Universe will guide you through the configuration process.\n\n"+
                        "Remember, these file names are Case Sensitive in Linux and Proper Cased.\n"+
                        "1. " + Universe_ConfigDir + "/Universe.ini\nand\n" +
                        "2. " + Universe_ConfigDir + "/Sim/Standalone/StandaloneCommon.ini \nor\n" +
                        "3. " + Universe_ConfigDir + "/Grid/GridCommon.ini\n" +
                        "\nAlso, you will want to examine these files in great detail because only the basic system will " +
                        "load by default. Universe can do a LOT more if you spend a little time going through these files.\n\n");
                }

                // Make sure...
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine ("");
                Console.WriteLine (" ##  WARNING  ##");
                Console.WriteLine("This will overwrite any existing configuration files!");
                Console.ResetColor();
                Console.WriteLine ("");
                resp = ReadLine("Do you want to configure Virtual Universe now?  (yes/no)", resp);

                if (resp == "yes")
                {
                    string cfgFolder = Universe_ConfigDir + "/";

                    string dbSource = "localhost";
                    string dbPasswd = "universe";
                    string dbSchema = "universe";
                    string dbUser = "******";
                    string dbPort = "3306";
                    string gridIPAddress = Utilities.GetExternalIp();
                    string regionIPAddress = gridIPAddress;
                    bool isStandalone = true;
                    string dbType = "1";
                    string gridName = "Virtual-Universe Grid";
                    string welcomeMessage = "";
                    string allowAnonLogin = "******";
                    uint port = 9000;
                    uint gridPort = 8002;

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("====================================================================");
                    Console.WriteLine("======================= Virtual Universe Configurator ==============");
                    Console.WriteLine("====================================================================");
                    Console.ResetColor();

                    if (isUniverseExe)
                    {
                        Console.WriteLine("This installation is going to run in");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("[1] Standalone Mode \n[2] Grid Mode");
                        Console.ResetColor();
                        isStandalone = ReadLine("Choose 1 or 2", "1") == "1";

                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("The domain name or IP address of this region server\nThe default is your external IP address");
                        Console.ResetColor();
                        regionIPAddress = ReadLine("Region server address: ", regionIPAddress);

                        Console.WriteLine("\nHttp Port for the region server");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("Default is 9000");
                        Console.ResetColor();
                        port = uint.Parse(ReadLine("Choose the port", "9000"));
                    }

                    if (isStandalone)
                    {
                        Console.WriteLine("Which database do you want to use?");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("[1] SQLite \n[2] MySQL");
                        Console.ResetColor();
                        dbType = ReadLine("Choose 1 or 2", dbType);
                        if (dbType == "2")
                        {
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.WriteLine(
                                "\nNote: this setup does not automatically create a MySQL installation for you.\n" +
                                " This will configure the Universe setting but you must install MySQL as well");
                            Console.ResetColor();

                            dbSource = ReadLine("MySQL database IP", dbSource);
                            dbPort = ReadLine("MySQL database port (if not default)", dbPort);
                            dbSchema = ReadLine("MySQL database name for your region", dbSchema);
                            dbUser = ReadLine("MySQL database user account", dbUser);

                            Console.Write("MySQL database password for that account");
                            dbPasswd = Console.ReadLine();

                            Console.WriteLine ("");
                        }
                    }

                    if (isStandalone)
                    {
                        gridName = ReadLine("Name of your Virtual-Universe Grid", gridName);

                        welcomeMessage = "Welcome to " + gridName + ", <USERNAME>!";
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine ("\nEnter your 'Welcome Message' that each user will see during login\n" +
                        "  (putting <USERNAME> into the welcome message will insert the user's name)");
                        Console.ResetColor();
                        welcomeMessage = ReadLine("Welcome Message", welcomeMessage);

                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine ("\nAccounts can be created automatically when users log in for the first time.\n" +
                        "  (This means you don't have to create all accounts manually using the console or web interface)");
                        Console.ResetColor();

                        allowAnonLogin = ReadLine("Create accounts automatically?", allowAnonLogin);
                    }

                    if (!isStandalone)
                        gridIPAddress =
                            ReadLine("The domain name or IP address of the grid server you wish to connect to",
                                     gridIPAddress);

                    //Data.ini setup
                    if (isStandalone)
                    {
                        string cfgDataFolder = isUniverseExe ? "Sim/" : "Grid/ServerConfiguration/";

                        MakeSureExists(cfgFolder + cfgDataFolder + "Data/Data.ini");
                        var data_ini = new IniConfigSource(
                            cfgFolder + cfgDataFolder + "Data/Data.ini",
                            Nini.Ini.IniFileType.AuroraStyle);

                        IConfig conf = data_ini.AddConfig("DataFile");

                        // Standalone
                        if (dbType == "1")
                            conf.Set("Include-SQLite", cfgDataFolder + "Data/SQLite.ini");
                        else
                            conf.Set("Include-MySQL",  cfgDataFolder + "Data/MySQL.ini");

                        if (isUniverseExe)
                            conf.Set("Include-FileBased", "Sim/Data/FileBased.ini");

                        conf = data_ini.AddConfig("UniverseConnectors");
                        conf.Set("ValidateTables", true);

                        data_ini.Save();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Your Data.ini has been successfully configured");
                        Console.ResetColor();

                        // MySql setup
                        if (dbType == "2")
                        {
                            MakeSureExists(cfgFolder + cfgDataFolder + "Data/MySQL.ini");
                            var mysql_ini = new IniConfigSource(
                                cfgFolder + cfgDataFolder + "Data/MySQL.ini",
                                Nini.Ini.IniFileType.AuroraStyle);
                            var mysql_ini_example = new IniConfigSource(
                                cfgFolder + cfgDataFolder + "Data/MySQL.ini.example",
                                Nini.Ini.IniFileType.AuroraStyle);

                            foreach (IConfig config in mysql_ini_example.Configs)
                            {
                                IConfig newConfig = mysql_ini.AddConfig(config.Name);
                                foreach (string key in config.GetKeys())
                                {
                                    if (key == "ConnectionString")
                                        newConfig.Set(key,
                                                      string.Format(
                                                "\"Data Source={0};Port={1};Database={2};User ID={3};Password={4};Charset=utf8;\"",
                                                dbSource, dbPort, dbSchema, dbUser, dbPasswd));
                                    else
                                        newConfig.Set(key, config.Get(key));
                                }
                            }
                            mysql_ini.Save();
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine("Your MySQL.ini has been successfully configured");
                            Console.ResetColor();
                        }
                    }

                    // Region server
                    if (isUniverseExe)
                    {
                        MakeSureExists(cfgFolder + "Universe.ini");
                        var universe_ini = new IniConfigSource(
                            cfgFolder + "Universe.ini",
                            Nini.Ini.IniFileType.AuroraStyle);
                        var universe_ini_example = new IniConfigSource(
                            cfgFolder + "Universe.ini.example",
                            Nini.Ini.IniFileType.AuroraStyle);

                        bool setIp = false;

                        foreach (IConfig config in universe_ini_example.Configs)
                        {
                            IConfig newConfig = universe_ini.AddConfig(config.Name);
                            foreach (string key in config.GetKeys())
                            {
                                if (key == "http_listener_port")
                                    newConfig.Set (key, port);
                                else if (key == "HostName")
                                {
                                    setIp = true;
                                    newConfig.Set (key, regionIPAddress);
                                }
                                else
                                    newConfig.Set(key, config.Get(key));
                            }

                            if ((config.Name == "Network") & !setIp)
                            {
                                setIp = true;
                                newConfig.Set ("HostName", regionIPAddress);
                            }
                        }

                        universe_ini.Save();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Your Universe.ini has been successfully configured");
                        Console.ResetColor();

                        MakeSureExists(cfgFolder + "Sim/Main.ini");
                        var main_ini = new IniConfigSource(
                            cfgFolder + "Sim/Main.ini",
                            Nini.Ini.IniFileType.AuroraStyle);

                        IConfig conf = main_ini.AddConfig("Architecture");
                        if (isStandalone)
                            conf.Set("Include-Standalone", "Sim/Standalone/StandaloneCommon.ini");
                        else
                            conf.Set("Include-Grid", "Sim/Grid/GridCommon.ini");
                        conf.Set("Include-Includes", "Sim/Includes.ini");

                        main_ini.Save();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Your Main.ini has been successfully configured");
                        Console.ResetColor();

                        if (isStandalone)
                        {
                            MakeSureExists(cfgFolder + "Sim/Standalone/StandaloneCommon.ini");
                            var standalone_ini = new IniConfigSource(
                                cfgFolder + "Sim/Standalone/StandaloneCommon.ini",
                                Nini.Ini.IniFileType.AuroraStyle);
                            var standalone_ini_example = new IniConfigSource(
                                cfgFolder + "Sim/Standalone/StandaloneCommon.ini.example",
                                Nini.Ini.IniFileType.AuroraStyle);

                            foreach (IConfig config in standalone_ini_example.Configs)
                            {
                                IConfig newConfig = standalone_ini.AddConfig(config.Name);
                                if (newConfig.Name == "GridInfoService")
                                {
                                    newConfig.Set("GridInfoInHandlerPort", 0);
                                    newConfig.Set("login", "http://" + gridIPAddress + ":" + port + "/");
                                    newConfig.Set("gridname", gridName);
                                    newConfig.Set("gridnick", gridName);
                                }
                                else
                                {
                                    foreach (string key in config.GetKeys())
                                    {
                                        if (key == "WelcomeMessage")
                                            newConfig.Set(key, welcomeMessage);
                                        else if (key == "AllowAnonymousLogin")
                                            newConfig.Set(key, allowAnonLogin);
                                        else
                                            newConfig.Set(key, config.Get(key));
                                    }
                                }
                            }

                            standalone_ini.Save();
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine("Your StandaloneCommon.ini has been successfully configured");
                            Console.ResetColor();
                        }
                        else
                        {
                            MakeSureExists(cfgFolder + "Sim/Grid/GridCommon.ini");
                            var grid_ini = new IniConfigSource(
                                cfgFolder + "Sim/Grid/GridCommon.ini",
                                Nini.Ini.IniFileType.AuroraStyle);

                            conf = grid_ini.AddConfig("Includes");
                            conf.Set("Include-Grid", "Sim/Grid/Grid.ini");
                            conf = grid_ini.AddConfig("Configuration");
                            conf.Set("GridServerURI", "http://" + gridIPAddress + ":8012/grid/");

                            grid_ini.Save();
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine("Your Grid.ini has been successfully configured");
                            Console.ResetColor();
                            Console.WriteLine ("");

                        }
                    }

                    // Grid server
                    if (!isUniverseExe)
                    {
                        MakeSureExists(cfgFolder + "Universe.Server.ini");
                        var universe_ini = new IniConfigSource(
                            cfgFolder + "Universe.Server.ini",
                            Nini.Ini.IniFileType.AuroraStyle);
                        var universe_ini_example = new IniConfigSource(
                            cfgFolder + "Universe.Server.ini.example",
                            Nini.Ini.IniFileType.AuroraStyle);

                        gridIPAddress =
                            ReadLine("\nThe domain name or IP address of the grid server", gridIPAddress);
                        bool ipSet = false;

                        foreach (IConfig config in universe_ini_example.Configs)
                        {
                            IConfig newConfig = universe_ini.AddConfig(config.Name);
                            foreach (string key in config.GetKeys())
                            {
                                if (key == "HostName")
                                {
                                    ipSet = true;
                                    newConfig.Set (key, gridIPAddress);
                                }
                                else
                                    newConfig.Set(key, config.Get(key));
                            }

                            if ((config.Name == "Network") & !ipSet)
                            {
                                ipSet = true;
                                newConfig.Set ("HostName", gridIPAddress);
                            }
                        }

                        universe_ini.Save();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Your Universe.Server.ini has been successfully configured");
                        Console.ResetColor();

                        MakeSureExists(cfgFolder + "Grid/ServerConfiguration/Login.ini");
                        var login_ini = new IniConfigSource(
                            cfgFolder + "Grid/ServerConfiguration/Login.ini",
                            Nini.Ini.IniFileType.AuroraStyle);
                        var login_ini_example = new IniConfigSource(
                            cfgFolder + "Grid/ServerConfiguration/Login.ini.example",
                            Nini.Ini.IniFileType.AuroraStyle);

                        Console.WriteLine("\nHttp Port for the grid server");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("Default is 8002");
                        Console.ResetColor();
                        gridPort = uint.Parse(ReadLine("Choose the port", "8002"));

                        foreach (IConfig config in login_ini_example.Configs)
                        {
                            IConfig newConfig = login_ini.AddConfig(config.Name);
                            foreach (string key in config.GetKeys())
                            {
                                if (key == "WelcomeMessage")
                                    newConfig.Set(key, welcomeMessage);
                                else if (key == "AllowAnonymousLogin")
                                    newConfig.Set(key, allowAnonLogin);
                                else
                                    newConfig.Set(key, config.Get(key));
                            }
                        }
                        login_ini.Save();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Your Login.ini has been successfully configured");
                        Console.ResetColor();

                        MakeSureExists(cfgFolder + "Grid/ServerConfiguration/GridInfoService.ini");
                        var grid_info_ini = new IniConfigSource(
                            cfgFolder + "Grid/ServerConfiguration/GridInfoService.ini",
                            Nini.Ini.IniFileType.AuroraStyle);

                        IConfig conf = grid_info_ini.AddConfig("GridInfoService");
                        conf.Set("GridInfoInHandlerPort", gridPort);
                        conf.Set("login", "http://" + gridIPAddress + ":" + gridPort + "/");
                        conf.Set("gridname", gridName);
                        conf.Set("gridnick", gridName);

                        grid_info_ini.Save();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Your GridInfoService.ini has been successfully configured");
                        Console.ResetColor();
                        Console.WriteLine ("");
                    }

                    Console.WriteLine("\n====================================================================\n");
                    Console.ResetColor();
                    Console.WriteLine("Your grid name is ");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine(gridName);
                    Console.ResetColor();
                    if (isStandalone)
                    {
                        Console.WriteLine("\nYour loginuri is ");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("http://" +  (isUniverseExe ? regionIPAddress : gridIPAddress) + ":" + (isUniverseExe ? port : gridPort) + "/");
                        Console.ResetColor();
                    }
                    else
                    {
                        Console.WriteLine("\nConnected Grid URL: ");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("http://" + gridIPAddress + ":" + gridPort +"/");
                        Console.ResetColor();
                    }
                    Console.WriteLine("\n====================================================================\n");
                    Console.WriteLine(
                        "To re-run this configurator, enter \"run configurator\" into the console.");
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(" >> Please restart to use your new configuration. <<");
                    Console.ResetColor ();
                    Console.WriteLine ("");

                }
            }
        }
Exemple #25
0
        /// <summary>
        /// Creates a new config file with some defaults in it...
        /// </summary>
        private void CreateNewConfigFile()
        {
            IniConfigSource source = new IniConfigSource();

            IConfig config = source.AddConfig("defaults");
            config.Set("AutoUpdate", "Off");
            config.Set("ConnectionCheckURI", "http://www.google.se");
            config.Set("Version", "unknown");
            config.Set("LastUpdate", "unknown");
            config.Set("IconSize", "32");

            config = source.AddConfig("xmltv");
            config.Set("SourceURI", "http://tv.swedb.se/xmltv/");
            config.Set("Country", "Sweden");
            config.Set("ChannelList", "svt1.svt.se|svt2.svt.se|tv3.viasat.se|tv4.se|kanal5.se|ztv.se");

            source.Save(AppPath + "\\dufftv.ini");
            _CreatedNewFile = true;
        }
        // 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;
        }
        private void WriteOpenSimConfig(string pSenhaRegiao, string pEstateOwnerDefault, string pEstateNameDefault)
        {
            string openSimIni = Path.Combine(OpenSimBinDir, "OpenSim.ini"); // Case sensitive: Bug Linux/OSX Regions Autoconfig Fails

            IConfigSource source = new IniConfigSource(openSimIni);

            if (source.Configs["RemoteAdmin"] == null)
            {
                source.Configs.Add("RemoteAdmin");
            }

            if (pSenhaRegiao != "")
            {
                source.Configs["RemoteAdmin"].Set("enabled", "true");
                source.Configs["RemoteAdmin"].Set("access_password", pSenhaRegiao);
            }
            else
            {
                source.Configs["RemoteAdmin"].Set("enabled", "false");
            }

            if (source.Configs["Estates"] == null)
            {
                source.Configs.Add("Estates");
            }
            source.Configs["Estates"].Set("DefaultEstateName", pEstateNameDefault);
            source.Configs["Estates"].Set("DefaultEstateOwnerName", pEstateOwnerDefault);

            source.Configs["Startup"].Set("GenerateMaptiles", "true");
            source.Configs["Startup"].Set("MapImageModule", "Warp3DImageModule");

            source.Save();
        }
        /// <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;
                }
            }
        }
        /// <summary>
        /// Applies any Delete modifications
        /// </summary>
        /// <param name="mod">The mod.</param>
        private void Delete(IniDelete mod)
        {
            try
            {
                IConfigSource target = new IniConfigSource(targetFile);

                if (config.BreakOnNoMatch && !target.Configs[mod.section].Contains(mod.key))
                {
                    throw new Exception("Could not match section");
                }

                target.Configs[mod.section].Remove(mod.key);
                target.Save();
                LogCount(log);
            }
            catch (Exception inner)
            {
                throw new Exception("Failed to process Delete modification to Section/Key = " + mod.section + "/" + mod.key, inner);
            }

        }
        /// <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);
                    m_log.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)
                    {
                    }
                }
            }
        }