コード例 #1
0
        public void AddTag(TagBase tag, KeyConflictResolutionKind conflictResolution)
        {
            Log.Info($"Adding tag to {Owner.RenderForLog()}: '{tag.RenderForLog()}'.");

            ConflictResolverBase conflictResolver = ConflictResolverBase.GetResolver(this, conflictResolution);

            conflictResolver.AddTag(tag);
        }
コード例 #2
0
 private CopyTagsEffect(IDeserializer deserializer)
     : base(deserializer)
 {
     TagKey             = deserializer.GetValue <string>(nameof(TagKey));
     TagScope           = deserializer.GetValue <TagScope>(nameof(TagScope));
     TagKeyMatchKind    = deserializer.GetValue <MatchKind>(nameof(TagKeyMatchKind));
     NewTagKey          = deserializer.GetValue <string>(nameof(NewTagKey));
     ConflictResolution = deserializer.GetValue <KeyConflictResolutionKind>(nameof(ConflictResolution));
 }
コード例 #3
0
 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;
 }
コード例 #4
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;
 }
コード例 #5
0
 private AddTagEffectViewModel(TagViewModelBase tag, KeyConflictResolutionKind conflictResolution, ConditionViewModelBase condition, EffectTarget target)
     : base(condition, target)
 {
     m_tag = tag;
     m_conflictResolution = conflictResolution;
 }
コード例 #6
0
 public CopyTagsEffect(string tagKey, TagScope tagScope, string newTagKey, KeyConflictResolutionKind conflictResolution)
     : this(tagKey, MatchKind.Exact, tagScope, AlwaysCondition.True, newTagKey, conflictResolution, EffectTarget.Defender)
 {
 }
コード例 #7
0
 private AddTagEffect(IDeserializer deserializer)
     : base(deserializer)
 {
     Tag = deserializer.GetValue <TagBase>(nameof(Tag));
     ConflictResolution = deserializer.GetValue <KeyConflictResolutionKind>(nameof(ConflictResolution));
 }
コード例 #8
0
 public AddTagEffect(TagBase tag, KeyConflictResolutionKind conflictResolution, ConditionBase condition, EffectTarget target)
     : base(condition, target)
 {
     Tag = tag;
     ConflictResolution = conflictResolution;
 }
コード例 #9
0
 public AddTagEffect(TagBase tag, KeyConflictResolutionKind conflictResolution)
     : this(tag, conflictResolution, AlwaysCondition.True, EffectTarget.Defender)
 {
 }
コード例 #10
0
            public static ConflictResolverBase GetResolver(TagCollection tagCollection, KeyConflictResolutionKind conflictResolution)
            {
                switch (conflictResolution)
                {
                case KeyConflictResolutionKind.Add:
                    return(new AddConflictResolver(tagCollection.m_tags, tagCollection.Owner));

                case KeyConflictResolutionKind.Subtract:
                    return(new SubtractConflictResolver(tagCollection.m_tags, tagCollection.Owner));

                case KeyConflictResolutionKind.KeepAll:
                    return(new KeepAllConflictResolver(tagCollection.m_tags, tagCollection.Owner));

                case KeyConflictResolutionKind.KeepLarger:
                    return(new KeepLargerConflictResolver(tagCollection.m_tags, tagCollection.Owner));

                case KeyConflictResolutionKind.KeepSmaller:
                    return(new KeepSmallerConflictResolver(tagCollection.m_tags, tagCollection.Owner));

                case KeyConflictResolutionKind.Replace:
                    return(new ReplaceConflictResolver(tagCollection.m_tags, tagCollection.Owner));

                default:
                    throw new ArgumentOutOfRangeException(nameof(conflictResolution), $"No conflict resolver available for resolution kind {conflictResolution}");
                }
            }