예제 #1
0
        public static async Task <bool> IsExeFs(IReadOnlyBinaryDataAccessor file)
        {
            try
            {
                if (file.Length < 0x200)
                {
                    return(false);
                }

                var exefs = await ExeFs.Load(file).ConfigureAwait(false);

                return(exefs.Files.Any() && exefs.AreAllHashesValid());
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
 public async Task Initialize(IReadOnlyBinaryDataAccessor data)
 {
     if (Header != null && Header.RomFsSize > 0)
     {
         if (Header.ExeFsOffset > 0 && Header.ExeFsSize > 0)
         {
             ExeFs = await ExeFs.Load(data.GetReadOnlyDataReference((long)Header.ExeFsOffset *MediaUnitSize, (long)Header.ExeFsSize *MediaUnitSize));
         }
         if (Header.RomFsOffset > 0 && Header.RomFsOffset > 0)
         {
             RomFs = await RomFs.Load(data.GetReadOnlyDataReference((long)Header.RomFsOffset *MediaUnitSize, (long)Header.RomFsSize *MediaUnitSize));
         }
         if (Header.ExHeaderSize > 0)
         {
             ExHeader = data.GetReadOnlyDataReference(0x200, Header.ExHeaderSize);
         }
     }
 }
예제 #3
0
        public static async Task <bool> IsExeFs(IBinaryDataAccessor file)
        {
            try
            {
                if (file.Length < 0x200)
                {
                    return(false);
                }

                var exefsHeaders = (await ExeFs.Load(file)).Headers.Where(h => !string.IsNullOrEmpty(h.Filename));
                if (!exefsHeaders.Any())
                {
                    return(false);
                }

                return(exefsHeaders.All(h => h.Offset >= 0x200 && (h.Offset + h.FileSize) < file.Length));
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #4
0
        public async Task Initialize(IReadOnlyBinaryDataAccessor data)
        {
            this.RawData = data;
            if (Header != null && Header.RomFsSize > 0)
            {
                if (Header.ExeFsOffset > 0 && Header.ExeFsSize > 0)
                {
                    ExeFs = await ExeFs.Load(data.Slice((long)Header.ExeFsOffset *MediaUnitSize, (long)Header.ExeFsSize *MediaUnitSize));
                }
                if (Header.RomFsOffset > 0 && Header.RomFsOffset > 0)
                {
                    RomFs = await RomFs.Load(data.Slice((long)Header.RomFsOffset *MediaUnitSize, (long)Header.RomFsSize *MediaUnitSize));
                }
                if (Header.ExHeaderSize > 0)
                {
                    ExHeader = await NcchExtendedHeader.Load(data.Slice(0x200, Header.ExHeaderSize));
                }

                PlainRegion = await data.ReadStringAsync(Header.PlainRegionOffset *MediaUnitSize, Header.PlainRegionSize *MediaUnitSize, Encoding.ASCII);

                Logo = await data.ReadArrayAsync(Header.LogoRegionOffset *MediaUnitSize, Header.LogoRegionSize *MediaUnitSize);
            }
        }