예제 #1
0
        public bool Read(string tag, TagScope scope = TagScope.Current, int _level = -1)
        {
            var prevLevel = _level >= 0 ? _level : level;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    if (!reader.IsEmptyElement)
                    {
                        level++;
                    }
                    if (reader.Name == tag || tag == null)
                    {
                        return(true);
                    }
                    if (scope == TagScope.NextElement)
                    {
                        return(false);
                    }
                    break;

                case XmlNodeType.EndElement:
                    level--;
                    if (level < prevLevel && scope == TagScope.Current)
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(false);
        }
예제 #2
0
 private CopyTagsEffectViewModel(string tagKey, MatchKind tagKeyMatchKind, TagScope tagScope, string newTagKey, KeyConflictResolutionKind conflictResolution, ConditionViewModelBase condition, EffectTarget target)
     : base(condition, target)
 {
     m_tagKey             = tagKey;
     m_tagKeyMatchKind    = tagKeyMatchKind;
     m_tagScope           = tagScope;
     m_newTagKey          = newTagKey;
     m_conflictResolution = conflictResolution;
 }
 public CopyTagsEffect(string tagKey, MatchKind tagKeyMatchKind, TagScope tagScope, ConditionBase condition, string newTagKey, KeyConflictResolutionKind conflictResolution, EffectTarget target)
     : base(condition, target)
 {
     TagKey             = tagKey;
     TagKeyMatchKind    = tagKeyMatchKind;
     TagScope           = tagScope;
     NewTagKey          = newTagKey;
     ConflictResolution = conflictResolution;
 }
 public ReadOnlyCollection <TagBase> GetTags(TagScope scope)
 {
     return(Enum.GetValues(typeof(TagScope))
            .Cast <TagScope>()
            .Where(x => scope.HasFlag(x))
            .Select(x => m_tags.GetValueOrDefault(x))
            .WhereNotNull()
            .SelectMany(x => x)
            .ToList()
            .AsReadOnly());
 }
 public EqualsValueCondition(TagScope matchScopes, string matchKey, string matchValue)
     : base(matchScopes, matchKey, MatchKind.Exact, matchValue)
 {
 }
 public EqualsValueCondition(TagScope matchScopes, string matchKey, MatchKind keyMatchKind, int matchValue)
     : base(matchScopes, matchKey, keyMatchKind, matchValue)
 {
 }
 public HasTagCondition(TagScope matchScopes, string matchKey)
     : base(matchScopes, matchKey, MatchKind.Exact)
 {
 }
 protected TagMatchConditionViewModelBase(TagScope matchScopes, string matchKey, MatchKind keyMatchKind)
 {
     m_matchScopes  = matchScopes;
     m_matchKey     = matchKey;
     m_keyMatchKind = keyMatchKind;
 }
 public CopyTagsEffect(string tagKey, TagScope tagScope, string newTagKey, KeyConflictResolutionKind conflictResolution)
     : this(tagKey, MatchKind.Exact, tagScope, AlwaysCondition.True, newTagKey, conflictResolution, EffectTarget.Defender)
 {
 }
 public LessThanValueCondition(TagScope matchScopes, string matchKey, int matchValue)
     : base(matchScopes, matchKey, MatchKind.Exact, matchValue)
 {
 }
예제 #11
0
 public void SetDynamicTags(TagScope scope, TagCollection tags)
 {
     m_tags[scope] = tags;
 }
예제 #12
0
 public void SetTags(TagScope scope, IEnumerable <TagBase> tags)
 {
     m_tags[scope] = tags.EmptyIfNull().ToList();
 }
 protected ValueCompareCondition(TagScope matchScopes, string matchKey, MatchKind keyMatchKind, string matchValue)
     : base(matchScopes, matchKey, keyMatchKind)
 {
     CompareStringValue = matchValue;
 }
예제 #14
0
 public IQueryable <Tag> GetTagsForScopeQuery(TagScope tagScope)
 {
     return(_context.Tags
            .Include(x => x.Fragments)
            .Where(x => x.TagScope == tagScope));
 }
 private HasTagConditionViewModel(TagScope matchScopes, string matchKey, MatchKind keyMatchKind)
     : base(matchScopes, matchKey, keyMatchKind)
 {
 }
 public LessThanValueCondition(TagScope matchScopes, string matchKey, MatchKind keyMatchKind, string matchValue)
     : base(matchScopes, matchKey, keyMatchKind, matchValue)
 {
 }
 public GreaterThanOrEqualValueCondition(TagScope matchScopes, string matchKey, MatchKind keyMatchKind, string matchValue)
     : base(matchScopes, matchKey, keyMatchKind, matchValue)
 {
 }
예제 #18
0
 protected TagMatchCondition(TagScope matchScopes, string matchKey, MatchKind keyMatchKind)
 {
     MatchScopes  = matchScopes;
     MatchKey     = matchKey;
     KeyMatchKind = keyMatchKind;
 }
 public GreaterThanOrEqualValueCondition(TagScope matchScopes, string matchKey, int matchValue)
     : base(matchScopes, matchKey, MatchKind.Exact, matchValue)
 {
 }
 public HasTagCondition(TagScope matchScopes, string matchKey, MatchKind keyMatchKind)
     : base(matchScopes, matchKey, keyMatchKind)
 {
 }
 private ValueCompareConditionViewModel(CompareKind compareKind, string compareStringValue, TagScope matchScopes, string matchKey, MatchKind keyMatchKind)
     : base(matchScopes, matchKey, keyMatchKind)
 {
     m_compareStringValue = compareStringValue;
     m_compareKind        = compareKind;
 }