in AdlsDotNetSDK/Core.cs [1389:1454]
public static async Task<ContentSummary> GetContentSummaryAsync(string path, AdlsClient client, RequestOptions req, OperationResponse resp, CancellationToken cancelToken = default(CancellationToken))
{
ContentSummary summary;
var responseTuple = await WebTransport.MakeCallAsync("GETCONTENTSUMMARY", path, default(ByteBuffer), default(ByteBuffer), new QueryParams(), client, req, resp, cancelToken).ConfigureAwait(false);
if (!resp.IsSuccessful) return null;
if (responseTuple != null)
{
try
{
using (MemoryStream stream = new MemoryStream(responseTuple.Item1))
{
using (StreamReader stReader = new StreamReader(stream))
{
using (var jsonReader = new JsonTextReader(stReader))
{
long directoryCount = 0, fileCount = 0, length = 0, spaceConsumed = 0;
jsonReader.Read();//{
jsonReader.Read();//"ContentSummary"
jsonReader.Read();//{
do
{
jsonReader.Read();
if (jsonReader.TokenType.Equals(JsonToken.PropertyName))
{
if (((string)jsonReader.Value).Equals("directoryCount"))
{
jsonReader.Read();
directoryCount = (long)jsonReader.Value;
}
else if (((string)jsonReader.Value).Equals("fileCount"))
{
jsonReader.Read();
fileCount = (long)jsonReader.Value;
}
else if (((string)jsonReader.Value).Equals("length"))
{
jsonReader.Read();
fileCount = (long)jsonReader.Value;
}
else if (((string)jsonReader.Value).Equals("spaceConsumed"))
{
jsonReader.Read();
spaceConsumed = (long)jsonReader.Value;
}
}
} while (!jsonReader.TokenType.Equals(JsonToken.EndObject));
summary = new ContentSummary(directoryCount, fileCount, length, spaceConsumed);
}
}
}
}
catch (Exception ex)
{
resp.IsSuccessful = false;
resp.Error = $"Unexpected problem with parsing JSON output. \r\nExceptionType: {ex.GetType()} \r\nExceptionMessage: {ex.Message}";
return null;
}
}
else
{
resp.IsSuccessful = false;
resp.Error = "";
return null;
}
return summary;
}