@@ -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 ;
@@ -992,7 +993,7 @@ private static bool Initialize() {
992
993
}
993
994
994
995
// Monitor Android dependency XML files to perform auto-resolution.
995
- AddAutoResolutionFilePatterns ( xmlDependencies . fileRegularExpressions ) ;
996
+ autoResolveFilePatterns . Add ( XmlDependencies . IsDependenciesFile ) ;
996
997
997
998
svcSupport = PlayServicesSupport . CreateInstance (
998
999
"PlayServicesResolver" ,
@@ -1079,15 +1080,16 @@ internal static void Log(string message, Google.LogLevel level = LogLevel.Info)
1079
1080
/// <summary>
1080
1081
/// Patterns of files that are monitored to trigger auto resolution.
1081
1082
/// </summary>
1082
- private static HashSet < Regex > autoResolveFilePatterns = new HashSet < Regex > ( ) ;
1083
+ private static HashSet < FileMatchPattern > autoResolveFilePatterns = new HashSet < FileMatchPattern > ( ) ;
1083
1084
1084
1085
/// <summary>
1085
1086
/// Add file patterns to monitor to trigger auto resolution.
1086
1087
/// </summary>
1087
1088
/// <param name="patterns">Set of file patterns to monitor to trigger auto
1088
1089
/// resolution.</param>
1089
1090
public static void AddAutoResolutionFilePatterns ( IEnumerable < Regex > patterns ) {
1090
- autoResolveFilePatterns . UnionWith ( patterns ) ;
1091
+ // Only regex patterns are supported in the public API, but a more performant default is used internally.
1092
+ autoResolveFilePatterns . UnionWith ( patterns . Select < Regex , FileMatchPattern > ( p => p . IsMatch ) ) ;
1091
1093
}
1092
1094
1093
1095
/// <summary>
@@ -1099,7 +1101,7 @@ private static bool CheckFilesForAutoResolution(HashSet<string> filesToCheck) {
1099
1101
bool resolve = false ;
1100
1102
foreach ( var asset in filesToCheck ) {
1101
1103
foreach ( var pattern in autoResolveFilePatterns ) {
1102
- if ( pattern . Match ( asset ) . Success ) {
1104
+ if ( pattern . Invoke ( asset ) ) {
1103
1105
Log ( String . Format ( "Found asset {0} matching {1}, attempting " +
1104
1106
"auto-resolution." ,
1105
1107
asset , pattern . ToString ( ) ) ,
0 commit comments