in AdlsDotNetSDK/Core.cs [510:561]
public static async Task<bool> RenameAsync(string path, string destination, bool overwrite, AdlsClient client,
RequestOptions req, OperationResponse resp, CancellationToken cancelToken = default(CancellationToken))
{
bool isSuccessful = false;
if (string.IsNullOrEmpty(destination))
{
resp.IsSuccessful = false;
resp.Error = "Destination path is null";
return false;
}
QueryParams qp = new QueryParams();
qp.Add("destination", destination);
if (overwrite) qp.Add("renameoptions", "overwrite");
var responseTuple = await WebTransport.MakeCallAsync("RENAME", path, default(ByteBuffer), default(ByteBuffer), qp, client, req, resp, cancelToken).ConfigureAwait(false);
if (!resp.IsSuccessful) return false;
if (responseTuple != null)
{
try
{
using (MemoryStream stream = new MemoryStream(responseTuple.Item1))
{
using (StreamReader stReader = new StreamReader(stream))
{
using (var jsonReader = new JsonTextReader(stReader))
{
jsonReader.Read(); //Start object {
jsonReader.Read(); //"boolean"
if (((string)jsonReader.Value).Equals("boolean"))
{
jsonReader.Read();
isSuccessful = (bool)jsonReader.Value;
}
jsonReader.Read(); //End object}
}
}
}
}
catch (Exception ex)
{
resp.IsSuccessful = false;
resp.Error = resp.Error = $"Unexpected problem with parsing JSON output. \r\nExceptionType: {ex.GetType()} \r\nExceptionMessage: {ex.Message}";
return false;
}
}
else
{
resp.IsSuccessful = false;
resp.Error = "Output is not expected";
return false;
}
return isSuccessful;
}