/// <summary>
        /// Defines user-variable
        /// Value setted as unevaluated
        /// </summary>
        /// <param name="name">variable name</param>
        /// <param name="project">project name or null if project is default</param>
        /// <param name="unevaluated">mixed string. Converted to empty string if value is null</param>
        public void set(string name, string project, string unevaluated)
        {
            if (!isValidName(name) || !isValidProject(project))
            {
                throw new InvalidArgumentException("name - '{0}' or project - '{1}' is not valid for variable", name, project);
            }
            string defindex = defIndex(name, project);

            if (unevaluated == null)
            {
                unevaluated = String.Empty;
            }

            lock (_lock)
            {
                definitions[defindex] = new TUserVariable()
                {
                    unevaluated = unevaluated,
                    ident       = defindex,
                    name        = name,
                    project     = project,
                    status      = TUserVariable.StatusType.Unevaluated,
                    prev        = (definitions.ContainsKey(defindex))? definitions[defindex] : new TUserVariable(),
                    evaluated   = null
                };
                Log.Debug("User-variable: defined '{0}' = '{1}'", defindex, unevaluated);
            }
        }
        /// <summary>
        /// Evaluation user-variable with IEvaluator by using unique identification
        /// Evaluated value should be updated for variable.
        /// </summary>
        /// <param name="ident">Unique identificator</param>
        /// <param name="evaluator">IEvaluator objects for evaluating</param>
        /// <param name="resetting">Evaluating from the unevaluated data if true, otherwise evaluation in the chain of others IEvaluator's</param>
        public void evaluate(string ident, IEvaluator evaluator, bool resetting)
        {
            lock (_lock)
            {
                if (!definitions.ContainsKey(ident))
                {
                    throw new NotFoundException("Variable '{0}' is not found.", ident);
                }

                if (evaluator == null)
                {
                    throw new InvalidArgumentException("Evaluation of variable: evaluator is null");
                }

                TUserVariable var = new TUserVariable(definitions[ident])
                {
                    status = TUserVariable.StatusType.Started
                };
                definitions[ident] = var;

                if (resetting)
                {
                    var.evaluated = evaluator.evaluate(var.unevaluated);
                }
                else
                {
                    var.evaluated = evaluator.evaluate(var.evaluated);
                }
                var.status         = TUserVariable.StatusType.Evaluated;
                definitions[ident] = var;
                Log.Trace("IEvaluator '{0}': Evaluation of variable '{1}' is completed.", evaluator.GetType().ToString(), ident);
            }
        }
        /// <summary>
        /// Re/Defines user-variable with evaluated value.
        /// </summary>
        /// <param name="ident">Unique identificator</param>
        /// <param name="evaluated">mixed string with evaluated data</param>
        public void debSetEvaluated(string ident, string evaluated)
        {
            if (evaluated == null)
            {
                evaluated = String.Empty;
            }

            lock (_lock)
            {
                definitions[ident] = new TUserVariable()
                {
                    unevaluated = evaluated,
                    ident       = ident,
                    status      = TUserVariable.StatusType.Evaluated,
                    prev        = (definitions.ContainsKey(ident))? definitions[ident] : new TUserVariable(),
                    evaluated   = evaluated
                };
                Log.Debug("User-variable(Debug service): updated '{0}' with evaluated value '{1}'", ident, evaluated);
            }
        }
Example #4
0
        protected void defProperty(TUserVariable uvar, Project project)
        {
            if(uvar.status != TUserVariable.StatusType.Started) {
                setGlobalProperty(project, uvar.ident, getUVariableValue(uvar.ident));
                return;
            }

            if(uvar.prev != null && ((TUserVariable)uvar.prev).unevaluated != null)
            {
                TUserVariable prev = (TUserVariable)uvar.prev;
                setGlobalProperty(project, uvar.ident, (prev.evaluated == null)? prev.unevaluated : prev.evaluated);
            }
        }
Example #5
0
        /// <summary>
        /// Re/Defines user-variable with evaluated value.
        /// </summary>
        /// <param name="ident">Unique identificator</param>
        /// <param name="evaluated">mixed string with evaluated data</param>
        public void debSetEvaluated(string ident, string evaluated)
        {
            if(evaluated == null) {
                evaluated = String.Empty;
            }

            lock(_lock)
            {
                definitions[ident] = new TUserVariable() {
                    unevaluated = evaluated,
                    ident       = ident,
                    status      = TUserVariable.StatusType.Evaluated,
                    prev        = (definitions.ContainsKey(ident))? definitions[ident] : new TUserVariable(),
                    evaluated   = evaluated
                };
                Log.Debug("User-variable(Debug service): updated '{0}' with evaluated value '{1}'", ident, evaluated);
            }
        }
Example #6
0
        /// <summary>
        /// Defines user-variable
        /// Value setted as unevaluated
        /// </summary>
        /// <param name="name">variable name</param>
        /// <param name="project">project name or null if project is default</param>
        /// <param name="unevaluated">mixed string. Converted to empty string if value is null</param>
        public void set(string name, string project, string unevaluated)
        {
            if(!isValidName(name) || !isValidProject(project)) {
                throw new InvalidArgumentException("name - '{0}' or project - '{1}' is not valid for variable", name, project);
            }
            string defindex = defIndex(name, project);

            if(unevaluated == null) {
                unevaluated = String.Empty;
            }

            lock(_lock)
            {
                definitions[defindex] = new TUserVariable() {
                    unevaluated = unevaluated,
                    ident       = defindex,
                    name        = name,
                    project     = project,
                    status      = TUserVariable.StatusType.Unevaluated,
                    prev        = (definitions.ContainsKey(defindex))? definitions[defindex] : new TUserVariable(),
                    evaluated   = null
                };
                Log.Debug("User-variable: defined '{0}' = '{1}'", defindex, unevaluated);
            }
        }
Example #7
0
        /// <summary>
        /// Evaluation user-variable with IEvaluator by using unique identification
        /// Evaluated value should be updated for variable.
        /// </summary>
        /// <param name="ident">Unique identificator</param>
        /// <param name="evaluator">IEvaluator objects for evaluating</param>
        /// <param name="resetting">Evaluating from the unevaluated data if true, otherwise evaluation in the chain of others IEvaluator's</param>
        public void evaluate(string ident, IEvaluator evaluator, bool resetting)
        {
            lock(_lock)
            {
                if(!definitions.ContainsKey(ident)) {
                    throw new NotFoundException("Variable '{0}' is not found.", ident);
                }

                if(evaluator == null) {
                    throw new InvalidArgumentException("Evaluation of variable: evaluator is null");
                }

                TUserVariable var = new TUserVariable(definitions[ident]) {
                    status = TUserVariable.StatusType.Started
                };
                definitions[ident] = var;

                if(resetting) {
                    var.evaluated = evaluator.evaluate(var.unevaluated);
                }
                else {
                    var.evaluated = evaluator.evaluate(var.evaluated);
                }
                var.status          = TUserVariable.StatusType.Evaluated;
                definitions[ident]  = var;
                Log.Trace("IEvaluator '{0}': Evaluation of variable '{1}' is completed.", evaluator.GetType().ToString(), ident);
            }
        }
        /// <summary>
        /// Evaluation user-variable with IEvaluator by using unique identification
        /// Evaluated value should be updated for variable.
        /// </summary>
        /// <param name="ident">Unique identificator</param>
        /// <param name="msbuild">IEvaluator objects for evaluating</param>
        /// <param name="resetting">Evaluating from the unevaluated data if true, otherwise evaluation in the chain of others IEvaluator's</param>
        public void evaluate(string ident, IEvaluator evaluator, bool resetting)
        {
            lock(_lock)
            {
                if(!definitions.ContainsKey(ident)) {
                    throw new NotFoundException("Variable '{0}' not found", ident);
                }

                if(evaluator == null) {
                    throw new InvalidArgumentException("evaluation of variable: evaluator is null");
                }

                TUserVariable var = new TUserVariable(definitions[ident]) {
                    status = TUserVariable.StatusType.Started
                };
                definitions[ident] = var;

                if(resetting) {
                    var.evaluated = evaluator.evaluate(var.unevaluated);
                }
                else {
                    var.evaluated = evaluator.evaluate(var.evaluated);
                }
                var.status          = TUserVariable.StatusType.Evaluated;
                definitions[ident]  = var;
                Log.Debug("Completed evaluation of variable with IEvaluator :: '{0}'", ident);
            }
        }