private static void CreateDesktopJsonFromPlist(string sourceFilename) { string projectDir = GenerateXmlFromGoogleServicesJson.GetProjectDir(); string text = Path.Combine(projectDir, sourceFilename); string text2 = Path.Combine(projectDir, GenerateXmlFromGoogleServicesJson.google_services_desktop_output_path); if (File.Exists(text2) && File.GetLastWriteTime(text2).CompareTo(File.GetLastWriteTime(text)) >= 0) { return; } if (GenerateXmlFromGoogleServicesJson.PrepareJsonDirectory()) { CommandLine.Result result = GenerateXmlFromGoogleServicesJson.RunResourceGenerator(string.Concat(new string[] { "-i \"", text, "\" -o \"", text2, "\" --plist" }), sourceFilename, false); if (result.exitCode != 0) { Debug.LogError(DocStrings.DocRef.CouldNotTranslatePlist.Format(new object[] { sourceFilename })); } } }
private static void GenerateXmlResources(string googleServicesFile, bool ignoreModificationDate) { if (!GenerateXmlFromGoogleServicesJson.XMLGenerationEnabled) { return; } string projectDir = GenerateXmlFromGoogleServicesJson.GetProjectDir(); string text = Path.Combine(projectDir, GenerateXmlFromGoogleServicesJson.google_services_output_directory); if (!Directory.Exists(text)) { try { Directory.CreateDirectory(text); } catch (Exception exception) { Debug.LogError(DocStrings.DocRef.GoogleServicesAndroidGenerationFailed.Format(new object[] { GenerateXmlFromGoogleServicesJson.google_services_output_path, googleServicesFile, DocStrings.DocRef.UnableToCreateDirectory.Format(new object[] { text }), string.Empty })); Debug.LogException(exception); return; } } string text2 = Path.Combine(projectDir, googleServicesFile); string text3 = Path.Combine(projectDir, GenerateXmlFromGoogleServicesJson.google_services_output_path); if (!ignoreModificationDate && File.Exists(text3) && File.GetLastWriteTime(text3).CompareTo(File.GetLastWriteTime(text2)) >= 0) { return; } GenerateXmlFromGoogleServicesJson.RunResourceGenerator(string.Concat(new string[] { "-i \"", text2, "\" -o \"", text3, "\" -p \"", UnityCompat.ApplicationId, "\"" }), text2, true); }
private static bool PrepareJsonDirectory() { string text = Path.Combine(GenerateXmlFromGoogleServicesJson.GetProjectDir(), GenerateXmlFromGoogleServicesJson.google_services_desktop_output_directory); if (!Directory.Exists(text)) { try { Directory.CreateDirectory(text); } catch (Exception exception) { Debug.LogError(DocStrings.DocRef.UnableToCreateDirectory.Format(new object[] { text })); Debug.LogException(exception); return(false); } return(true); } return(true); }
private static void CreateDesktopJsonFromJson(string sourceFilename) { string projectDir = GenerateXmlFromGoogleServicesJson.GetProjectDir(); string path = Path.Combine(projectDir, sourceFilename); string path2 = Path.Combine(projectDir, GenerateXmlFromGoogleServicesJson.google_services_desktop_output_path); if (File.Exists(path2) && File.GetLastWriteTime(path2).CompareTo(File.GetLastWriteTime(path)) >= 0) { return; } if (GenerateXmlFromGoogleServicesJson.PrepareJsonDirectory()) { try { AssetDatabase.CopyAsset(sourceFilename, GenerateXmlFromGoogleServicesJson.google_services_desktop_output_path); } catch { Debug.LogError(DocStrings.DocRef.CouldNotCopyFile.Format(new object[] { Path.Combine(projectDir, sourceFilename), Path.Combine(projectDir, GenerateXmlFromGoogleServicesJson.google_services_desktop_output_path) })); } } }
private static CommandLine.Result RunResourceGenerator(string arguments, string inputPath, bool showCommandLine = true) { bool flag = Application.platform == RuntimePlatform.WindowsEditor; string text = Path.Combine(Path.Combine(GenerateXmlFromGoogleServicesJson.GetProjectDir(), GenerateXmlFromGoogleServicesJson.executable_Location), (!flag) ? GenerateXmlFromGoogleServicesJson.executable_Name_Generic : GenerateXmlFromGoogleServicesJson.executable_Name_Windows); string text2; string text3; if (flag) { text2 = text; text3 = arguments; } else { text2 = "python"; text3 = "\"" + text + "\" " + arguments; } string text4 = string.Concat(new string[] { "`", text2, " ", text3, "`." }); CommandLine.Result result = new CommandLine.Result { exitCode = 1 }; try { result = CommandLine.Run(text2, text3, null, null, null); } catch (Win32Exception ex) { Debug.LogError(DocStrings.DocRef.GoogleServicesToolMissing.Format(new object[] { text2, GenerateXmlFromGoogleServicesJson.google_services_output_file, inputPath, ex.ToString() })); return(result); } if (result.exitCode == 0) { if (showCommandLine) { Debug.Log(DocStrings.DocRef.GoogleServicesAndroidGenerateXml.Format(new object[] { GenerateXmlFromGoogleServicesJson.google_services_output_path, inputPath, text4 })); } } else { Debug.LogError(DocStrings.DocRef.GoogleServicesAndroidGenerationFailed.Format(new object[] { GenerateXmlFromGoogleServicesJson.google_services_output_file, inputPath, text4, result.stdout + "\n" + result.stderr + "\n" })); } return(result); }