-
Notifications
You must be signed in to change notification settings - Fork 95
/
Fastboot.cs
42 lines (37 loc) · 1.12 KB
/
Fastboot.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Diagnostics;
using System.IO;
namespace FastbootEnhance
{
class Fastboot : IDisposable
{
Process process;
public StreamReader stdout;
public StreamReader stderr;
public Fastboot(string serial, string action)
{
process = new Process();
process.StartInfo.FileName = ".\\fastboot.exe";
process.StartInfo.Arguments = serial == null ? action :
"\"-s\" \"" + serial + "\" " + action;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
stdout = process.StandardOutput;
stderr = process.StandardError;
}
public void Dispose()
{
process.Close();
process = null;
}
~Fastboot()
{
if (process != null)
Dispose();
}
}
}