To download a file the following steps must be done:
- Create a Routing Data Store(Gevasys.DataCore.StaticData.Http.RoutingDataStore Class).
- Create a instance of the required request message.
- Optional: Implement the interface IAsyncRouteCallback ( Gevasys.DataCore.StaticData.IAsyncRouteCallback Interface) for the calling class, if async download is needed
- Execute the request.
The file is automatically written to the designated output file. Existing files will be overwritten.
{
class ExampleDownloadFile : IAsyncCallback
{
public void Completed(bool success, object state)
{
}
public void Main()
{
if (!ConfigurationHelper.Initialize())
{
return;
}
RoutingDataStore rds = ConfigurationHelper.RoutingDataStore;
rds.DownloadFile("test.txt", "outtest.txt");
rds.DownloadFileAsync("test.txt", "out.txt", this, null);
}
}
}