1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00

Close file once upload is done.

This commit is contained in:
Ylian Saint-Hilaire
2021-07-02 09:55:19 -07:00
parent edd7b9d080
commit 1cc9939f69

View File

@@ -489,12 +489,15 @@ namespace MeshCentralRouter
}
else if (action == "uploaddone")
{
// Clean up current upload
uploadFilePtr = 0;
uploadFileSize = 0;
if (uploadFileStream != null) { uploadFileStream.Close(); uploadFileStream = null; }
// Check if another file needs to be uploaded
if (uploadFileArray.Count > uploadFileArrayPtr + 1)
{
// Upload the next file
uploadFilePtr = 0;
uploadFileSize = 0;
if (uploadFileStream != null) { uploadFileStream.Close(); uploadFileStream = null; }
uploadFileArrayPtr++;
uploadNextFile();
}
@@ -572,6 +575,7 @@ namespace MeshCentralRouter
private void UpdateStatus()
{
if (this.IsDisposed) return;
if (this.InvokeRequired) { this.Invoke(new UpdateStatusHandler(UpdateStatus)); return; }
//if (kvmControl == null) return;
@@ -621,6 +625,28 @@ namespace MeshCentralRouter
}
node.fileViewer = null;
// Clean up any downloads
if (downloadFileStream != null) { downloadFileStream.Close(); downloadFileStream = null; }
downloadFilePtr = 0;
downloadFileSize = 0;
downloadActive = false;
downloadStop = false;
downloadFileArrayPtr = -1;
downloadFileArray = null;
downloadLocalPath = null;
downloadRemotePath = null;
// Clean up any uploads
uploadActive = false;
uploadStop = false;
uploadFileArrayPtr = -1;
uploadFileArray = null;
uploadLocalPath = null;
uploadRemotePath = null;
uploadFilePtr = 0;
uploadFileSize = 0;
if (uploadFileStream != null) { uploadFileStream.Close(); uploadFileStream = null; }
// Save window location
Settings.SetRegValue("filelocation", Location.X + "," + Location.Y + "," + Size.Width + "," + Size.Height);
}