-
Notifications
You must be signed in to change notification settings - Fork 35
/
PVRTexTool.cs
57 lines (46 loc) · 1.67 KB
/
PVRTexTool.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace ProcessExitSample
{
class Program
{
static void Main(string[] args)
{
try
{
var old_args = String.Join(" ", args);
var new_args = old_args;
if (old_args.Contains("-q etc"))
{
new_args = new Regex("-q [A-Za-z]*").Replace(new_args,"-q etcfast");
}
else if (old_args.Contains("-q pvrtc"))
{
new_args = new Regex("-q [A-Za-z]*").Replace(new_args,"-q pvrtcfastest");
}
//Console.WriteLine(new_args);
Process firstProc = new Process();
firstProc.StartInfo.FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PVRTexTool_orig.exe");
firstProc.StartInfo.Arguments = new_args;
firstProc.StartInfo.RedirectStandardOutput = true;
firstProc.StartInfo.UseShellExecute = false;
firstProc.EnableRaisingEvents = true;
firstProc.Start();
Console.WriteLine(firstProc.StandardOutput.ReadToEnd());
firstProc.WaitForExit();
//You may want to perform different actions depending on the exit code.
Environment.Exit(firstProc.ExitCode);
}
catch (Exception ex)
{
Console.WriteLine("An error occurred!!!: " + ex.Message);
}
finally
{
Environment.Exit(1);
}
}
}
}