mirror of
https://github.com/Stone-Red-Code/HyperbolicDownloader.git
synced 2026-09-04 09:06:10 +02:00
Fix important bug
- Fixed a bug that caused the content of the file to be sent as the filename
This commit is contained in:
@@ -167,6 +167,9 @@ namespace HyperbolicDownloaderApi.Networking
|
||||
FileInfo fileInfo = new FileInfo(hyperFileInfo.FilePath);
|
||||
|
||||
bytesToSend = Encoding.ASCII.GetBytes($"{fileInfo.Length}/{Path.GetFileName(hyperFileInfo.FilePath)}");
|
||||
|
||||
Array.Resize(ref bytesToSend, 1000);
|
||||
|
||||
await nwStream.WriteAsync(bytesToSend);
|
||||
|
||||
foreach (byte[]? chunk in FileCompressor.ReadChunks(hyperFileInfo.FilePath, 64000))
|
||||
@@ -182,12 +185,15 @@ namespace HyperbolicDownloaderApi.Networking
|
||||
bytesToSend = Encoding.ASCII.GetBytes("File not found!");
|
||||
await nwStream.WriteAsync(bytesToSend);
|
||||
}
|
||||
client.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
client.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopListening()
|
||||
|
||||
Reference in New Issue
Block a user