Made a seperate class for the update script

This commit is contained in:
FUH22860 2022-12-05 18:19:18 +01:00
parent 9c05f3ac83
commit 263f69b2b8
2 changed files with 31 additions and 21 deletions

View File

@ -1,22 +1,5 @@
using System.Diagnostics;
string homePath;
if(Environment.OSVersion.Platform == PlatformID.Unix) {
homePath = Environment.GetEnvironmentVariable("HOME");
} else {
Console.WriteLine("This script doesn't support your operating system.");
public class Program {
static void Main(string[] args) {
}
Process process = new Process();
ProcessStartInfo processStartInfo = new ProcessStartInfo();
//processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
processStartInfo.FileName = @"yay";
//processStartInfo.WorkingDirectory = homePath;
//processStartInfo.Arguments = "--color";
processStartInfo.RedirectStandardOutput = false;
processStartInfo.RedirectStandardError = false;
processStartInfo.UseShellExecute = true;
process.StartInfo = processStartInfo;
process.Start();
}

27
Update.cs Normal file
View File

@ -0,0 +1,27 @@
using System.Diagnostics;
public class Update {
public string homePath { get; set; } = string.Empty;
public void getHomePath() {
if(Environment.OSVersion.Platform == PlatformID.Unix) {
homePath = Environment.GetEnvironmentVariable("HOME");
} else {
Console.WriteLine("This script doesn't support your operating system.");
}
}
public void startUpdate() {
Process process = new Process();
ProcessStartInfo processStartInfo = new ProcessStartInfo();
//processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
processStartInfo.FileName = @"yay";
processStartInfo.WorkingDirectory = homePath;
//processStartInfo.Arguments = "--color";
processStartInfo.RedirectStandardOutput = false;
processStartInfo.RedirectStandardError = false;
processStartInfo.UseShellExecute = true;
process.StartInfo = processStartInfo;
process.Start();
}
}