Esempio n. 1
0
        /// <summary>
        /// Starts the extraction process from the original game's files.
        /// </summary>
        /// <param name="progress">ProgressReporter to report the progress to.</param>
        public void Extract(ProgressReporter progress)
        {
            SafeNativeMethods.SetDllDirectory("libs/");

            progress.AddSubProgress(5, weight: 1);
            progress.AddSubProgress(1, weight: 10); // there are 5k SMK files in the MFF file.

            var dbiExtractor = new DbiExtractor();

            var cdMusicExtractor = new CompactDiscMusicExtractor();
            var mdbExtractor     = new MdbExtractor();
            var zipMdbExtractor  = new ZippedMdbExtractor(mdbExtractor);
            var smkExtractor     = new SmackerVideoExtractor();
            var mffExtractor     = new MffExtractor(smkExtractor);

            Directory.CreateDirectory(m_tempFilesPath);

            Parallel.Invoke
            (
                () => cdMusicExtractor.Extract
                (
                    new ExtractionPaths
            {
                OriginalFileName = $@"{m_originalFilesPath[0]}:\",
                OriginalFilePath = $@"{m_originalFilesPath[0]}:\",
                OutputDirectory  = Path.Combine(m_newFilesPath, "Music"),
                TempDirectory    = m_tempFilesPath
            }, progress[0]
                ),

                () => ExtractFiles(GetMdbFolders(), "*.mdb", mdbExtractor, progress[1]),
                () => ExtractFiles(GetMdbFolders(), "*.zip", zipMdbExtractor, progress[2]),
                () => ExtractFiles(GetDbiFolders(), "*.dbi", dbiExtractor, progress[3]),
                () => ExtractFiles(GetSmkImageFolders(), "*.smk", smkExtractor, progress[4]),
                () => ExtractFiles(GetMffFolders(), "*.ff", mffExtractor, progress[5])
            );

            Directory.Delete(m_tempFilesPath, recursive: true);
        }
 public ZippedMdbExtractor(MdbExtractor mdbExtractor)
 {
     m_mdbExtractor = mdbExtractor;
 }