@@ -18,6 +18,7 @@ namespace GooglePlayServices {
18
18
using System ;
19
19
using System . Collections . Generic ;
20
20
using System . IO ;
21
+ using System . Linq ;
21
22
using System . Text . RegularExpressions ;
22
23
using System . Threading ;
23
24
using System . Xml ;
@@ -985,7 +986,7 @@ private static bool Initialize() {
985
986
}
986
987
987
988
// Monitor Android dependency XML files to perform auto-resolution.
988
- AddAutoResolutionFilePatterns ( xmlDependencies . fileRegularExpressions ) ;
989
+ autoResolveFilePatterns . Add ( XmlDependencies . IsDependenciesFile ) ;
989
990
990
991
svcSupport = PlayServicesSupport . CreateInstance (
991
992
"PlayServicesResolver" ,
@@ -1072,15 +1073,16 @@ internal static void Log(string message, Google.LogLevel level = LogLevel.Info)
1072
1073
/// <summary>
1073
1074
/// Patterns of files that are monitored to trigger auto resolution.
1074
1075
/// </summary>
1075
- private static HashSet < Regex > autoResolveFilePatterns = new HashSet < Regex > ( ) ;
1076
+ private static HashSet < FileMatchPattern > autoResolveFilePatterns = new HashSet < FileMatchPattern > ( ) ;
1076
1077
1077
1078
/// <summary>
1078
1079
/// Add file patterns to monitor to trigger auto resolution.
1079
1080
/// </summary>
1080
1081
/// <param name="patterns">Set of file patterns to monitor to trigger auto
1081
1082
/// resolution.</param>
1082
1083
public static void AddAutoResolutionFilePatterns ( IEnumerable < Regex > patterns ) {
1083
- autoResolveFilePatterns . UnionWith ( patterns ) ;
1084
+ // Only regex patterns are supported in the public API, but a more performant default is used internally.
1085
+ autoResolveFilePatterns . UnionWith ( patterns . Select < Regex , FileMatchPattern > ( p => p . IsMatch ) ) ;
1084
1086
}
1085
1087
1086
1088
/// <summary>
@@ -1092,7 +1094,7 @@ private static bool CheckFilesForAutoResolution(HashSet<string> filesToCheck) {
1092
1094
bool resolve = false ;
1093
1095
foreach ( var asset in filesToCheck ) {
1094
1096
foreach ( var pattern in autoResolveFilePatterns ) {
1095
- if ( pattern . Match ( asset ) . Success ) {
1097
+ if ( pattern . Invoke ( asset ) ) {
1096
1098
Log ( String . Format ( "Found asset {0} matching {1}, attempting " +
1097
1099
"auto-resolution." ,
1098
1100
asset , pattern . ToString ( ) ) ,
0 commit comments