Ardente

lol

Apr 18th, 2022 (edited)
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System.Diagnostics;
  2. using CMSlib.ConsoleModule.Termios;
  3.  
  4. string[] output;
  5.  
  6. using (var process = new Process())
  7. {
  8.     process.StartInfo.FileName = "sh";
  9.     process.StartInfo.Arguments = @"-c ""echo | gcc -E -Wp,-v -""";
  10.     process.StartInfo.RedirectStandardError = true;
  11.     process.StartInfo.RedirectStandardOutput = true;
  12.  
  13.     process.Start();
  14.     process.WaitForExit();
  15.    
  16.     output = process.StandardError.ReadToEnd()
  17.         .Split(" ")
  18.         .Select(line => line.Split('\n'))
  19.         .SelectMany(line => line)
  20.         .Where(line => line.Contains("include") && !line.Contains("ignoring") && !line.Contains('#') && System)
  21.         .Select(line => line.Trim())
  22.         .ToArray();
  23.    
  24.     Console.WriteLine(String.Join('\n', output));
  25. }
  26.  
  27. var files = output.Select(directory => Directory.GetFiles(directory, "termios*.h", SearchOption.AllDirectories))
  28.     .SelectMany(files => files);
  29.  
  30. var handle = new TermiosHandle(0, files.ToArray());
  31.  
  32. handle.StateSandbox(() =>
  33. {
  34.     handle.EnableRaw();
  35.  
  36.     while (handle.ReadByte(out var b) != -1 && b != 'q')
  37.     {
  38.         Console.WriteLine(b);
  39.     }
  40. });
  41.  
  42. File.Delete("termios.h");
Add Comment
Please, Sign In to add comment