Beispiel #1
0
        public void SetData(Equipment e, EquipmentData parent)
        {
            Equipment       = e;
            ParentEquipment = parent;

            ReplacementOptions.ForEach(i => i.SetData(Equipment.ReplacementOptions.Single(ii => ii.Id == i.EquipmentId), this));
            GivenEquipment.ForEach(i => i.SetData(Equipment.GivenEquipment.Single(ii => ii.Id == i.EquipmentId), this));
            TraverseEquipment(this);
        }
        /// ------------------------------------------------------------------------------------
        public void SetReplacementOptions(List <string> replacementOptions)
        {
            ReplacementOptions.Clear();

            foreach (var option in replacementOptions)
            {
                ReplacementOptions.Add(new ReplacementOption {
                    Literal = option
                });
            }
        }
 public RedactionResult ReplaceText(Regex regularExpression, ReplacementOptions options)
 {
     try
     {
         if (options.ActionType != Redactions.ReplacementType.ReplaceString)
         {
             return(RedactionResult.Failed("This format allows only ReplaceString redactions!"));
         }
         for (int i = 0; i < FileContent.Count; i++)
         {
             FileContent[i] = regularExpression.Replace(FileContent[i], options.Replacement);
         }
         return(RedactionResult.Successful());
     }
     catch (Exception ex)
     {
         return(RedactionResult.Failed(ex.ToString()));
     }
 }
Beispiel #4
0
 private static void ReplaceIf(Tuple <Regex, string, ReplacementOptions> replacement, ref string content, ReplacementOptions expectedFlag)
 {
     if ((replacement.Item3 & expectedFlag) > 0)
     {
         content = replacement.Item1.Replace(content, replacement.Item2);
     }
 }
Beispiel #5
0
 public IRecordedHttpCallExpectationBuilder WithReplacement(string regex, string replacement, ReplacementOptions options = ReplacementOptions.All)
 {
     _replacements.Add(Tuple.Create(new Regex(regex, RegexOptions.Compiled), replacement, options));
     return(this);
 }
Beispiel #6
0
 public Renamer(IWritableOptions <ReplacementOptions> options)
 {
     _replacementOptions = options.Value;
     _outputFolderPath   = _replacementOptions.OutputFolderPath;
 }