public static void ApplyRules(FSTEntry root, Contents targetContents, List <ContentRule> rules)
 {
     Console.WriteLine("-----");
     foreach (ContentRule rule in rules)
     {
         Regex regex = new Regex(rule.pattern, RegexOptions.IgnoreCase);
         Console.WriteLine($"Apply rule \"{rule.pattern}\"");
         if (rule.contentPerMatch)
         {
             SetNewContentRecursiveRule("", root, targetContents, rule.details, regex);
         }
         else
         {
             cur_content       = targetContents.GetNewContent(rule.details);
             cur_content_first = cur_content;
             cur_content_size  = 0L;
             bool result = SetContentRecursiveRule("", root, targetContents, rule.details, regex);
             if (!result)
             {
                 Console.WriteLine("No file matched the rule. Lets delete the content again");
                 targetContents.DeleteContent(cur_content);
             }
         }
         Console.WriteLine("-----");
     }
 }