Exemplo n.º 1
0
        protected override void DoTaskForFile(string pPath, IVgmtWorkerStruct pTaskStruct,
                                              DoWorkEventArgs e)
        {
            WadUnpackerStruct ws = (WadUnpackerStruct)pTaskStruct;

            NintendoWad       wad;
            NintendoU8Archive u8;

            string[] extractedFiles;

            if (NintendoWad.IsWadFile(pPath))
            {
                //-------------
                // Extract WAD
                //-------------
                wad = new NintendoWad(pPath);

                if (ws.ExtractAllFiles)
                {
                    extractedFiles = wad.ExtractAll();
                }
                else
                {
                    extractedFiles = wad.ExtractContent();
                }

                this.progressStruct.Clear();
                this.progressStruct.GenericMessage = String.Format("[{0}]{1}    WAD Unpacked.{1}", Path.GetFileName(pPath), Environment.NewLine);
                ReportProgress(this.progress, this.progressStruct);

                //---------------------
                // Extract U8 Archives
                //---------------------
                if (ws.UnpackExtractedU8Files)
                {
                    foreach (string f in extractedFiles)
                    {
                        if (NintendoU8Archive.IsU8File(f))
                        {
                            this.progressStruct.Clear();
                            this.progressStruct.GenericMessage = String.Format("    Extracting U8: {0}{1}", Path.GetFileName(f), Environment.NewLine);
                            ReportProgress(this.progress, this.progressStruct);

                            u8 = new NintendoU8Archive(f);
                            u8.ExtractAll();
                        }
                    }
                }
            }
        }
        protected override void DoTaskForFile(string pPath, IVgmtWorkerStruct pTaskStruct,
                                              DoWorkEventArgs e)
        {
            U8ArchiveUnpackerStruct ws = (U8ArchiveUnpackerStruct)pTaskStruct;
            NintendoU8Archive       u8;

            if (NintendoU8Archive.IsU8File(pPath))
            {
                u8 = new NintendoU8Archive(pPath);
                u8.ExtractAll();

                this.progressStruct.Clear();
                this.progressStruct.GenericMessage = String.Format("[{0}]{1}", Path.GetFileName(pPath), Environment.NewLine);
                ReportProgress(this.progress, this.progressStruct);
            }
            else
            {
                this.progressStruct.Clear();
                this.progressStruct.GenericMessage = String.Format("[{0}] is not a U8 File.{1}", Path.GetFileName(pPath), Environment.NewLine);
                ReportProgress(this.progress, this.progressStruct);
            }
        }