Beispiel #1
0
        private string[] addUmdFileNames(string dirName, File[] files)
        {
            if (files == null)
            {
                return(null);
            }

            string[] fileNames = new string[files.Length];
            for (int i = 0; i < files.Length; i++)
            {
                VirtualPBP virtualPBP = new VirtualPBP();
                virtualPBP.umdFile = files[i].AbsolutePath;

                int umdIndex = umdFiles.Count;
                umdFiles.Add(virtualPBP);
                fileNames[i] = string.Format("@UMD{0:D}", umdIndex);

                //if (log.DebugEnabled)
                {
                    Console.WriteLine(string.Format("{0}={1}", fileNames[i], files[i].AbsolutePath));
                }
            }

            return(fileNames);
        }
Beispiel #2
0
        private string getUmdFileName(string fileName, StringBuilder restFileName)
        {
            VirtualPBP virtualPBP = getVirtualPBP(fileName, restFileName);

            if (virtualPBP == null)
            {
                return(null);
            }

            return(virtualPBP.umdFile);
        }
Beispiel #3
0
        public override IVirtualFile ioOpen(string fileName, int flags, int mode)
        {
            StringBuilder restFileName = new StringBuilder();
            VirtualPBP    virtualPBP   = getVirtualPBP(fileName, restFileName);

            if (virtualPBP != null && isVirtualFile(restFileName.ToString()))
            {
                string umdFileName = virtualPBP.umdFile;
                File   umdFile     = new File(umdFileName);

                // Is it a directory containing an EBOOT.PBP file?
                if (umdFile.Directory)
                {
                    StringBuilder      localFileName = new StringBuilder();
                    IVirtualFileSystem vfs           = getUmdVfs(umdFileName, localFileName);
                    if (vfs != null)
                    {
                        // Open the EBOOT.PBP file inside the directory
                        return(vfs.ioOpen(localFileName.ToString() + "/" + restFileName.ToString(), flags, mode));
                    }
                }

                // Map the ISO/CSO file into a virtual PBP file
                if (virtualPBP.vFile == null)
                {
                    virtualPBP.vFile = new XmbIsoVirtualFile(umdFileName);
                }
                if (virtualPBP.vFile.Length() > 0)
                {
                    return(virtualPBP.vFile);
                }

                //if (log.DebugEnabled)
                {
                    Console.WriteLine(string.Format("XmbVirtualFileSystem.ioOpen could not open UMD file '{0}'", umdFileName));
                }
            }

            return(vfs.ioOpen(fileName, flags, mode));
        }