Exemple #1
0
        public async Task Run()
        {
            try
            {
                if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
                {
                    var command    = "(Get-Command java | Select-Object -ExpandProperty Version).toString()";
                    var outputPath = Path.Combine(outputProvider.OutputDirectory, OutputFileName);

                    ApplicationData.Current.LocalSettings.Values["parameters"] = command + "," + outputPath;

                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("JavaInfoOperation");

                    var javaVersion = ApplicationData.Current.LocalSettings.Values["javaVersion"] as string;

                    await outputProvider.CreateJsonFile(javaVersion, OutputFileName);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        public async Task Run()
        {
            try
            {
                if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
                {
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("PythonInfoOperation");

                    var pythonVersion = ApplicationData.Current.LocalSettings.Values["pythonVersion"] as string;

                    if (pythonVersion.EndsWith("\\r\\n"))
                    {
                        pythonVersion.Substring(pythonVersion.Length - 4);
                    }

                    await outputProvider.CreateJsonFile(pythonVersion, OutputFileName);
                }
            }
            catch (Exception e) when(e is SecurityException || e is IOException || e is UnauthorizedAccessException)
            {
                throw;
            }
        }