Esempio n. 1
0
 public void Save()
 {
     lock (this)
     {
         m_settingsIni.Save();
     }
 }
Esempio n. 2
0
File: Editor.cs Progetto: psla/nini
        /// <summary>
        /// Sets a new key and value.
        /// </summary>
        private void SetKey()
        {
            string configName = GetArg("config");

            if (configName == null)
            {
                ThrowError("You must supply a config switch");
            }

            IConfigSource source = LoadSource(configPath);
            IConfig       config = GetConfig(source, configName);

            string[] keyValue = GetArg("set-key").Split(',');
            if (keyValue.Length < 2)
            {
                throw new Exception("Must supply KEY,VALUE");
            }
            config.Set(keyValue[0], keyValue[1]);
            source.Save();

            if (verbose)
            {
                PrintLine("Key " + keyValue[0] + " was saved as " + keyValue[1]);
            }
        }
Esempio n. 3
0
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service  = service;
            m_registry = registry;
            m_Database = Aurora.DataManager.DataManager.RequestPlugin <IInventoryData>();

            IConfig      libConfig          = source.Configs["InventoryIARLoader"];
            const string pLibrariesLocation = "DefaultInventory/";

            AddDefaultAssetTypes();
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("WipeLibrariesOnNextLoad", false))
                {
                    service.ClearDefaultInventory();//Nuke it
                    libConfig.Set("WipeLibrariesOnNextLoad", false);
                    source.Save();
                }
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                {
                    return; //If it is loaded, don't reload
                }
                foreach (string iarFileName in Directory.GetFiles(pLibrariesLocation, "*.iar"))
                {
                    LoadLibraries(iarFileName);
                }
            }
        }
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;
            m_registry = registry;
            m_Database = Framework.Utilities.DataManager.RequestPlugin<IInventoryData>();

            IConfig libConfig = source.Configs["InventoryIARLoader"];
            const string pLibrariesLocation = "DefaultInventory/";
            AddDefaultAssetTypes();
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("WipeLibrariesOnNextLoad", false))
                {
                    service.ClearDefaultInventory(); //Nuke it
                    libConfig.Set("WipeLibrariesOnNextLoad", false);
                    source.Save();
                }
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                    return; //If it is loaded, don't reload
                foreach (string iarFileName in Directory.GetFiles(pLibrariesLocation, "*.iar"))
                {
                    LoadLibraries(iarFileName);
                }
            }
        }
Esempio n. 5
0
 private void button2_Click(object sender, EventArgs e)
 {
     config.Configs["Directories"].Set("default", this.textBox1.Text);
     config.Configs["UI"].Set("arrowInverted", this.checkBox1.Checked);
     config.Configs["UI"].Set("defaultwidth", this.textBox2.Text);
     config.Configs["UI"].Set("defaultheight", this.textBox3.Text);
     config.Configs["UI"].Set("movespeed", this.label5.Text);
     config.Save();
     this.Close();
 }
Esempio n. 6
0
        /// <summary>
        /// Handles saving the file.
        /// </summary>
        private void saveIniButton_Click(object sender, System.EventArgs e)
        {
            source.Configs["Logging"].Set("File Name", logFileNameText.Text);
            source.Configs["Logging"].Set("MaxFileSize", maxFileSizeText.Text);

            source.Configs["User"].Set("Name", userNameText.Text);
            source.Configs["User"].Set("Email", userEmailText.Text);

            // Save the INI file
            source.Save();
        }
Esempio n. 7
0
File: Editor.cs Progetto: psla/nini
        /// <summary>
        /// Adds a new config.
        /// </summary>
        private void AddConfig()
        {
            IConfigSource source = LoadSource(configPath);

            source.AddConfig(GetArg("add"));

            source.Save();

            if (verbose)
            {
                PrintLine("Config was added: " + GetArg("add"));
            }
        }
        public void Save(Irc irc)
        {
            IConfig             server  = null;;
            string              host    = irc.Host;
            string              nick    = irc.Nick;
            string              user    = irc.Username;
            string              real    = irc.Realname;
            int                 port    = irc.Port;
            string              owner   = irc.Owner;
            string              nspass  = irc.NickPass;
            string              srvpass = irc.ServerPass;
            Stack <ChannelData> buffer  = irc.ChannelBuffer;

            if (!string.IsNullOrEmpty(nspass))
            {
                nspass = new SymCryptography(SymCryptography.ServiceProviderEnum.Rijndael).Encrypt(nspass);
            }

            // Last known code
            RFC1459.ReplyCode lkc    = irc.Code;
            ConsoleColor      colour = irc.Colour;

            if (config.Configs[irc.Server] == null)
            {
                server = config.AddConfig(irc.Server);
            }
            else
            {
                server = config.Configs[irc.Server];
            }

            server.Set("Host", host);
            server.Set("Port", port);
            server.Set("Nick", nick);
            server.Set("Server_Password", srvpass);
            server.Set("Username", user);
            server.Set("Realname", real);
            server.Set("NickPassword", nspass);
            server.Set("Owner", owner);
            server.Set("LastKnownCode", ( int )lkc);
            server.Set("Colour", ( int )colour);
            server.Set("MainChannel", "{nokey}");
            server.Set("MainKey", "{nokey}");

            if (buffer.Count > 0)
            {
                server.Set("Channels", string.Join(",", buffer.ToArray( )));
            }

            config.Save( );
        }
Esempio n. 9
0
File: Editor.cs Progetto: psla/nini
        /// <summary>
        /// Removes a key.
        /// </summary>
        private void RemoveKey()
        {
            string configName = GetArg("config");

            if (configName == null)
            {
                ThrowError("You must supply a config switch");
            }

            IConfigSource source = LoadSource(configPath);
            IConfig       config = GetConfig(source, configName);

            config.Remove(GetArg("remove-key"));
            source.Save();

            if (verbose)
            {
                PrintLine("Key removed: " + GetArg("remove-key"));
            }
        }
Esempio n. 10
0
File: Editor.cs Progetto: psla/nini
        /// <summary>
        /// Removes a config.
        /// </summary>
        private void RemoveConfig()
        {
            string configName = GetArg("remove");

            if (configName == null)
            {
                ThrowError("You must supply a config switch");
            }

            IConfigSource source = LoadSource(configPath);
            IConfig       config = GetConfig(source, configName);

            source.Configs.Remove(config);
            source.Save();

            if (verbose)
            {
                PrintLine("Config was removed: " + configName);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Event fired on save.
        /// </summary>
        /// <param name="config">Config to use.</param>
        public virtual void OnSave(object config)
        {
            Execute(() =>
            {
                Type settings = config.GetType();
                foreach (var prop in settings.GetProperties())
                {
                    if (!ExcludedProps.ContainsKey(prop.Name))
                    {
                        // 1. Get value.
                        object val = prop.GetValue(config, null);

                        // 2. Convert to string checking for min values. e.g. DateTime.Min,
                        // string valStr = Types.TypeParsers.ConvertTo<string>(val);

                        _configStore["", prop.Name] = val;
                    }
                }
                _configStore.Save();
            });
        }
Esempio n. 12
0
        private void SaveConfig()
        {
            if (toolTipToolStripMenuItem.Checked)
            {
                source.Configs["Features"].Set("Tooltip", "1");
            }
            else
            {
                source.Configs["Features"].Set("Tooltip", "0");
            }

            if (doubleClickEditToolStripMenuItem.Checked)
            {
                source.Configs["Features"].Set("DoubleClicked", "1");
            }
            else
            {
                source.Configs["Features"].Set("DoubleClicked", "0");
            }

            source.Configs["Features"].Set("Source_val", textBox3.Text);

            if (byStartToolStripMenuItem.Checked)
            {
                source.Configs["Features"].Set("SearchMode", "1");
            }
            if (byIndexOfToolStripMenuItem.Checked)
            {
                source.Configs["Features"].Set("SearchMode", "2");
            }
            if (byEndsWithToolStripMenuItem.Checked)
            {
                source.Configs["Features"].Set("SearchMode", "3");
            }

            source.Configs["Path"].Set("FileNarc", pathlock);
            source.Configs["Table"].Set("rows", "0x1A");

            source.Save();
        }
Esempio n. 13
0
 /// <summary>
 /// save the changes
 /// </summary>
 public void Save()
 {
     source.Save();
 }
Esempio n. 14
0
        public frmMain()
        {
            #if (DEBUG_1||DEBUG_2||DEBUG_3)
            debugLogger = new DebugLogger("frmMain.log");
            #endif
            debugLogger.WriteDebug_3("Begin Method: frmMain.frmMain()");

            InitializeComponent();

            Directory.SetCurrentDirectory(Directory.GetParent(Application.ExecutablePath).FullName);
            debugLogger.WriteDebug_2("Set Current Directory to " + Directory.GetParent(Application.ExecutablePath).FullName);

            // TODO: Determine why this is a double nested try/catch to load some INI settings
            try
            {
                inifile = new IniConfigSource(Directory.GetCurrentDirectory() + "\\settings.ini");
                DBString = inifile.Configs["Files"].GetString("dbfile","");
                LogFile = inifile.Configs["Files"].GetString("logfile","");
                OutputDirectory = inifile.Configs["Files"].GetString("outdir","");
                DKPTax = inifile.Configs["Other"].GetDouble("tax",0.0);
                MinDKP = inifile.Configs["Other"].GetDouble("mindkp", 0);
                TierAPct = inifile.Configs["Other"].GetDouble("tierapct", 0.6);
                TierBPct = inifile.Configs["Other"].GetDouble("tierbpct", 0.3);
                TierCPct = inifile.Configs["Other"].GetDouble("tiercpct", 0.0);
                GuildNames = inifile.Configs["Other"].GetString("GuildNames", "Eternal Sovereign");
                debugLogger.WriteDebug_1("Read settings from INI: DBFile=" + DBString + ", LogFile=" + LogFile + ", OutputDirectory="
                    + OutputDirectory + ", DKPTax=" + DKPTax + ", GuildNames=" + GuildNames);

                StatusMessage ="Read settings from INI...";
                try
                {
                    parser = new LogParser(this,LogFile);
                    debugLogger.WriteDebug_3("Created log parser");
                }
                catch (Exception ex) {
                    debugLogger.WriteDebug_1("Failed to create log parser: " + ex.Message);
                }
            }
            catch (FileNotFoundException ex)
            {
                debugLogger.WriteDebug_3("settings.ini not found, creating");

                FileStream a = File.Create(Directory.GetCurrentDirectory() + "\\settings.ini");
                a.Close();
                sbpMessage.Text = "settings.ini not found... Loading defaults";
                try
                {
                    inifile = new IniConfigSource(Directory.GetCurrentDirectory() + "\\settings.ini");
                    inifile.AddConfig("Files");
                    inifile.AddConfig("Other");
                    LogFile = inifile.Configs["Files"].GetString("logfile","");
                    DBString = inifile.Configs["Files"].GetString("dbfile","");
                    OutputDirectory = inifile.Configs["Files"].GetString("outdir","");
                    DKPTax = inifile.Configs["Other"].GetDouble("tax",0.0);
                    MinDKP = inifile.Configs["Other"].GetDouble("mindkp", 0);
                    TierAPct = inifile.Configs["Other"].GetDouble("tierapct", 0.6);
                    TierBPct = inifile.Configs["Other"].GetDouble("tierbpct", 0.3);
                    TierCPct = inifile.Configs["Other"].GetDouble("tiercpct", 0.0);
                    GuildNames = inifile.Configs["Other"].GetString("GuildNames", "Eternal Sovereign");
                    inifile.Save();
                    debugLogger.WriteDebug_1("Read settings from INI: dbFile=" + DBString + ", logFile=" + LogFile
                        + ", outDir=" + OutputDirectory + ", tax=" + DKPTax + ", mindkp=" + MinDKP + ", GuildNames=" + GuildNames);
                }
                catch (Exception exc)
                {
                    debugLogger.WriteDebug_1("Failed to create new settings.ini: " + exc.Message);
                    MessageBox.Show("Error opening settings.ini","Error");
                    Environment.Exit(1);
                }
            }
            catch (Exception ex)
            {
                debugLogger.WriteDebug_1("Failed to load settings.ini: " + ex.Message);
                MessageBox.Show("Error opening settings.ini","Error");
                Environment.Exit(1);
            }
            UITimer = new Timer();
            UITimer.Interval = 100;
            UITimer.Tick += new EventHandler(UITimer_Tick);
            UITimer.Start();

            debugLogger.WriteDebug_3("End Method: frmMain.frmMain()");
        }
 /// <summary>
 /// Save the configuration
 /// </summary>
 public void Save()
 {
     _provider.Save();
 }
Esempio n. 16
0
 public void Set(string sectionName, string keyName, object value)
 {
     source.Configs[sectionName].Set(keyName, value);
     source.Save();
     source.Reload();
 }
Esempio n. 17
0
        /// <summary>
        /// Saves the current values to the config file.
        /// </summary>
        /// <returns>Whether or not the save action was successful.</returns>
        public bool Save()
        {
            bool retval;

            try
            {
                _config.Configs["subversion"].Set("serverdir", _serverRootDirectory);
                _config.Configs["subversion"].Set("commanddir", _commandRootDirectory);

                if (_usersGlobalConfigFile)
                {
                    _config.Configs["subversion"].Set("globalconfigdir", _globalConfigFilePath);
                }
                else
                {
                    _config.Configs["subversion"].Set("globalconfigdir", string.Empty);
                }

                _config.Configs["repositories"].Set("reporoot", _repositoryRootDirectory);
                _config.Configs["repositories"].Set("mode", _repoMode);
                _config.Save();

                retval = true;
            }
            catch (NullReferenceException)
            {
                string path = "";

                if (_configFilePath.Length > 0 && _configFileName.Length > 0)
                {
                    path = Path.Combine(_configFilePath, _configFileName);
                }
                else
                {
                    FileInfo fi;
                    fi = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().FullName);
                    if (fi.DirectoryName != null)
                    {
                        path = Path.Combine(fi.DirectoryName, _defaultConfigFileName);
                    }
                }

                var configWriter = new StreamWriter(path);

                configWriter.WriteLine("[subversion]");
                configWriter.WriteLine("; This is the root directory for the Subversion installation.");
                configWriter.WriteLine("serverdir = " + _serverRootDirectory);
                configWriter.WriteLine("; This is the actual directory where the command line executables are.");
                configWriter.WriteLine("commanddir = " + _commandRootDirectory);

                if (_usersGlobalConfigFile)
                {
                    configWriter.WriteLine("; This is the location of the global svnserve.conf file.");
                    configWriter.WriteLine("globalconfigdir = " + _globalConfigFilePath);
                }

                configWriter.WriteLine("[repositories]");
                configWriter.WriteLine("; This is a flag to tell what mode the repositories are setup.");
                configWriter.WriteLine("; root = all repositories are under one directory");
                configWriter.WriteLine("; custom = each repository is in a separate directory");
                configWriter.WriteLine("mode = " + _repoMode);
                configWriter.WriteLine("; This is the root directory for the repositories.");
                configWriter.WriteLine("reporoot = " + _repositoryRootDirectory);

                configWriter.Close();

                retval = true;
            }
            catch (Exception)
            {
                retval = false;
            }

            return(retval);
        }
Esempio n. 18
0
 /// <summary>
 /// Saves this instance.
 /// </summary>
 public void Save()
 {
     _configSource.Save();
 }
Esempio n. 19
0
 /// <summary>
 /// Save the configuration.
 /// </summary>
 public static void Save()
 {
     _current.Save();
 }
Esempio n. 20
0
 /// <summary>
 /// Saves changes to user.config
 /// </summary>
 public static void Save()
 {
     configSource.Save();
 }