• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Core.PropertyDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NAnt.Core.PropertyDictionary的典型用法代码示例。如果您正苦于以下问题:C# PropertyDictionary类的具体用法?C# PropertyDictionary怎么用?C# PropertyDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyDictionary类属于NAnt.Core命名空间,在下文中一共展示了PropertyDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConditionalConfigurator

            public ConditionalConfigurator(ConditionalElement element, XmlNode elementNode, PropertyDictionary properties, FrameworkInfo targetFramework)
                : base(element, elementNode, properties, targetFramework)
            {
                Type currentType = element.GetType();

                PropertyInfo ifdefined = currentType.GetProperty("IfDefined",
                    BindingFlags.NonPublic | BindingFlags.Instance);
                InitializeAttribute(ifdefined);

                if (!element.IfDefined) {
                    _enabled = false;
                } else {
                    PropertyInfo unlessDefined = currentType.GetProperty(
                        "UnlessDefined",
                        BindingFlags.NonPublic | BindingFlags.Instance);
                    InitializeAttribute(unlessDefined);
                    _enabled = !element.UnlessDefined;
                }

                if (!_enabled) {
                    // since we will not be processing other attributes or
                    // child nodes, clear these collections to avoid
                    // errors for unrecognized attributes/elements
                    UnprocessedAttributes.Clear();
                    UnprocessedChildNodes.Clear();
                }
            }
开发者ID:julianhaslinger,项目名称:nant,代码行数:27,代码来源:ConditionalElement.cs


示例2: ExpressionEvaluator

 /// <summary>
 /// Initializes a new instance of the <see cref="ExpressionEvaluator"/> class.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="properties">The projects properties.</param>
 /// <param name="state">The state.</param>
 /// <param name="visiting">The visiting.</param>
 public ExpressionEvaluator(Project project, PropertyDictionary properties, Hashtable state, Stack visiting)
     : base(project)
 {
     _properties = properties;
     _state = state;
     _visiting = visiting;
 }
开发者ID:nantos,项目名称:nant,代码行数:14,代码来源:ExpressionEvaluator.cs


示例3: Adds_value_by_key_if_key_does_not_exists

        public void Adds_value_by_key_if_key_does_not_exists()
        {
            PropertyDictionary properties = new PropertyDictionary(null);

            PropertyDictionaryHelper.AddOrUpdateInt(properties, Key, Value);

            Assert.AreEqual(int.Parse(properties[Key], CultureInfo.InvariantCulture), Value);
        }
开发者ID:stephen-czetty,项目名称:nant-extensions,代码行数:8,代码来源:When_properties_are_added_or_updated.cs


示例4: Adds_key_if_key_does_not_exists

        public void Adds_key_if_key_does_not_exists()
        {
            PropertyDictionary properties = new PropertyDictionary(null);

            PropertyDictionaryHelper.AddOrUpdateInt(properties, Key, Value);

            Assert.IsNotNull(properties[Key]);
        }
开发者ID:stephen-czetty,项目名称:nant-extensions,代码行数:8,代码来源:When_properties_are_added_or_updated.cs


示例5: InitializeXml

        protected override void InitializeXml(XmlNode elementNode, PropertyDictionary properties, FrameworkInfo framework)
        {
            XmlNode = elementNode;

            ConditionalConfigurator configurator = new ConditionalConfigurator(
                this, elementNode, properties, framework);
            configurator.Initialize();
        }
开发者ID:julianhaslinger,项目名称:nant,代码行数:8,代码来源:ConditionalElement.cs


示例6: Replaces_value_by_key_if_key_does_exists

        public void Replaces_value_by_key_if_key_does_exists()
        {
            PropertyDictionary properties = new PropertyDictionary(null);
            properties.Add(Key, ExistingValue.ToString());

            PropertyDictionaryHelper.SetInt(properties, Key, Value);

            Assert.AreEqual(int.Parse(properties[Key], CultureInfo.InvariantCulture), Value);
        }
开发者ID:stephen-czetty,项目名称:nant-extensions,代码行数:9,代码来源:When_properties_are_set.cs


示例7: Replaces_key_if_key_does_exists

        public void Replaces_key_if_key_does_exists()
        {
            PropertyDictionary properties = new PropertyDictionary(null);
            properties.Add(Key, ExistingValue.ToString());

            PropertyDictionaryHelper.SetInt(properties, Key, Value);

            Assert.IsNotNull(properties[Key]);
        }
开发者ID:stephen-czetty,项目名称:nant-extensions,代码行数:9,代码来源:When_properties_are_set.cs


示例8: Adds_value_to_existing_key_value

        public void Adds_value_to_existing_key_value()
        {
            PropertyDictionary properties = new PropertyDictionary(null);
            properties.Add(Key, ExistingValue.ToString());

            PropertyDictionaryHelper.AddOrUpdateInt(properties, Key, Value);

            Assert.AreEqual(int.Parse(properties[Key], CultureInfo.InvariantCulture), Value + ExistingValue);
        }
开发者ID:stephen-czetty,项目名称:nant-extensions,代码行数:9,代码来源:When_properties_are_added_or_updated.cs


示例9: Test_NullPropertyTest

        public void Test_NullPropertyTest()
        {
            const string xml = "<project><property name='temp.var' value='some.value'/></project>";
            Project p = CreateFilebasedProject(xml);
            PropertyDictionary d = new PropertyDictionary(p);
            TestDelegate assn = delegate() { d["temp.var"] = null; };

            Assert.Throws<BuildException>(assn,
                "Null values should not be allowed in PropertyDictionary");
        }
开发者ID:RoastBoy,项目名称:nant,代码行数:10,代码来源:PropertyDictionaryTest.cs


示例10: AddOrUpdateInt

		public static void AddOrUpdateInt(PropertyDictionary instance, string key, int value)
		{
			Ensure.ArgumentIsNotNull(instance, "instance");
			Ensure.ArgumentIsNotNullOrEmptyString(key, "key");

			int parsedValue;
			if (!int.TryParse(instance[key], out parsedValue))
			{
				parsedValue = 0;
			}

			parsedValue += value;
			instance[key] = parsedValue.ToString(CultureInfo.InvariantCulture);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:14,代码来源:PropertyDictionaryHelper.cs


示例11: RestoreProperties

        private static void RestoreProperties(ArrayList attributeList, Task task, PropertyDictionary oldValues)
        {
            PropertyDictionary projectProperties = task.Project.Properties;
            foreach (MacroAttribute macroAttribute in attributeList)
            {
                string localPropertyName = macroAttribute.LocalPropertyName;
                string oldValue = oldValues[localPropertyName];

                if (projectProperties.Contains(localPropertyName))
                    projectProperties.Remove(localPropertyName);
                if (oldValue != null)
                    projectProperties.Add(localPropertyName, oldValue);
            }
        }
开发者ID:harib,项目名称:macrodef,代码行数:14,代码来源:MacroDefInvocation.cs


示例12: SetInt

		public static void SetInt(PropertyDictionary instance, string key, int value)
		{
			Ensure.ArgumentIsNotNull(instance, "instance");
			Ensure.ArgumentIsNotNullOrEmptyString(key, "key");

			string valueToSet = value.ToString(CultureInfo.InvariantCulture);
			if (instance.Contains(key))
			{
				instance[key] = valueToSet;
			}
			else
			{
				instance.Add(key, valueToSet);
			}
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:15,代码来源:PropertyDictionaryHelper.cs


示例13: Execute

        public void Execute()
        {
            task.Log(Level.Verbose, "Running '" + name + "'");
            task.Project.Indent();
            try
            {
                PropertyDictionary oldPropertyValues = new PropertyDictionary(null);

                if (attributeList != null)
                    SetUpProperties(attributeList, task, invocationXml, oldPropertyValues);

                if (sequential != null)
                {
                    XmlNode invocationTasks = CreateInvocationTasks();
                    ExecuteInvocationTasks(invocationTasks);
                }

                RestoreProperties(attributeList, task, oldPropertyValues);
            }
            finally
            {
                task.Project.Unindent();
            }
        }
开发者ID:harib,项目名称:macrodef,代码行数:24,代码来源:MacroDefInvocation.cs


示例14: CreateChildBuildElement

            /// <summary>
            /// Creates a child <see cref="Element" /> using property set/get methods.
            /// </summary>
            /// <param name="propInf">The <see cref="PropertyInfo" /> instance that represents the property of the current class.</param>
            /// <param name="getter">A <see cref="MethodInfo" /> representing the get accessor for the property.</param>
            /// <param name="setter">A <see cref="MethodInfo" /> representing the set accessor for the property.</param>
            /// <param name="xml">The <see cref="XmlNode" /> used to initialize the new <see cref="Element" /> instance.</param>
            /// <param name="properties">The collection of property values to use for macro expansion.</param>
            /// <param name="framework">The <see cref="FrameworkInfo" /> from which to obtain framework-specific information.</param>
            /// <returns>The <see cref="Element" /> child.</returns>
            private Element CreateChildBuildElement(PropertyInfo propInf, MethodInfo getter, MethodInfo setter, XmlNode xml, PropertyDictionary properties, FrameworkInfo framework)
            {
                Element childElement = null;
                Type elementType = null;

                // if there is a getter, then get the current instance of the object, and use that
                if (getter != null) {
                    try {
                        childElement = (Element) propInf.GetValue(Element, null);
                    } catch (InvalidCastException) {
                        throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                            ResourceUtils.GetString("NA1188"),
                            propInf.Name, Element.GetType().FullName, propInf.PropertyType.FullName,
                            typeof(Element).FullName), Location);
                    }
                    if (childElement == null) {
                        if (setter == null) {
                            throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                ResourceUtils.GetString("NA1189"), propInf.Name,
                                Element.GetType().FullName), Location);
                        } else {
                            // fake the getter as null so we process the rest like there is no getter
                            getter = null;
                            logger.Info(string.Format(CultureInfo.InvariantCulture,"{0}_get() returned null; will go the route of set method to populate.", propInf.Name));
                        }
                    } else {
                        elementType = childElement.GetType();
                    }
                }

                // create a new instance of the object if there is no get method
                // or the get object returned null
                if (getter == null) {
                    elementType = setter.GetParameters()[0].ParameterType;
                    if (elementType.IsAbstract) {
                        throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
                            ResourceUtils.GetString("String_AbstractType"), elementType.Name, propInf.Name, Name));
                    }
                    childElement = (Element) Activator.CreateInstance(elementType, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, null , CultureInfo.InvariantCulture);
                }

                // initialize the child element
                childElement = Element.InitializeBuildElement(Element, xml, childElement, elementType);

                // check if we're dealing with a reference to a data type
                DataTypeBase dataType = childElement as DataTypeBase;
                if (dataType != null && xml.Attributes["refid"] != null) {
                    // references to data type should be always be set
                    if (setter == null) {
                        throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                            ResourceUtils.GetString("NA1190"),
                            propInf.Name, this.GetType().FullName), Location);
                    }
                    // re-set the getter (for force the setter to be used)
                    getter = null;
                }

                // call the set method if we created the object
                if (setter != null && getter == null) {
                    setter.Invoke(Element, new object[] {childElement});
                }

                // return the new/used object
                return childElement;
            }
开发者ID:anthonyheckmann,项目名称:NAnt-cvsclone,代码行数:75,代码来源:Element.cs


示例15: Initialize

        /// <summary>
        /// Performs initialization using the given set of properties.
        /// </summary>
        internal void Initialize(XmlNode elementNode, PropertyDictionary properties, FrameworkInfo framework)
        {
            if (Project == null) {
                throw new InvalidOperationException("Element has invalid Project property.");
            }

            // save position in buildfile for reporting useful error messages.
            try {
                _location = Project.LocationMap.GetLocation(elementNode);
            } catch (ArgumentException ex) {
                logger.Warn("Location of Element node could be located.", ex);
            }

            InitializeXml(elementNode, properties, framework);

            // allow inherited classes a chance to do some custom initialization
            InitializeElement(elementNode);
            Initialize();
        }
开发者ID:anthonyheckmann,项目名称:NAnt-cvsclone,代码行数:22,代码来源:Element.cs


示例16: TeamCityFunctions

		/// <summary>
		/// Initializes a new instance of the <see cref="TeamCityFunctions"/> class.
		/// </summary>
		/// <param name="project">The project.</param>
		/// <param name="properties">The properties.</param>
		public TeamCityFunctions(Project project, PropertyDictionary properties) : base(project, properties)
		{
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:8,代码来源:TeamCityFunctions.cs


示例17: Int64ConversionFunctions

 public Int64ConversionFunctions(Project project, PropertyDictionary properties)
     : base(project, properties)
 {
 }
开发者ID:vardars,项目名称:ci-factory,代码行数:4,代码来源:Int64Functions.cs


示例18: IsSSLEnabled

 private bool IsSSLEnabled(PropertyDictionary properties)
 {
     string enableSSL = GetPropertyValue(properties, "smtp.enablessl", null, false);
     if (enableSSL != null) {
         try {
             return bool.Parse (enableSSL);
         } catch (FormatException) {
             throw new ArgumentException (string.Format (CultureInfo.InvariantCulture,
                 "Invalid value '{0}' for MailLogger.smtp.enablessl property.",
                 enableSSL));
         }
     }
     return false;
 }
开发者ID:anthonyheckmann,项目名称:NAnt-cvsclone,代码行数:14,代码来源:Log.cs


示例19: DirectoryFunctions

 public DirectoryFunctions(Project project, PropertyDictionary properties)
     : base(project, properties)
 {
 }
开发者ID:jsargiot,项目名称:nant,代码行数:4,代码来源:DirectoryFunctions.cs


示例20: GetPropertyValue

        /// <summary>
        /// Gets the value of the specified property.
        /// </summary>
        /// <param name="properties">Properties to obtain value from.</param>
        /// <param name="name">Suffix of property name.  "MailLogger" will be prepended internally.</param>
        /// <param name="defaultValue">Value returned if property is not present in <paramref name="properties" />.</param>
        /// <param name="required">Value indicating whether the property should exist, or have a default value set.</param>
        /// <returns>
        /// The value of the specified property; or the default value if the 
        /// property is not present in <paramref name="properties" />.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="required" /> is <see langword="true" />, and the specified property is not present and no default value has been given.</exception>
        private string GetPropertyValue(PropertyDictionary properties, string name, string defaultValue, bool required)
        {
            string propertyName = "MailLogger." + name;
            string value = (string) properties[propertyName];

            if (value == null) {
                value = defaultValue;
            }

            if (required && value == null) {
                throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, "Missing required parameter {0}.", propertyName));
            }

            return value;
        }
开发者ID:anthonyheckmann,项目名称:NAnt-cvsclone,代码行数:27,代码来源:Log.cs



注:本文中的NAnt.Core.PropertyDictionary类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Tasks.MailTask类代码示例发布时间:2022-05-26
下一篇:
C# Core.Project类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap