Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.6k views
in .NET FTP by (1.2k points)
How can I access and override the MenuItemDownload associated with the FTPLocalFileList component? I will also need to be to do the same with the MenuItemUpload for the FTPRemoteFileList component.

Also, where can I go to get the new dll that addresses our file segment issue?

Thank you.

11 Answers

0 votes
by (51.6k points)
Hi Aaron

There are several options for modifying the menus. What exactly is it that you want to achieve?

By "file segment issue" I guess you are referring to the long-vs-int problem. We were really baffled about this since the code in the DLL uses longs and the code that we sent you also uses longs. So we don't really understand where the int's you mentioned appeared. Perhaps you can zip up and e-mail us the DLL you are having problems with so that we can inspect it.

- Hans (EnterpriseDT)
0 votes
by (1.2k points)
I apologize Hans, but whenever I try to download the msi, I get an error during the install. It says there are some corrupt cabinet files. What is meant by the post is: we don't seem to have any problems adding the dll to the project, so can you just provide the dll without the msi file?

About the menus, we have our download and upload methods in place, but they aren't called when we use the menudownload or menuUpload. We would like it to call our download and upload methods when they right-click and select download or upload.

Thanks!
0 votes
by (51.6k points)
I think the easiest way to change the behaviour of the Download menu item is to hide the existing one (by setting MenuItemDownload.Visible=false) and add a new download item to FTPRemoteFileList.Menu.MenuItems collection.

As for the corrupt MSI. When did you last try to download it? We made some changes recently that we hope fixed it.

- Hans (EnterpriseDT)
0 votes
by (1.2k points)
thanks Hans, I tried it about two weeks ago. I will try and download it again.
0 votes
by (1.2k points)
I tried to download the msi file and I am still getting the bad cabinet file error. Can you just get a link to the dll.

Also we have been trying to calculate upload/download speed. We look at a previous post and we have been trying that but it crashes our program everytime we start to download. Do you have any suggests on how to calculate the download speed.
0 votes
by (51.6k points)
Hi Aaron

Sure I'll e-mail you a direct link.

Here's some code for calculating the download speed of a single download:

Create an ExFTPConnection (or FTPConnection or SecureFTPConnection) and add handlers for the Downloading event (to store the start-time) and the BytesTransferred event (to calculate the download speed).
ExFTPConnection exFTP = new ExFTPConnection();
exFTP.Downloading += new FTPFileTransferEventHandler(exFTP_Downloading);
exFTP.BytesTransferred += new BytesTransferredHandler(exFTP_BytesTransferred);

Store the start-time and store in a field.
void exFTP_Downloading(object sender, FTPFileTransferEventArgs e)
{
    downloadStartTime = DateTime.Now;
}

Calculate the download speed and print it to the console.
void exFTP_BytesTransferred(object sender, BytesTransferredEventArgs e)
{
    TimeSpan downloadTime = DateTime.Now - downloadStartTime;
    float downloadSpeed = ((float)e.ByteCount) / downloadTime.TotalSeconds;
    Console.WriteLine("Average download speed = " + downloadSpeed + " bytes per second.");
}


downloadStartTime is a DateTime field of the class.

- Hans (EnterpriseDT)
0 votes
by (700 points)
Hi,

I have a similar situation trying to calculate download speed. The solution provided here is great and works. But my question is if I have more than one download at the same time, how can I track the total bytes downloaded?

My solution was adding a calass member variable TotalBytes. Then try to have the downloding instances update it using their own e.ByteCount. Like this:

    Private Sub BytesTransferred_EventHandler(ByVal sender As System.Object, ByVal e As EnterpriseDT.Net.Ftp.BytesTransferredEventArgs) Handles Me.BytesTransferred
        totalBytes = totalBytes + e.ByteCoun
End


However, this resulted in a logical error. In each time the bytes_transferred event is hit, the total given at the end is not right. It is a lot more than the actual total bytes downloaded. What is the correct logical way of geting a total download size?

Thanks
0 votes
by (162k points)
The bytes transferred amount that is supplied is already the total bytes transferred.
0 votes
by (700 points)
Thanks for the response. Well, then what can I do in order to keep track of all the file sizes that are being downloaded from all the open threads?! My code will not be logically correct in this case?! :!:
0 votes
by (162k points)
Oops. I didn't read your post carefully enough - the simultaneous downloads bit. Of course the bytes transferred amount that is supplied is the total bytes transferred only for a single download.

I guess you need to keep a hashtable of [filename, total bytes transferred], and the complete total at any one time will be the sum of the totals in the hashtable. Each time you get a new total from the event, you'll need to replace the total value that is in the hashtable for that filename.

Categories

...