private static string FindGoogleServicesFile(GenerateXmlFromGoogleServicesJson.ConfigFileType fileType, string bundleId = null, GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode mode = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnBundleIdMatches, GenerateXmlFromGoogleServicesJson.LogMessage logMessageForNoConfigFiles = null, GenerateXmlFromGoogleServicesJson.LogMessage logMessageForMissingBundleId = null)
        {
            bundleId = (bundleId ?? UnityCompat.ApplicationId);
            if (GenerateXmlFromGoogleServicesJson.ConfigFileDirectory.Count == 0)
            {
                string message = DocStrings.DocRef.GoogleServicesAndroidFileMissing.Format(new object[]
                {
                    GenerateXmlFromGoogleServicesJson.google_services_input_file,
                    GenerateXmlFromGoogleServicesJson.google_services_output_file,
                    DocStrings.Link.AndroidSetup
                });
                GenerateXmlFromGoogleServicesJson.LogMessage arg_6A_0;
                if ((arg_6A_0 = logMessageForNoConfigFiles) == null)
                {
                    if (GenerateXmlFromGoogleServicesJson.f__mgcacheC == null)
                    {
                        GenerateXmlFromGoogleServicesJson.f__mgcacheC = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogErrorIfEnabled);
                    }
                    arg_6A_0 = GenerateXmlFromGoogleServicesJson.f__mgcacheC;
                }
                logMessageForNoConfigFiles = arg_6A_0;
                logMessageForNoConfigFiles(message);
                return(null);
            }
            string text = null;
            int    num  = 0;

            foreach (KeyValuePair <string, List <string> > current in GenerateXmlFromGoogleServicesJson.ConfigFileDirectory)
            {
                if (GenerateXmlFromGoogleServicesJson.IsFileOfType(current.Key, fileType) && (mode == GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnAll || new HashSet <string>(current.Value).Contains(bundleId)))
                {
                    text = current.Key;
                    num++;
                }
            }
            if (text == null)
            {
                GenerateXmlFromGoogleServicesJson.LogMessage arg_119_0;
                if ((arg_119_0 = logMessageForMissingBundleId) == null)
                {
                    if (GenerateXmlFromGoogleServicesJson.f__mgcacheD == null)
                    {
                        GenerateXmlFromGoogleServicesJson.f__mgcacheD = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogErrorIfEnabled);
                    }
                    arg_119_0 = GenerateXmlFromGoogleServicesJson.f__mgcacheD;
                }
                logMessageForMissingBundleId = arg_119_0;
                logMessageForMissingBundleId(DocStrings.DocRef.GoogleServicesFileBundleIdMissing.Format(new object[]
                {
                    bundleId,
                    (fileType != GenerateXmlFromGoogleServicesJson.ConfigFileType.Json) ? "GoogleService-Info.plist" : "google-services.json",
                    string.Join("\n", GenerateXmlFromGoogleServicesJson.BundleIdsFromBundleIdsByConfigFile(GenerateXmlFromGoogleServicesJson.ConfigFileDirectory).ToArray()),
                    DocStrings.Link.AndroidAddApp
                }));
            }
            else if (num > 1 && mode != GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnAll)
            {
                GenerateXmlFromGoogleServicesJson.LogInfoIfEnabled(DocStrings.DocRef.GoogleServicesFileMultipleFiles.Format(new object[]
                {
                    (fileType != GenerateXmlFromGoogleServicesJson.ConfigFileType.Plist) ? GenerateXmlFromGoogleServicesJson.google_service_info_input_file : GenerateXmlFromGoogleServicesJson.google_services_input_file,
                    text,
                    bundleId,
                    string.Join("\n", new List <string>(GenerateXmlFromGoogleServicesJson.ConfigFileDirectory.Keys).ToArray())
                }));
            }
            return(text);
        }