public int Put(Stream src, IActivityIOPath dst, Dev2CRUDOperationTO args, string whereToPut, List<string> filesToCleanup)
{
var result = -1;
bool ok;
if(args.Overwrite)
{
ok = true;
}
else
{
// try and fetch the file, if not found ok because we not in Overwrite mode
try
{
using(Get(dst, filesToCleanup))
{
ok = false;
}
}
catch(Exception ex)
{
Dev2Logger.Log.Error(this, ex);
ok = true;
}
}
if(ok)
{
try
{
result = IsStandardFtp(dst) ? WriteToFtp(src, dst) : WriteToSftp(src, dst);
}
catch(Exception ex)
{
Dev2Logger.Log.Debug("Exception in Put command");
Dev2Logger.Log.Debug(ex.Message);
Dev2Logger.Log.Debug(ex.StackTrace);
Dev2Logger.Log.Error(this, ex);
throw;
}
}
return result;
}