public XLDNavigator GoToSubfile(short index)
{
if(0 > index || index > nEntries)throw new ArgumentOutOfRangeException("index");
if(index == CurrentSubfile)
{
if(remaining != SubfileLength)
if(baseStream.CanSeek)baseStream.Position = streamStart+entriesPos[index];
else
throw new NotSupportedException("Can't return to previous subfile.");
}
if(baseStream.CanSeek)
{
baseStream.Position = streamStart+entriesPos[index];
}else{
if(CurrentSubfile > index)
{
throw new NotSupportedException("Can't return to previous subfile.");
}
baseStream.Skip(remaining);
for(int i = CurrentSubfile+1; i < index; i++)
baseStream.Skip(entriesLengths[i]);
}
CurrentSubfile = index;
remaining = entriesLengths[index];
return this;
}