|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Diagnostics; |
| 4 | + |
| 5 | +namespace nox_app_player_debug_connector |
| 6 | +{ |
| 7 | + class Program |
| 8 | + { |
| 9 | + private static Process process = null; |
| 10 | + |
| 11 | + private static Process Process |
| 12 | + { |
| 13 | + get |
| 14 | + { |
| 15 | + if (process == null) |
| 16 | + { |
| 17 | + process = new Process(); |
| 18 | + process.StartInfo.FileName = "cmd.exe"; |
| 19 | + process.StartInfo.RedirectStandardInput = true; |
| 20 | + process.StartInfo.RedirectStandardOutput = true; |
| 21 | + process.StartInfo.CreateNoWindow = false; |
| 22 | + process.StartInfo.UseShellExecute = false; |
| 23 | + process.Start(); |
| 24 | + } |
| 25 | + |
| 26 | + return process; |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + static void Main(string[] args) |
| 31 | + { |
| 32 | + // INFO : Nox가 D드라이브 설치 됨 |
| 33 | + var lines = new List<string>() |
| 34 | + { |
| 35 | + @"cd C:Windows", |
| 36 | + @"d:", |
| 37 | + @"cd D:\Program Files\Nox\bin\", |
| 38 | + @"nox_adb.exe connect 127.0.0.1:62001", |
| 39 | + }; |
| 40 | + |
| 41 | + // Run and wait for exit |
| 42 | + ProcessLines(lines); |
| 43 | + Console.WriteLine("\r\nPress a key"); |
| 44 | + Console.ReadKey(); |
| 45 | + } |
| 46 | + |
| 47 | + private static void ProcessLines(List<string> lines) |
| 48 | + { |
| 49 | + foreach (var line in lines) |
| 50 | + { |
| 51 | + Process.StandardInput.WriteLine(line); |
| 52 | + Process.StandardInput.Flush(); |
| 53 | + } |
| 54 | + |
| 55 | + Process.StandardInput.Close(); |
| 56 | + Process.WaitForExit(); |
| 57 | + |
| 58 | + var outputs = Process.StandardOutput.ReadToEnd().Split('\n'); |
| 59 | + Console.WriteLine(outputs[outputs.Length - 3]); |
| 60 | + } |
| 61 | + } |
| 62 | +} |
0 commit comments