Skip to content

Instantly share code, notes, and snippets.

@kspalaiologos
Created March 13, 2018 16:03
Show Gist options
  • Save kspalaiologos/0796dc9498187f39f6d8d84bffd5ac65 to your computer and use it in GitHub Desktop.
Save kspalaiologos/0796dc9498187f39f6d8d84bffd5ac65 to your computer and use it in GitHub Desktop.
Console Pauser application (From Brainfuck Builder 1/2/3).
using System;
using System.Diagnostics;
namespace ConsolePauser
{
internal class Program
{
private static void Main(string[] args)
{
if (args.Length == 0)
{
Console.Write("Console Pauser for Brainfuck Builder 2. Copyright (C) by Krzysztof Szewczyk.");
Console.WriteLine("Too small amount of arguments.");
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.BackgroundColor = ConsoleColor.Black;
Console.WriteLine("\n\n----------------------------------------------");
Console.WriteLine("Press any key to continue ... ");
Console.ReadKey();
}
else
{
try
{
using (Process process = Process.Start(new ProcessStartInfo()
{
UseShellExecute = false,
FileName = args[0]
}))
{
process.WaitForExit();
TimeSpan timeSpan = process.ExitTime - process.StartTime;
int exitCode = process.ExitCode;
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.BackgroundColor = ConsoleColor.Black;
Console.WriteLine("\n\n----------------------------------------------");
Console.WriteLine("Process exited with code " + (object) exitCode + " in " + (object) timeSpan + "s");
Console.WriteLine("Press any key to continue ... ");
Console.ReadKey();
}
}
catch (Exception ex)
{
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment