/// <summary> /// Create and return a IndexedSequenceProvider to the source file if exists /// </summary> /// <param name="sourceFilename">Source file name.</param> /// <returns>IndexedSequenceProvider object if an index file exists else null.</returns> public static SidecarFileProvider GetProvider(string sourceFilename) { SidecarFileProvider provider = null; string fileName = sourceFilename + IndexFileExtension; if (File.Exists(fileName)) { try { provider = new SidecarFileProvider(sourceFilename); } catch { throw new OperationCanceledException(); } } FileInfo fileInfo = new FileInfo(fileName); if ((provider != null && _sidecarLastWriteTime == fileInfo.LastWriteTime.Date.ToFileTime()) && (_sidecarLength == fileInfo.Length)) { // Check if the file properties match if ( provider._header.FileVersion == FileVersion && provider._header.LastWriteTime == new FileInfo(sourceFilename).LastWriteTime) { return(provider); } } return(null); }
/// <summary> /// Initializes a new instance of the VirtualQualitativeSequenceList class with a specified provider, /// a specified parser, and a specifed sequence count. /// </summary> /// <param name="provider">SequencePointer provider from sidecar file.</param> /// <param name="parser">Parser used to parse sequence data on request.</param> /// <param name="count">Number of items in the actual file.</param> public VirtualQualitativeSequenceList(SidecarFileProvider provider, IVirtualSequenceParser parser, int count) { _sequenceParser = parser; _sidecarProvider = provider; _count = count; _sequenceDictionary = new Dictionary <int, WeakReference>(_count); }