Example #1
0
 private void ParsePattern(string pattern, out string[] patterns)
 {
     patterns = Array.Empty <string>();
     if (!string.IsNullOrWhiteSpace(pattern))
     {
         if (FileMatcher.HasPropertyOrItemReferences(pattern))
         {
             // Supporting property references would require access to Expander which is unavailable in Microsoft.Build.Tasks
             Log.LogErrorWithCodeFromResources("Unzip.ErrorParsingPatternPropertyReferences", pattern);
         }
         else if (pattern.IndexOfAny(FileUtilities.InvalidPathChars) != -1)
         {
             Log.LogErrorWithCodeFromResources("Unzip.ErrorParsingPatternInvalidPath", pattern);
         }
         else
         {
             patterns = pattern.Contains(';')
                            ? pattern.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(FileMatcher.Normalize).ToArray()
                            : new[] { pattern };
         }
     }
 }