AlbLib.XLD.XLDNavigator.GoToSubfile C# (CSharp) Method

GoToSubfile() public method

public GoToSubfile ( short index ) : XLDNavigator
index short
return XLDNavigator
		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;
		}
		

Usage Example

コード例 #1
0
        public static XLDNavigator ReadToIndex(Stream stream, short index)
        {
            XLDNavigator nav = new XLDNavigator(stream);

            return(nav.GoToSubfile(index));
        }
All Usage Examples Of AlbLib.XLD.XLDNavigator::GoToSubfile