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

C# AttributeNode类代码示例

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

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



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

示例1: CheckForProblems

        private ProblemCollection CheckForProblems(AttributeNode attribute)
        {
			if (SemanticRulesUtilities.HasAttribute<ServiceContractAttribute>(attribute))
			{
				// reset the hasUnmatchedMessageHandler flag for each new type
				hasUnmatchedMessageHandler = false;
				return base.Problems;
			}

			string action = SemanticRulesUtilities.GetAttributeValue<String>(attribute, "Action");
			if (SemanticRulesUtilities.HasAttribute<OperationContractAttribute>(attribute) &&
				!string.IsNullOrEmpty(action) &&
				 action.Equals("*", StringComparison.OrdinalIgnoreCase))
			{
				// check if we already inspected another operation with unmatched message handler
				if (hasUnmatchedMessageHandler)
				{
					Resolution resolution = base.GetResolution();
					Problem problem = new Problem(resolution, attribute.SourceContext);
					base.Problems.Add(problem);
					return base.Problems;
				}
				hasUnmatchedMessageHandler = true;
			}
            return base.Problems;
        }
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:26,代码来源:MultipleUnmatchedMessageHandlers.cs


示例2: GetClosestMatch

 public virtual AttributeNode GetClosestMatch(AttributeNode/*!*/ nd1, AttributeList/*!*/ list1, AttributeList list2, int list1pos, ref int list2start,
   TrivialHashtable/*!*/ matchedNodes, out Differences closestDifferences, out int list2pos) {
   closestDifferences = null; list2pos = -1;
   if (list2 == null) return null;
   if (nd1 == null || list1 == null || matchedNodes == null ||  list1pos < 0 || list1pos >= list1.Count || list2start < 0 || list2start >= list2.Count) {
     Debug.Assert(false); return null;
   }
   AttributeNode closest = null;
   Differences winnerSoFar = null;
   for (int j = list2start, m = list2.Count; j < m; j++){
     AttributeNode nd2 = list2[j];
     if (list2start == j) list2start++;
     if (nd2 == null) continue;
     if (matchedNodes[nd2.UniqueKey] != null) continue;
     Differences diff = this.GetDifferences(nd1, nd2);
     if (diff == null){Debug.Assert(false); continue;}
     if (diff.Similarity <= 0.5){
       //Not a good enough match
       if (list2start == j+1) list2start--; //The next call to GetClosestMatch will start looking at list2start, so this node will be considered then
       continue; //ignore it for the rest of this call
     }
     if (winnerSoFar != null && winnerSoFar.Similarity >= diff.Similarity) continue;
     winnerSoFar = closestDifferences = diff;
     closest = nd2;
     list2pos = j;
     if (diff.NumberOfDifferences == 0) return closest; //Perfect match, no need to look for other matches
   }
   if (closest != null){
     //^ assert winnerSoFar != null;
     //closest is closer to nd1 than any other node in list2, but this is no good if some other node in list1 has a better claim on closest
     for (int i = list1pos+1, n = list1.Count; i < n; i++){
       AttributeNode nd1alt = list1[i];
       if (nd1alt == null) continue;
       if (matchedNodes[nd1alt.UniqueKey] != null) continue;
       Differences diff = this.GetDifferences(nd1alt, closest);
       if (diff == null){Debug.Assert(false); continue;}
       if (diff.Similarity <= winnerSoFar.Similarity) continue;
       //nd1alt has a better claim on closest. See if it wants closest.
       Differences diff2;
       int j, k = list2start;
       AttributeNode nd2alt = this.GetClosestMatch(nd1alt, list1, list2, i, ref k,  matchedNodes, out diff2, out j);
       if (nd2alt != closest){
         Debug.Assert(nd2alt != null && diff2 != null && diff2.Similarity >= diff.Similarity);
         continue; //nd1alt prefers nd2alt to closest, so closest is still available
       }
       //nd1alt wants closest, take it out of the running
       matchedNodes[closest.UniqueKey] = nd1alt;
       //Now that closest is out of the running, try again
       k = list2start;
       AttributeNode newClosest = this.GetClosestMatch(nd1, list1, list2, i, ref k, matchedNodes, out winnerSoFar, out list2pos);
       //put closest back in the running so that the next call to this routine will pick it up
       matchedNodes[closest.UniqueKey] = closest;
       closest = newClosest;
       break;
     }
   }
   closestDifferences = winnerSoFar;
   return closest;
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:59,代码来源:Comparer.cs


示例3: IsFragment

 public static bool IsFragment(AttributeNode attribute)
 {
     ArgumentUtility.CheckNotNull ("attribute", attribute);
       string fragmentFullName = typeof (FragmentAttribute).FullName;
       bool isFragment = attribute.Type.FullName == fragmentFullName;
       bool isFragmentChild = attribute.Type.BaseType.FullName == fragmentFullName;
       return isFragment || isFragmentChild;
 }
开发者ID:rubicon-oss,项目名称:InjectionCop,代码行数:8,代码来源:FragmentTools.cs


示例4: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.InnerRange == null || element.GetText(element.InnerRange).Trim().Length == 0)
                return null;

            string displayText = element.Children.Count == 0 ? "Remove HTML tag" : "Remove and keep children";

            return new HtmlRemoveParentSmartTag(textView, textBuffer, element, displayText);
        }
开发者ID:EdsonF,项目名称:WebEssentials2013,代码行数:9,代码来源:HtmlRemoveParentSmartTag.cs


示例5: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.IsStyleBlock() || element.IsJavaScriptBlock())
            {
                return new HtmlMinifySmartTag(textView, textBuffer, element);
            }

            return null;
        }
开发者ID:EdsonF,项目名称:WebEssentials2013,代码行数:9,代码来源:HtmlMinifyLanguageSmartTag.cs


示例6: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.Children.Count > 0)
            {
                return new HtmlRemoveParentSmartTag(textView, textBuffer, element);
            }

            return null;
        }
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:9,代码来源:HtmlRemoveParentSmartTag.cs


示例7: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (IsEnabled(element))
            {
                return new OptimizeImageSmartTag(textView, textBuffer, element);
            }

            return null;
        }
开发者ID:Gordon-Beeming,项目名称:WebEssentials2013,代码行数:9,代码来源:OptimizeImageSmartTag.cs


示例8: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if ((element.IsStyleBlock() || element.IsJavaScriptBlock()) && element.InnerRange.Length > 5)
            {
                return new ExtractToFileSmartTag(textView, textBuffer, element);
            }

            return null;
        }
开发者ID:hanskishore,项目名称:WebEssentials2013,代码行数:9,代码来源:ExtractToFileSmartTag.cs


示例9: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.GetAttribute("ng-controller") != null)
            {
                return new HtmlAngularControllerSmartTag(textView, textBuffer, element);
            }

            return null;
        }
开发者ID:vikramgoudr,项目名称:WebEssentials2013,代码行数:9,代码来源:HtmlAngularControllerSmartTag.cs


示例10: WhileLoopStatementNode

        public WhileLoopStatementNode(ExpressionNode conditionExpression, StatementNodeBase body, AttributeNode[] attributes)
            : base(body, attributes)
        {
            if (conditionExpression == null)
                throw new ArgumentNullException("conditionExpression", "The ConditionExpression is null!");

            ConditionExpression = conditionExpression;
            AddChildren(ConditionExpression);
        }
开发者ID:szabototo89,项目名称:MetaCode,代码行数:9,代码来源:WhileLoopStatementNode.cs


示例11: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.GetAttribute("class") == null)
            {
                return new $safeitemname$SmartTag(textView, textBuffer, element);
            }

            return null;
        }
开发者ID:GProulx,项目名称:side-waffle,代码行数:9,代码来源:AddClassSmartTag.cs


示例12: While

        public WhileLoopStatementNode While(ExpressionNode condition, StatementNodeBase body, AttributeNode[] attributes)
        {
            if (condition == null)
                ThrowHelper.ThrowArgumentNullException(() => condition);

            if (attributes == null)
                ThrowHelper.ThrowArgumentNullException(() => attributes);

            return new WhileLoopStatementNode(condition, body, attributes);
        }
开发者ID:szabototo89,项目名称:MetaCode,代码行数:10,代码来源:StatementFactory.cs


示例13: GetAttributeValue

 public static Literal GetAttributeValue( AttributeNode attr, int index ) {
   Debug.Assert( attr != null && index >= 0 && index < attr.Expressions.Count );
   if (attr == null) return null;
   for (int i = 0, n = attr.Expressions.Count, c = 0; i < n; i++) {
     Literal lit = attr.Expressions[i] as Literal;
     if (lit != null) {
       if (c == index) return lit;
       c++;
     }
   }
   return null;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:12,代码来源:TypeSystem.cs


示例14: NormalizeUrl

        public static Uri NormalizeUrl(AttributeNode attribute)
        {
            string value = attribute.Value;

            if (value.StartsWith("//", StringComparison.Ordinal))
                value = "http:" + value;

            Uri url;
            Uri.TryCreate(value, UriKind.Absolute, out url);

            return url;
        }
开发者ID:Gordon-Beeming,项目名称:WebEssentials2013,代码行数:12,代码来源:RemoteDownloaderSmartTag.cs


示例15: GetNamedAttributeValue

 public static Literal GetNamedAttributeValue( AttributeNode attr, Identifier name ) {
   if( attr == null ) return null;
   ExpressionList exprs = attr.Expressions;
   if( exprs == null ) return null;
   for( int i = 0, n = exprs.Count; i < n; i++ ) {
     NamedArgument na = exprs[i] as NamedArgument;
     if( na == null ) continue;
     if( na.Name.UniqueIdKey == name.UniqueIdKey ) {
       return na.Value as Literal;
     }
   }
   return null;
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:13,代码来源:TypeSystem.cs


示例16: Foreach

        public ForeachLoopStatementNode Foreach(string variable, TypeNameNode variableType, ExpressionNode expression, StatementNodeBase body, AttributeNode[] attributes)
        {
            if (string.IsNullOrWhiteSpace(variable))
                ThrowHelper.ThrowException("The 'variable' is blank!");
            if (expression == null)
                ThrowHelper.ThrowArgumentNullException(() => expression);
            if (body == null)
                ThrowHelper.ThrowArgumentNullException(() => body);
            if (attributes == null)
                ThrowHelper.ThrowArgumentNullException(() => attributes);

            return new ForeachLoopStatementNode(variable, variableType, expression, body, attributes);
        }
开发者ID:szabototo89,项目名称:MetaCode,代码行数:13,代码来源:StatementFactory.cs


示例17: AddAttribute

 internal void AddAttribute(string name, string value, string xmlns, string prefix)
 {
     if (this.closed)
     {
         throw new InvalidOperationException(System.Transactions.SR.GetString("CannotAddToClosedDocument"));
     }
     if (this.current == null)
     {
         throw new InvalidOperationException(System.Transactions.SR.GetString("OperationInvalidOnAnEmptyDocument"));
     }
     AttributeNode item = new AttributeNode(name, prefix, xmlns, value);
     this.current.attributes.Add(item);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:TraceXPathNavigator.cs


示例18: TryCreateSmartTag

        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            AttributeNode attr = element.GetAttribute("src") ?? element.GetAttribute("href");

            if (attr == null)
                return null;

            Uri url = NormalizeUrl(attr);

            if (url == null || (!attr.Value.StartsWith("//", StringComparison.Ordinal) && !attr.Value.Contains("://")))
                return null;

            return new RemoteDownloaderSmartTag(textView, textBuffer, element, attr);
        }
开发者ID:Gordon-Beeming,项目名称:WebEssentials2013,代码行数:14,代码来源:RemoteDownloaderSmartTag.cs


示例19: AddAttribute

 internal void AddAttribute(string name, string value, string xmlns, string prefix)
 {
     if (this.closed)
     {
         throw new InvalidOperationException();
     }
     if (this.current == null)
     {
         throw new InvalidOperationException();
     }
     AttributeNode node = new AttributeNode(name, prefix, value, xmlns);
     this.VerifySize(node);
     this.CurrentElement.attributes.Add(node);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:TraceXPathNavigator.cs


示例20: EvaluateRule

        /// <summary>
        /// Evaluates the rule.
        /// </summary>
        /// <param name="type">The type.</param>
		/// <param name="attribute">The attribute.</param>
		/// <param name="binding">The binding.</param>
        public override void EvaluateRule(TypeNode type, 
            AttributeNode attribute, string binding)
        {
			// for further info on Sessions and bindings, 
			// read: http://msdn2.microsoft.com/en-us/library/ms730879.aspx
			if ((SemanticRulesUtilities.GetAttributeValue<SessionMode>(attribute, "SessionMode") == SessionMode.Required &&
					IsSessionlessBinding(binding)) ||
				(SemanticRulesUtilities.GetAttributeValue<SessionMode>(attribute, "SessionMode") == SessionMode.NotAllowed &&
					IsSessionfullBinding(binding)))
			{
				Resolution resolution = base.GetResolution(type.FullName, binding);
				Problem problem = new Problem(resolution);
				base.Problems.Add(problem);
			}
        }
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:21,代码来源:ContractBindingNotSupportedSession.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# AttributeSection类代码示例发布时间:2022-05-24
下一篇:
C# AttributeMetadata类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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