當前位置: 首頁>>代碼示例>>C#>>正文


C# AttributeNode類代碼示例

本文整理匯總了C#中AttributeNode的典型用法代碼示例。如果您正苦於以下問題:C# AttributeNode類的具體用法?C# AttributeNode怎麽用?C# AttributeNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttributeNode類屬於命名空間,在下文中一共展示了AttributeNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的AttributeNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。