public MultiReplacementEntry With(ReplacementValueType type, string value)
        {
            var result = Clone();

            result.Set(type, value);
            return(result);
        }
        public override string this[ReplacementValueType type]
        {
            get
            {
                switch (type)
                {
                case ReplacementValueType.Med: return(med);

                case ReplacementValueType.Ini: return(ini);

                case ReplacementValueType.Fin: return(fin);

                case ReplacementValueType.Isol: return(isol);

                default: throw new ArgumentOutOfRangeException(nameof(type));
                }
            }
        }
        public MultiReplacementEntry With(ReplacementValueType type, string value)
        {
            var result = new MultiReplacementEntry(Pattern);

            switch (type)
            {
            case ReplacementValueType.Med:
                result.med  = value;
                result.ini  = ini;
                result.fin  = fin;
                result.isol = isol;
                break;

            case ReplacementValueType.Ini:
                result.med  = med;
                result.ini  = value;
                result.fin  = fin;
                result.isol = isol;
                break;

            case ReplacementValueType.Fin:
                result.med  = med;
                result.ini  = ini;
                result.fin  = value;
                result.isol = isol;
                break;

            case ReplacementValueType.Isol:
                result.med  = med;
                result.ini  = ini;
                result.fin  = fin;
                result.isol = value;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type));
            }

            return(result);
        }
Example #4
0
        public MultiReplacementEntry With(ReplacementValueType type, string value)
        {
            var result = new MultiReplacementEntry(Pattern);

            if (type == ReplacementValueType.Med)
            {
                result.med  = value;
                result.ini  = ini;
                result.fin  = fin;
                result.isol = isol;
            }
            else if (type == ReplacementValueType.Ini)
            {
                result.med  = med;
                result.ini  = value;
                result.fin  = fin;
                result.isol = isol;
            }
            else if (type == ReplacementValueType.Fin)
            {
                result.med  = med;
                result.ini  = ini;
                result.fin  = value;
                result.isol = isol;
            }
            else if (type == ReplacementValueType.Isol)
            {
                result.med  = med;
                result.ini  = ini;
                result.fin  = fin;
                result.isol = value;
            }
            else
            {
                throw new ArgumentOutOfRangeException(nameof(type));
            }

            return(result);
        }
        internal void Set(ReplacementValueType type, string value)
        {
            switch (type)
            {
            case ReplacementValueType.Med:
                med = value;
                break;

            case ReplacementValueType.Ini:
                ini = value;
                break;

            case ReplacementValueType.Fin:
                fin = value;
                break;

            case ReplacementValueType.Isol:
                isol = value;
                break;

            default: throw new ArgumentOutOfRangeException(nameof(type));
            }
        }
        public override string this[ReplacementValueType type]
        {
            get
            {
                if (type == ReplacementValueType.Med)
                {
                    return(med);
                }
                if (type == ReplacementValueType.Ini)
                {
                    return(ini);
                }
                if (type == ReplacementValueType.Fin)
                {
                    return(fin);
                }
                if (type == ReplacementValueType.Isol)
                {
                    return(isol);
                }

                throw new ArgumentOutOfRangeException(nameof(type));
            }
        }
 public MultiReplacementEntry(string pattern, ReplacementValueType type, string value)
     : base(pattern)
 {
     if (type == ReplacementValueType.Med)
     {
         med = value;
     }
     else if (type == ReplacementValueType.Ini)
     {
         ini = value;
     }
     else if (type == ReplacementValueType.Fin)
     {
         fin = value;
     }
     else if (type == ReplacementValueType.Isol)
     {
         isol = value;
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(type));
     }
 }
Example #8
0
 public abstract string this[ReplacementValueType type] {
     get;
 }
Example #9
0
        public override string this[ReplacementValueType type]
        {
#if !NO_INLINE
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
            get => Type == type ? OutString : null;
Example #10
0
 public SingleReplacement(string pattern, string outString, ReplacementValueType type)
     : base(pattern)
 {
     OutString = outString;
     Type      = type;
 }
 public override string this[ReplacementValueType type] => type == Type ? OutString : null;
 public MultiReplacementEntry(string pattern, ReplacementValueType type, string value)
     : base(pattern)
 {
     Set(type, value);
 }