Asynchronous event to display the list of files downloaded
Moderator: SourceGear
-
- Posts: 4
- Joined: Wed Dec 02, 2009 11:07 am
Asynchronous event to display the list of files downloaded
Hi,
I am using Source Gear Vault API in my C# project. I need to display the list of files (like a progress message) that are downloaded during the get(recursive) operation asynchronously. I came across two events in the API that displays the list of files that are downloaded. ServerOperations.GetInstance().UserMessage and ClientInstance.EventEngine.AddListener(). I tried both. But, I found that these events are triggered only after all the files are downloaded to the disk. That is not useful to me. I need the events to be fired at once each file is getting downloaded when doing a recursive get using the GetOperations.ProcessCommandGet on a folder.
Did Source Gear API have such an event support?
Thanks,
Christinson.
I am using Source Gear Vault API in my C# project. I need to display the list of files (like a progress message) that are downloaded during the get(recursive) operation asynchronously. I came across two events in the API that displays the list of files that are downloaded. ServerOperations.GetInstance().UserMessage and ClientInstance.EventEngine.AddListener(). I tried both. But, I found that these events are triggered only after all the files are downloaded to the disk. That is not useful to me. I need the events to be fired at once each file is getting downloaded when doing a recursive get using the GetOperations.ProcessCommandGet on a folder.
Did Source Gear API have such an event support?
Thanks,
Christinson.
Re: Asynchronous event to display the list of files downloaded
You'll need to listen to the StatusMessageEvent through the EventEngine. If you want more real-time download messages, add a listener for the ProgressChangedEvent.
Subscribe to the Fortress/Vault blog
-
- Posts: 4
- Joined: Wed Dec 02, 2009 11:07 am
Re: Asynchronous event to display the list of files downloaded
Tried subscribing to the StatusMessageEvent, but I got only the following messages while performing a recursive get operation on a folder.
Retrieving repository structure information from the server...
Saving repository information to disk...
Working
Updating local files...
I did not get the list of files downloaded. Also, the ProgressChangedEvent only has the percentage of progess, it does not give the list of files that are being downloaded.
Thanks,
Christinson.
Retrieving repository structure information from the server...
Saving repository information to disk...
Working
Updating local files...
I did not get the list of files downloaded. Also, the ProgressChangedEvent only has the percentage of progess, it does not give the list of files that are being downloaded.
Thanks,
Christinson.
Re: Asynchronous event to display the list of files downloaded
That's odd. Is it possible that your get request is not getting any files? Are they already up to date in the working folder?
Subscribe to the Fortress/Vault blog
-
- Posts: 4
- Joined: Wed Dec 02, 2009 11:07 am
Re: Asynchronous event to display the list of files downloaded
My working folder was empty when I tried the get and I verified with the windows explorer that, the files were getting downloaded.
Thanks,
Christinson.
Thanks,
Christinson.
Re: Asynchronous event to display the list of files downloaded
This code worked for me:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VaultClientIntegrationLib;
namespace GetOutputer
{
class PrivateClass
{
public void Run()
{
string url = "http://localhost/VaultService";
string username = "admin";
string password = "admin";
string repository = "Test Repository";
// Set the login options and login/connect to a repository.
ServerOperations.client.LoginOptions.URL = url;
ServerOperations.client.LoginOptions.User = username;
ServerOperations.client.LoginOptions.Password = password;
ServerOperations.client.LoginOptions.Repository = repository;
ServerOperations.Login();
ServerOperations.client.ClientInstance.EventEngine.addListener(this, typeof(VaultClientOperationsLib.StatusMessageEvent));
GetOperations.ProcessCommandGetToLocationOutsideWorkingFolder(new string[] {"$"}, new GetOptions(), "c:\\temp\\GetLocation");
}
public void HandleEvent(VaultClientOperationsLib.StatusMessageEvent e)
{
Console.Out.WriteLine(e.Message);
}
}
class Program
{
static void Main(string[] args)
{
PrivateClass p = new PrivateClass();
p.Run();
}
}
}
Subscribe to the Fortress/Vault blog
-
- Posts: 4
- Joined: Wed Dec 02, 2009 11:07 am
Re: Asynchronous event to display the list of files downloaded
Thanks for your sample code.
I am using almost a similar code. The only difference in my code is, I am using the API 'GetOperations.ProcessCommandGet' with working folder set instead of using 'GetOperations.ProcessCommandGetToLocationOutsideWorkingFolder'.
I found that, when I use 'GetOperations.ProcessCommandGet' the event does not trigger some times. It some times display only the mesage 'Working', 'Updating local files... ' and dont list out the names of the files that are downloaded. I verified that no files exist in the target folder before initating the Get operation in each round of testing.
But when I use 'GetOperations.ProcessCommandGetToLocationOutsideWorkingFolder', the event get fired all the time as expected.
Can you please tell me whether there is any issue exist with the API 'GetOperations.ProcessCommandGet' ?
Thanks,
Christinson.
I am using almost a similar code. The only difference in my code is, I am using the API 'GetOperations.ProcessCommandGet' with working folder set instead of using 'GetOperations.ProcessCommandGetToLocationOutsideWorkingFolder'.
I found that, when I use 'GetOperations.ProcessCommandGet' the event does not trigger some times. It some times display only the mesage 'Working', 'Updating local files... ' and dont list out the names of the files that are downloaded. I verified that no files exist in the target folder before initating the Get operation in each round of testing.
But when I use 'GetOperations.ProcessCommandGetToLocationOutsideWorkingFolder', the event get fired all the time as expected.
Can you please tell me whether there is any issue exist with the API 'GetOperations.ProcessCommandGet' ?
Thanks,
Christinson.
Re: Asynchronous event to display the list of files downloaded
It's probable that those files are cached in you client cache folder, and aren't being downloaded from the server. They're just being copied from another location on disk. To force a full cache-free get latest, set a new working folder before doing the get.
Subscribe to the Fortress/Vault blog