Esempio n. 1
0
        public static ReadConfigurationTask FromString(string configurationString)
        {
            ReadConfigurationTask task = new ReadConfigurationTask();

            task.configurationString = configurationString;
            return(task);
        }
Esempio n. 2
0
        public static ReadConfigurationTask FromFile(string fileName)
        {
            ReadConfigurationTask task = new ReadConfigurationTask();

            task.configurationFileName = fileName;
            return(task);
        }
        /// <summary>
        /// Reads configuration from a file.
        /// </summary>
        /// <param name="environment">The script execution environment.</param>
        /// <param name="configurationFileName">The name of the configuration file.</param>
        public static void ReadFromFile(IScriptExecutionEnvironment environment, string configurationFileName)
        {
            if (environment == null)
            {
                throw new ArgumentNullException("environment");
            }

            if (configurationFileName == null)
            {
                throw new ArgumentNullException("configurationFileName");
            }

            ReadConfigurationTask task = new ReadConfigurationTask();

            task.configurationFileName = configurationFileName;
            task.Execute(environment);
        }
        /// <summary>
        /// Reads configuration from a configuration file which has the same name as the running script.
        /// </summary>
        /// <param name="environment">The script execution environment.</param>
        public static void ReadFromScriptConfigurationFile(IScriptExecutionEnvironment environment)
        {
            if (environment == null)
            {
                throw new ArgumentNullException("environment");
            }

            ReadConfigurationTask task = new ReadConfigurationTask();
            string configFileName      = String.Format(
                System.Globalization.CultureInfo.InvariantCulture,
                "{0}.config",
                environment.ScriptName);

            task.configurationFileName = Path.Combine(
                Environment.CurrentDirectory,
                configFileName);
            task.Execute(environment);
        }