public MftContent ReadContent() { using (StreamReader sr = new StreamReader(_filePath, Encoding.ASCII)) { TerrabuilderVersion version = ReadVersion(sr); String indexFilePath = ReadIndexFilePath(sr); List <DbPackage> packages = new List <DbPackage>(); while (TryReadPackage(sr, packages.Count, out DbPackage package)) { packages.Add(package); } return(new MftContent(version, indexFilePath, packages.ToArray())); } }
public DbExtractor(TerrabuilderVersion version, String outputDirectory) { _version = version; _outputDirectory = outputDirectory ?? throw new ArgumentNullException(nameof(outputDirectory)); Int32 count = Environment.ProcessorCount; _threads = new Thread[count]; _semaphore = new Semaphore(count, count); _queue = new Queue <Tuple <DbPackage, IdxEntry> >(count); _exceptions = new List <Exception>(count); for (Int32 i = 0; i < _threads.Length; i++) { Thread thread = new Thread(Extract); _threads[i] = thread; thread.Start(new ThreadContext()); } }
public MftContent(TerrabuilderVersion version, String indexFilePath, IReadOnlyList <DbPackage> dbPackage) { Version = version ?? throw new NullReferenceException(nameof(version)); IndexFilePath = indexFilePath ?? throw new NullReferenceException(nameof(indexFilePath)); Packages = dbPackage ?? throw new NullReferenceException(nameof(dbPackage)); }