in AdlsDotNetSDK/Core.cs [587:632]
public static async Task ConcatAsync(string path, List<string> sourceFiles, bool deleteSourceDirectory, AdlsClient client,
RequestOptions req, OperationResponse resp, CancellationToken cancelToken = default(CancellationToken))
{
if (sourceFiles == null || sourceFiles.Count == 0)
{
resp.IsSuccessful = false;
resp.Error = "No source files to concatenate";
return;
}
HashSet<string> hashSet = new HashSet<string>();//To check whether we have duplciate file names in the list
Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray();
foreach (var sourceFile in sourceFiles)
{
if (string.IsNullOrEmpty(sourceFile))
{
resp.IsSuccessful = false;
resp.Error = "One of the Files to concatenate is empty";
return;
}
if (sourceFile.Equals(path))
{
resp.IsSuccessful = false;
resp.Error = "One of the Files to concatenate has same path";
return;
}
if (hashSet.Contains(sourceFile))
{
resp.IsSuccessful = false;
resp.Error = "One of the Files to concatenate is same as another file";
return;
}
jArray.Add(sourceFile);
}
Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject();
jObject.Add("sources", jArray);
byte[] body = Encoding.UTF8.GetBytes(jObject.ToString(Formatting.None));
QueryParams qp = new QueryParams();
if (deleteSourceDirectory)
{
qp.Add("deleteSourceDirectory", "true");
}
IDictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("Content-Type", "application/json");
await WebTransport.MakeCallAsync("MSCONCAT", path, new ByteBuffer(body, 0, body.Length), default(ByteBuffer), qp, client, req, resp, cancelToken, headers).ConfigureAwait(false);
}