/// <summary> /// Log a message that describes the installation / license fetching operation. /// </summary> /// <param name="toolPath">Tool that was executed.</param> /// <param name="toolArguments">Arguments to passed to the tool.</param> /// <param name="retrievingLicenses">Whether the command is retrieving licenses.</param> /// <param name="packages">List of package versions to install / upgrade..</param> /// <param name="toolResult">Result of the tool's execution.</param> private static void LogInstallLicenseResult( string toolPath, string toolArguments, bool retrievingLicenses, IEnumerable <AndroidSdkPackageNameVersion> packages, CommandLine.Result toolResult) { bool succeeded = toolResult.exitCode == 0; if (!retrievingLicenses || !succeeded) { var failedMessage = retrievingLicenses ? "Failed to retrieve Android SDK package licenses.\n\n" + "Aborted installation of the following packages:\n" : "Android package installation failed.\n\n" + "Failed when installing the following packages:\n"; PlayServicesResolver.Log( String.Format( "{0}\n" + "{1}\n\n" + "{2}\n", succeeded ? "Successfully installed Android packages.\n\n" : failedMessage, AndroidSdkPackageNameVersion.ListToString(packages), toolResult.message), level: succeeded ? LogLevel.Info : LogLevel.Warning); } }
/// <summary> /// Called when the currently executing command completes. /// </summary> public void CommandLineToolCompletion(CommandLine.Result result) { PlayServicesResolver.Log( string.Format("Command completed with exit code {0}: {1}", result.exitCode, result.message), result.exitCode == 0 ? LogLevel.Info: LogLevel.Error); this.result = result; }
/// <summary> /// Handles window behavior when the CommandLineDialog finishes, closing the window automatically if /// execution succeeded and leaving it open with a "Close" button if it failed. /// </summary> /// <param name="result">The result of the process execution.</param> /// <param name="window">The window that should be adjusted based on the process execution result.</param> private static void HandleProcessExited(CommandLine.Result result, CommandLineDialog window) { if (result.exitCode == 0) { window.Close(); } else { PlayServicesResolver.Log(string.Format(PACKAGES_MISSING, result.message)); window.noText = "Close"; // After adding the button we need to scroll down a little more. window.scrollPosition.y = Mathf.Infinity; window.Repaint(); } }