in AdlsDotNetSDK/FileTransfer/TransferLog.cs [120:177]
private void LoadFrom(string validateMetaData)
{
using (var reader = new StreamReader(_stream, Encoding.UTF8, true, 4096, true))
{
string line = reader.ReadLine();
// Validates the version of the metadata file and current parser is same. This will only change between
// version change in sdk.
if (line == null || !line.Equals($"{FirstLineConst},{validateMetaData}"))
{
throw new ArgumentException("Version line is missing or does not match with current version line. This can happen if the version of the SDK changed between runs or if you changed specification between runs. Please run without resume flag.");
}
while ((line = reader.ReadLine()) != null)
{
string validateLine;
if (!ValidateMetaData(line, out validateLine))
{
continue;
}
string[] entryArr = validateLine.Split(MetaDataDelimiter);
string src = entryArr[1];
if (entryArr[0].Equals("BEGIN"))
{
if (!LoadedMetaData.ContainsKey(src))
{
var metadata = new MetaData
{
SegmentFolder = entryArr[2],
Chunks = new HashSet<int>()
};
LoadedMetaData.Add(src, metadata);
}
else if (!entryArr[2].Equals(LoadedMetaData[src].SegmentFolder)) // This will never happen
{
throw new Exception("Unexpected problem in the resume file. The segment file or folder can never be different");
}
}
else if (entryArr[0].Equals("CHUNK"))
{
if (LoadedMetaData[src]!=null)
{
LoadedMetaData[src].Chunks.Add(Int32.Parse(entryArr[2]));
}
}
else if (entryArr[0].Equals("COMPLETE"))
{
// If complete then store null
if (LoadedMetaData.ContainsKey(src)) // Meaning this was a chunked file transfer
{
LoadedMetaData[src] = null;
}
else
{
LoadedMetaData.Add(src, null);
}
}
}
}
}