Exemplo n.º 1
0
        public static bool Exists(string dictName)
        {
            #region Preconditions
            if (String.IsNullOrEmpty(dictName))
            {
                throw new ArgumentException("dictName cannot be null or empty");
            }
            #endregion

            return(DictionaryManager.DictionaryExists(dictName));
        }
Exemplo n.º 2
0
        public static int Count(string dictName)
        {
            #region Preconditions
            if (String.IsNullOrEmpty(dictName))
            {
                throw new ArgumentException("dictName cannot be null or empty");
            }
            #endregion

            return(DictionaryManager.GetDictionary(dictName).Count);
        }
Exemplo n.º 3
0
        public static string GetValue(string dictName, string key)
        {
            #region Preconditions
            if (String.IsNullOrEmpty(dictName))
            {
                throw new ArgumentException("dictName cannot be null or empty");
            }
            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentException("key cannot be null or empty");
            }
            #endregion

            return(DictionaryManager.GetDictionary(dictName)[key]);
        }
Exemplo n.º 4
0
        public static bool IsEmpty(string dictName)
        {
            #region Preconditions
            if (String.IsNullOrEmpty(dictName))
            {
                throw new ArgumentException("dictName cannot be null or empty");
            }
            #endregion

            if (!DictionaryManager.DictionaryExists(dictName))
            {
                return(true);
            }
            return(DictionaryManager.GetDictionary(dictName).Count == 0);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Execute the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            base.ExecuteTask();

            if (DictionaryManager.DictionaryExists(NewDictionaryName))
            {
                throw new BuildException(string.Format("Dictionary with name [{0}] already exists.", NewDictionaryName));
            }

            IDictionary <string, string> newDictionary = DictionaryManager.GetDictionary(NewDictionaryName);

            foreach (string key in Dictionary.Keys)
            {
                newDictionary[key] = Dictionary[key];
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Execute the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            IDictionary <string, string> dict = DictionaryManager.GetDictionary(DictionaryName);

            foreach (string key in dict.Keys)
            {
                if (KeyProperty != null)
                {
                    NAntUtility.AddOrOverwriteProperty(Project, KeyProperty, key);
                }
                if (ValueProperty != null)
                {
                    NAntUtility.AddOrOverwriteProperty(Project, ValueProperty, dict[key]);
                }

                // Base execute handles executing all child tasks.
                base.ExecuteTask();
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Execute the task.
 /// </summary>
 protected override void ExecuteTask()
 {
     _dictionary = DictionaryManager.GetDictionary(DictionaryName);
 }