private static List <string> ReadBundleIds(string googleServicesFile)
        {
            string str = (!GenerateXmlFromGoogleServicesJson.IsFileOfType(googleServicesFile, GenerateXmlFromGoogleServicesJson.ConfigFileType.Plist)) ? string.Empty : " --plist";
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            CommandLine.Result result = GenerateXmlFromGoogleServicesJson.RunResourceGenerator("-i \"" + googleServicesFile + "\" -l" + str, googleServicesFile, false);
            if (result.exitCode == 0)
            {
                string[] array = result.stdout.Split(GenerateXmlFromGoogleServicesJson.newline_chars);
                for (int i = 0; i < array.Length; i++)
                {
                    string text = array[i];
                    if (!string.IsNullOrEmpty(text))
                    {
                        sortedDictionary[text] = text;
                    }
                }
            }
            return(new List <string>(sortedDictionary.Keys));
        }
        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);
        }
        private static void UpdateJson(bool ignoreModificationDate, GenerateXmlFromGoogleServicesJson.LogMessage logMessageForNoConfigFiles = null, GenerateXmlFromGoogleServicesJson.LogMessage logMessageForMissingBundleId = null)
        {
            GenerateXmlFromGoogleServicesJson.ConfigFileType arg_3D_0 = GenerateXmlFromGoogleServicesJson.ConfigFileType.Json;
            string arg_3D_1 = null;

            GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode arg_3D_2 = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnBundleIdMatches;
            if (GenerateXmlFromGoogleServicesJson.f__mgcache4 == null)
            {
                GenerateXmlFromGoogleServicesJson.f__mgcache4 = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
            }
            GenerateXmlFromGoogleServicesJson.LogMessage arg_3D_3 = GenerateXmlFromGoogleServicesJson.f__mgcache4;
            if (GenerateXmlFromGoogleServicesJson.f__mgcache5 == null)
            {
                GenerateXmlFromGoogleServicesJson.f__mgcache5 = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
            }
            string text = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFile(arg_3D_0, arg_3D_1, arg_3D_2, arg_3D_3, GenerateXmlFromGoogleServicesJson.f__mgcache5);

            GenerateXmlFromGoogleServicesJson.ConfigFileType arg_80_0 = GenerateXmlFromGoogleServicesJson.ConfigFileType.Plist;
            string arg_80_1 = null;

            GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode arg_80_2 = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnBundleIdMatches;
            if (GenerateXmlFromGoogleServicesJson.f__mgcache6 == null)
            {
                GenerateXmlFromGoogleServicesJson.f__mgcache6 = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
            }
            GenerateXmlFromGoogleServicesJson.LogMessage arg_80_3 = GenerateXmlFromGoogleServicesJson.f__mgcache6;
            if (GenerateXmlFromGoogleServicesJson.f__mgcache7 == null)
            {
                GenerateXmlFromGoogleServicesJson.f__mgcache7 = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
            }
            string text2 = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFile(arg_80_0, arg_80_1, arg_80_2, arg_80_3, GenerateXmlFromGoogleServicesJson.f__mgcache7);

            if (text != null)
            {
                GenerateXmlFromGoogleServicesJson.GenerateXmlResources(text, ignoreModificationDate);
            }
            bool flag = text != null || text2 != null;

            if (EditorUserBuildSettings.selectedBuildTargetGroup == (BuildTargetGroup)1 && !flag)
            {
                GenerateXmlFromGoogleServicesJson.ConfigFileType arg_F2_0 = GenerateXmlFromGoogleServicesJson.ConfigFileType.Any;
                string arg_F2_1 = null;
                GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode arg_F2_2 = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnAll;
                if (GenerateXmlFromGoogleServicesJson.f__mgcache8 == null)
                {
                    GenerateXmlFromGoogleServicesJson.f__mgcache8 = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
                }
                GenerateXmlFromGoogleServicesJson.LogMessage arg_F2_3 = GenerateXmlFromGoogleServicesJson.f__mgcache8;
                if (GenerateXmlFromGoogleServicesJson.f__mgcache9 == null)
                {
                    GenerateXmlFromGoogleServicesJson.f__mgcache9 = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
                }
                string text3 = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFile(arg_F2_0, arg_F2_1, arg_F2_2, arg_F2_3, GenerateXmlFromGoogleServicesJson.f__mgcache9);
                if (text3 != null)
                {
                    if (GenerateXmlFromGoogleServicesJson.IsFileOfType(text3, GenerateXmlFromGoogleServicesJson.ConfigFileType.Json))
                    {
                        text = text3;
                    }
                    else if (GenerateXmlFromGoogleServicesJson.IsFileOfType(text3, GenerateXmlFromGoogleServicesJson.ConfigFileType.Plist))
                    {
                        text2 = text3;
                    }
                    flag = (text != null || text2 != null);
                }
            }
            if (flag)
            {
                BuildTargetGroup selectedBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
                // IL_158:
                switch ((int)selectedBuildTargetGroup)
                {
                case 1:
                    goto IL_187;

                case 2:
                case 3:
IL_158:
                    if ((int)selectedBuildTargetGroup != 7)
                    {
                        goto IL_187;
                    }
                    goto IL_187;

                case 4:
                    if (text2 != null)
                    {
                        GenerateXmlFromGoogleServicesJson.CreateDesktopJsonFromPlist(text2);
                    }
                    else if (text != null)
                    {
                        GenerateXmlFromGoogleServicesJson.CreateDesktopJsonFromJson(text);
                    }
                    goto IL_1A9;

                default:
                    goto IL_158;
                }
IL_187:
                if (text != null)
                {
                    GenerateXmlFromGoogleServicesJson.CreateDesktopJsonFromJson(text);
                }
                else if (text2 != null)
                {
                    GenerateXmlFromGoogleServicesJson.CreateDesktopJsonFromPlist(text2);
                }
                IL_1A9 :;
            }
            else
            {
                Debug.LogWarning(DocStrings.DocRef.CouldNotFindPlistOrJson.Format(new object[0]));
                GenerateXmlFromGoogleServicesJson.LogMessage arg_1E5_0;
                if ((arg_1E5_0 = logMessageForNoConfigFiles) == null)
                {
                    if (GenerateXmlFromGoogleServicesJson.f__mgcacheA == null)
                    {
                        GenerateXmlFromGoogleServicesJson.f__mgcacheA = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogErrorIfEnabled);
                    }
                    arg_1E5_0 = GenerateXmlFromGoogleServicesJson.f__mgcacheA;
                }
                logMessageForNoConfigFiles = arg_1E5_0;
                logMessageForNoConfigFiles(DocStrings.DocRef.GoogleServicesFileBundleIdMissing.Format(new object[]
                {
                    UnityCompat.ApplicationId,
                    ((int)EditorUserBuildSettings.selectedBuildTargetGroup != 4) ? "google-services.json" : "GoogleService-Info.plist",
                    string.Join("\n", GenerateXmlFromGoogleServicesJson.BundleIdsFromBundleIdsByConfigFile(GenerateXmlFromGoogleServicesJson.ConfigFileDirectory).ToArray()),
                    DocStrings.Link.AndroidAddApp
                }));
            }
        }