Пример #1
0
        public async Task OpenFile(BinaryFile file)
        {
            // Clear virtual path if it exists
            if (!string.IsNullOrEmpty(VirtualPath) && CurrentFileSystem.DirectoryExists(VirtualPath))
            {
                CurrentFileSystem.DeleteDirectory(VirtualPath);
            }

            VirtualPath = CurrentFileSystem.GetTempDirectory();

            if (await NcsdFile.IsNcsd(file))
            {
                Container = await NcsdFile.Load(file);
            }
            else if (await CiaFile.IsCia(file))
            {
                Container = await CiaFile.Load(file);
            }
            else if (await NcchPartition.IsNcch(file))
            {
                Container = new SingleNcchPartitionContainer(await NcchPartition.Load(file));
            }
            else if (await RomFs.IsRomFs(file))
            {
                Container = new SingleNcchPartitionContainer(new NcchPartition(romfs: await RomFs.Load(file)));
            }
            else if (await ExeFs.IsExeFs(file))
            {
                Container = new SingleNcchPartitionContainer(new NcchPartition(exefs: await ExeFs.Load(file)));
            }
            else
            {
                throw new BadImageFormatException(Properties.Resources.ThreeDsRom_UnsupportedFileFormat);
            }
        }
Пример #2
0
        public async Task OpenFile(IReadOnlyBinaryDataAccessor file)
        {
            // Clear virtual path if it exists
            if (!string.IsNullOrEmpty(VirtualPath) && CurrentFileSystem.DirectoryExists(VirtualPath))
            {
                CurrentFileSystem.DeleteDirectory(VirtualPath);
            }

            VirtualPath = CurrentFileSystem.GetTempDirectory();

            if (await NcsdFile.IsNcsd(file))
            {
                Container = await NcsdFile.Load(file);
            }
            else if (file is BinaryFile binaryFile && await CiaFile.IsCia(binaryFile))
            {
                Container = await CiaFile.Load(file);
            }
Пример #3
0
 public static async Task <bool> IsThreeDsRom(BinaryFile file)
 {
     return(await NcsdFile.IsNcsd(file) || await CiaFile.IsCia(file) || await NcchPartition.IsNcch(file) || await RomFs.IsRomFs(file) || await ExeFs.IsExeFs(file));
 }