Beispiel #1
0
        public CriAcbFile(FileStream fs, long offset, bool includeCueIdInFileName)
        {
            // initialize UTF
            this.Initialize(fs, offset);

            // initialize ACB specific items
            this.InitializeCueList(fs);
            this.InitializeCueNameToWaveformMap(fs, includeCueIdInFileName);

            // initialize internal AWB
            if (this.InternalAwbFileSize > 0)
            {
                if (CriAfs2Archive.IsCriAfs2Archive(fs, (long)this.InternalAwbFileOffset))
                {
                    this.InternalAwb = new CriAfs2Archive(fs, (long)this.InternalAwbFileOffset);
                }
                else if (CriCpkArchive.IsCriCpkArchive(fs, (long)this.InternalAwbFileOffset))
                {
                    this.InternalCpk = new CriCpkArchive();
                    this.InternalCpk.Initialize(fs, (long)this.InternalAwbFileOffset, true);
                }
            }

            // initialize external AWB

            // @TODO: This isn't correct for files with CPKs
            if ((this.StreamAwbAfs2HeaderSize > 0) ||
                (!ByteConversion.IsZeroFilledByteArray(this.StreamAwbHash)))
            {
                // get external file name
                this.StreamfilePath = this.GetStreamfilePath();

                // get file type
                using (FileStream awbFs = File.Open(this.StreamfilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    // AWB
                    if (CriAfs2Archive.IsCriAfs2Archive(awbFs, 0))
                    {
                        this.ExternalAwb = new CriAfs2Archive(awbFs, 0);
                    }
                    // CPK
                    else if (CriCpkArchive.IsCriCpkArchive(awbFs, 0))
                    {
                        this.ExternalCpk = new CriCpkArchive();
                        this.ExternalCpk.Initialize(awbFs, 0, true);
                    }
                }
            }
        }