コード例 #1
0
        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()));
            }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
ファイル: MftContent.cs プロジェクト: Albeoris/Septerra
 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));
 }