コード例 #1
0
        internal static long LoadOffset(BinaryReader reader, NintendoOpticalDiscSystem system)
        {
            switch (system)
            {
            case NintendoOpticalDiscSystem.Wii: return(reader.ReadUInt32() * 4L);

            case NintendoOpticalDiscSystem.GameCube: return(reader.ReadUInt32());

            default: throw new NotImplementedException();
            }
        }
コード例 #2
0
        internal static void LoadFileTable(FolderAsset parent, BinaryReader reader, NintendoOpticalDiscSystem system)
        {
            reader.BaseStream.Position = 0x424;
            long fileTableOffset = LoadOffset(reader, system);

            reader.BaseStream.Position = fileTableOffset + 8;
            int count = reader.ReadInt32();

            for (int index = 1; index < count;)
            {
                LoadFile(parent, reader, ref index, system);
            }

            foreach (Asset asset in parent.Children)
            {
                LoadFileName(asset, reader, fileTableOffset + count * 12);
            }
        }
コード例 #3
0
 internal NintendoOpticalDiscPartitionFile(FolderAsset parent, int index, int nameOffset, BinaryReader reader, NintendoOpticalDiscSystem system)
     : base(parent, "")
 {
     Index      = index;
     NameOffset = nameOffset;
     DataOffset = NintendoOpticalDiscPartition.LoadOffset(reader, system);
     Size       = reader.ReadUInt32();
 }
コード例 #4
0
        internal NintendoOpticalDiscPartitionFolder(FolderAsset parent, ref int index, int nameOffset, BinaryReader reader, NintendoOpticalDiscSystem system)
            : base(parent, "")
        {
            Index      = index;
            NameOffset = nameOffset;
            int firstIndex = reader.ReadInt32();

            /*if (firstIndex != index + 1)
             *      throw new InvalidDataException();*/
            int endIndex = reader.ReadInt32();

            index++;
            while (index < endIndex)
            {
                NintendoOpticalDiscPartition.LoadFile(this, reader, ref index, system);
            }
        }
コード例 #5
0
        internal static Asset LoadFile(FolderAsset parent, BinaryReader reader, ref int index, NintendoOpticalDiscSystem system)
        {
            int  nameOffset  = reader.ReadInt32();
            bool isDirectory = (nameOffset & 0xFF000000) != 0;

            nameOffset &= 0xFFFFFF;

            if (isDirectory)
            {
                return(new NintendoOpticalDiscPartitionFolder(parent, ref index, nameOffset, reader, system));
            }
            else
            {
                return(new NintendoOpticalDiscPartitionFile(parent, index++, nameOffset, reader, system));
            }
        }
コード例 #6
0
 internal NintendoOpticalDiscPartitionFolder(FolderAsset parent, ref int index, int nameOffset, BinaryReader reader, NintendoOpticalDiscSystem system)
     : base(parent, "")
 {
     Index = index;
     NameOffset = nameOffset;
     int firstIndex = reader.ReadInt32();
     /*if (firstIndex != index + 1)
         throw new InvalidDataException();*/
     int endIndex = reader.ReadInt32();
     index++;
     while (index < endIndex)
         NintendoOpticalDiscPartition.LoadFile(this, reader, ref index, system);
 }
コード例 #7
0
 internal NintendoOpticalDiscPartitionFile(FolderAsset parent, int index, int nameOffset, BinaryReader reader, NintendoOpticalDiscSystem system)
     : base(parent, "")
 {
     Index = index;
     NameOffset = nameOffset;
     DataOffset = NintendoOpticalDiscPartition.LoadOffset(reader, system);
     Size = reader.ReadUInt32();
 }
コード例 #8
0
 internal static long LoadOffset(BinaryReader reader, NintendoOpticalDiscSystem system)
 {
     switch (system) {
         case NintendoOpticalDiscSystem.Wii: return reader.ReadUInt32() * 4L;
         case NintendoOpticalDiscSystem.GameCube: return reader.ReadUInt32();
         default: throw new NotImplementedException();
     }
 }
コード例 #9
0
        internal static void LoadFileTable(FolderAsset parent, BinaryReader reader, NintendoOpticalDiscSystem system)
        {
            reader.BaseStream.Position = 0x424;
            long fileTableOffset = LoadOffset(reader, system);

            reader.BaseStream.Position = fileTableOffset + 8;
            int count = reader.ReadInt32();
            for (int index = 1; index < count; )
                LoadFile(parent, reader, ref index, system);

            foreach (Asset asset in parent.Children)
                LoadFileName(asset, reader, fileTableOffset + count * 12);
        }
コード例 #10
0
        internal static Asset LoadFile(FolderAsset parent, BinaryReader reader, ref int index, NintendoOpticalDiscSystem system)
        {
            int nameOffset = reader.ReadInt32();
            bool isDirectory = (nameOffset & 0xFF000000) != 0;
            nameOffset &= 0xFFFFFF;

            if (isDirectory)
                return new NintendoOpticalDiscPartitionFolder(parent, ref index, nameOffset, reader, system);
            else
                return new NintendoOpticalDiscPartitionFile(parent, index++, nameOffset, reader, system);
        }