示例#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));
        }
示例#2
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);
        }
        /// <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];
            }
        }