/// <summary>
 /// Determines whether the dictionary contains the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns><c>true</c> if the dictionary contains the specified value; else <c>false.</c></returns>
 public bool ContainsValue(DataTypeBase value)
 {
     return _innerHash.ContainsValue(value);
 }
 /// <summary>
 /// Copies the Hashtable elements to a one-dimensional Array instance at the specified index.
 /// </summary>
 /// <param name="array">The one-dimensional Array that is the destination of the DictionaryEntry objects copied from Hashtable. The Array must have zero-based indexing.</param>
 /// <param name="index">The zero-based index in array at which copying begins.</param>
 public void CopyTo(DataTypeBase[] array, int index)
 {
     _innerHash.CopyTo(array, index);
 }
 /// <summary>
 /// Adds the specified key and value to the dictionary.
 /// </summary>
 /// <param name="key">The key of the element to add.</param>
 /// <param name="value">The value of the element to add.</param>
 public void Add(string key, DataTypeBase value)
 {
     _innerHash.Add (key, value);
 }
Exemple #4
0
        /// <summary>
        /// Copies all instance data of the <see cref="DataTypeBase" /> to a given
        /// <see cref="DataTypeBase" />.
        /// </summary>
        protected void CopyTo(DataTypeBase clone)
        {
            base.CopyTo(clone);

            clone._id = _id;
            clone._refID = _refID;
        }
Exemple #5
0
        /// <summary>
        /// Executes this target
        /// </summary>
        /// <param name="callStack">The current call stack on which this target will be pused</param>
        /// <param name="logger">The logger this target and its stasks will use for logging messages</param>
        /// <param name="arguments">Optionally, the arguments to provide to the target.  Should match those required by <see cref="Parameters"/></param>
        /// <exception cref="ArgumentException">If one of the non-defaulted parameters is not satisfied by an argument.</exception>
        private void DoExecute(TargetCallStack callStack, ITargetLogger logger, IList <CallArgument> arguments = null)
        {
            var propertyAccessor = new PropertyAccessor(this.Project, callStack);

            var sw = Stopwatch.StartNew();

            if (IfDefined(propertyAccessor) && !UnlessDefined(propertyAccessor))
            {
                try
                {
                    using (callStack.Push(this, logger))
                    {
                        this.PrepareArguments(arguments, callStack);

                        Project.OnTargetStarted(this, new TargetBuildEventArgs(this, sw));
                        logger.OnTargetLoggingStarted(this, new TargetBuildEventArgs(this, sw));

                        var paramtersDone = false;

                        // select all the task nodes and execute them
                        foreach (XmlNode childNode in XmlNode)
                        {
                            if (!(childNode.NodeType == XmlNodeType.Element) || !childNode.NamespaceURI.Equals(NamespaceManager.LookupNamespace("nant")))
                            {
                                continue;
                            }

                            if (childNode.Name.Equals("parameters"))
                            {
                                if (paramtersDone)
                                {
                                    throw new BuildException("parameters must appear before all tasks", this.Location);
                                }

                                continue;
                            }
                            else
                            {
                                paramtersDone = true;
                                if (TypeFactory.TaskBuilders.Contains(childNode.Name))
                                {
                                    Task task = Project.CreateTask(childNode, this, callStack);
                                    if (task != null)
                                    {
                                        task.Execute();
                                    }
                                }
                                else if (TypeFactory.DataTypeBuilders.Contains(childNode.Name))
                                {
                                    DataTypeBase dataType = Project.CreateDataTypeBase(childNode, callStack);
                                    logger.Log(Level.Verbose, "Adding a {0} reference with id '{1}'.",
                                               childNode.Name, dataType.ID);
                                    if (!Project.DataTypeReferences.Contains(dataType.ID))
                                    {
                                        Project.DataTypeReferences.Add(dataType.ID, dataType);
                                    }
                                    else
                                    {
                                        Project.DataTypeReferences[dataType.ID] = dataType; // overwrite with the new reference.
                                    }
                                }
                                else
                                {
                                    throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                                                           ResourceUtils.GetString("NA1071"),
                                                                           childNode.Name), Project.LocationMap.GetLocation(childNode));
                                }
                            }
                        }
                    }
                }
                finally
                {
                    _executed = true;
                    sw.Stop();
                    Project.OnTargetFinished(this, new TargetBuildEventArgs(this, sw));
                    logger.OnTargetLoggingFinished(this, new TargetBuildEventArgs(this, sw));
                }
            }
        }
Exemple #6
0
 /// <summary>
 /// Determines whether the dictionary contains the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns><c>true</c> if the dictionary contains the specified value; else <c>false.</c></returns>
 public bool ContainsValue(DataTypeBase value)
 {
     return(_innerHash.ContainsValue(value));
 }
Exemple #7
0
 /// <summary>
 /// Adds the specified key and value to the dictionary.
 /// </summary>
 /// <param name="key">The key of the element to add.</param>
 /// <param name="value">The value of the element to add.</param>
 public void Add(string key, DataTypeBase value)
 {
     _innerHash.Add(key, value);
 }