Example #1
0
        private string IdentifyIso(FileInfo isoFile, out string id)
        {
            id = null;
            var identified = false;

            try
            {
                using (FileStream isoStream = File.OpenRead(isoFile.FullName))
                {
                    var cd       = new DiscUtils.Iso9660.CDReader(isoStream, true);
                    var fileList = cd.Root.GetFiles();
                    foreach (var file in fileList)
                    {
                        var fileName = file.Name.Substring(0, file.Name.IndexOf(';'));
                        if ((fileName.Length == 11) && (fileName.IndexOf('_') == 4) && (fileName.IndexOf('.') == 8))
                        {
                            id         = fileName;
                            identified = true;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            if (!identified)
            {
                return("No Game Identifier found within the ISO File");
            }

            return(null);
        }
        public static string GetTitleID(string ISOFile)
        {
            FileStream ISO = File.OpenRead(ISOFile);

            DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
            Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\PARAM.SFO", FileMode.Open, FileAccess.Read);

            Dictionary <string, object> SfoKeys = Sfo.ReadSfo(ParamSfo);

            string TitleID = (string)SfoKeys["DISC_ID"];

            ISO.Close();
            return(TitleID);
        }
        public static bool isMini(string ISOFile)
        {
            FileStream ISO = File.OpenRead(ISOFile);

            DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
            Stream Icon0 = cdr.OpenFile(@"PSP_GAME\ICON0.PNG", FileMode.Open, FileAccess.Read);

            Bitmap bmp    = new Bitmap(Icon0);
            bool   isMini = (bmp.Width == 80 && bmp.Height == 80);

            bmp.Dispose();
            ISO.Close();

            return(isMini);
        }
        public byte[] ReadFileFromISO(string ISOFile, string FilePath)
        {
            try
            {
                FileStream ISO = File.OpenRead(ISOFile);

                DiscUtils.Iso9660.CDReader cdr = new DiscUtils.Iso9660.CDReader(ISO, false);
                Stream FileStr = cdr.OpenFile(FilePath, FileMode.Open, FileAccess.Read);

                byte[] FileBytes = new byte[FileStr.Length];
                FileStr.Read(FileBytes, 0x00, (int)FileStr.Length);
                ISO.Close();

                return(FileBytes);
            }
            catch (Exception)
            {
                return(new byte[0x00]);
            }
        }