-
Notifications
You must be signed in to change notification settings - Fork 6
/
Python.cs
33 lines (30 loc) · 1.09 KB
/
Python.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
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace GFDecompress
{
class Python
{
public static void run(string cmd, string args, ref StreamReader output, ref StreamReader error ) {
ProcessStartInfo start = new ProcessStartInfo();
string envVar = Environment.GetEnvironmentVariable("LOCALAPPDATA");
start.FileName = $@"{envVar}\\Programs\\Python\\Python38-32\\python.exe";
start.Arguments = string.Format("{0} {1}",cmd, args);
start.UseShellExecute = false;
start.CreateNoWindow = false;
start.WorkingDirectory = Directory.GetCurrentDirectory();
start.RedirectStandardOutput = true;
start.RedirectStandardError = true;
using (Process process = Process.Start(start)) {
output = process.StandardOutput;
error = process.StandardError;
}
}
}
}