Beispiel #1
0
        /// <summary>
        /// Creates a new Config File and a new MCEBuddyConf object with parameters copied from the individual options objects passed.
        /// If no config file is specified, default values are initialized and no config file is written
        /// </summary>
        /// <param name="configFile">Config file to write to</param>
        /// <param name="go">GeneralOptions parameters</param>
        /// <param name="mjoList">List of MonitorJobOption parameters</param>
        /// <param name="cjoList">List of ConversionJobOption parameters</param>
        public MCEBuddyConf(GeneralOptions go, List<MonitorJobOptions> mjoList, List<ConversionJobOptions> cjoList, string configFile = "")
        {
            if (configFile == null)
                configFile = ""; // don't use null as it leads to excessive reads / writes of win.ini

            mceBuddyConfSettings.conversionTasks = new List<ConversionJobOptions>();
            mceBuddyConfSettings.monitorTasks = new List<MonitorJobOptions>();
            mceBuddyConfSettings.generalOptions = new GeneralOptions();

            mceBuddyConfSettings.generalOptions = go.Clone();
            
            foreach (MonitorJobOptions mjo in mjoList)
                AddOrUpdateMonitorTask(mjo, false);
            
            foreach (ConversionJobOptions cjo in cjoList)
                AddOrUpdateConversionTask(cjo, false);

            if (!String.IsNullOrEmpty(configFile))
            {
                configIni = new Ini(configFile);
                WriteSettings();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Update the General Options, optionally write to file
        /// </summary>
        /// <param name="go">General options settings</param>
        /// <param name="write">Write to configuration file immediately</param>
        public void UpdateGeneralOptions(GeneralOptions go, bool write)
        {
            // Clone it, to avoid conflict
            mceBuddyConfSettings.generalOptions = go.Clone();

            if (write)
                WriteGeneralSettings(configIni);
        }