Exemplo n.º 1
0
        public static async Task <int> RunPrerequisitesInstaller(string UE4Folder)
        {
            string prerequisitesAppName = $"{UE4Folder}/Engine/Extras/Redist/en-us/UE4PrereqSetup_x64.exe";

            if (File.Exists(prerequisitesAppName))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo {
                    FileName = prerequisitesAppName, Arguments = "/SILENT", UseShellExecute = false
                };

                System.Diagnostics.Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                ProcessAsyncHelper.Result result = await ProcessAsyncHelper.RunAsync(startInfo);

                stopwatch.Stop();

                Console.WriteLine("Elapsed time: {0}s", (float)stopwatch.ElapsedMilliseconds / 1000.0f);

                return(result.ExitCode.HasValue ? result.ExitCode.Value : -1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 2
0
        private static async Task <bool> RunLongtailCommand(GoogleOAuthFlow.ApplicationDefaultCredentialsFile?applicationDefaultCredentialsFile, string[] args)
        {
            string longtailAppName = "longtail.exe";

            string arguments = string.Join(" ", args);

            ProcessStartInfo startInfo = new ProcessStartInfo {
                FileName = longtailAppName, Arguments = arguments, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true
            };

            if (applicationDefaultCredentialsFile != null)
            {
                startInfo.EnvironmentVariables["GOOGLE_APPLICATION_CREDENTIALS"] = (string)applicationDefaultCredentialsFile;
            }

            Console.WriteLine($"Running command: {startInfo.FileName} {startInfo.Arguments}...");

            System.Diagnostics.Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            ProcessAsyncHelper.Result result = await ProcessAsyncHelper.RunAsync(startInfo, (s) => Console.WriteLine(s), (s) => Console.WriteLine(s));

            stopwatch.Stop();

            Console.WriteLine("Elapsed time: {0}s", (float)stopwatch.ElapsedMilliseconds / 1000.0f);

            return(result.ExitCode == 0);
        }