private static void updateTypes(BinaryReader reader, ref int index, ref SubDir_s actualSubDir) { index++; Array.Resize <byte>(ref actualSubDir.Type2, index + 1); actualSubDir.Type2[index] = reader.ReadByte(); actualSubDir.Type = actualSubDir.Type2[index]; }
private static int loadSubFolders(BinaryReader reader, ref SubDir_s actualSubDir) { int type; Common.Folder_s actualFolder = new Common.Folder_s(); if (actualSubDir.Folders == null) { actualSubDir.Folders = new List <Common.Folder_s>(); } type = actualSubDir.Type - 0x80; actualFolder.Name = new string(Encoding.GetEncoding("shift_jis").GetChars(reader.ReadBytes(type))); actualFolder.ID = reader.ReadUInt16(); actualSubDir.Folders.Add(actualFolder); return(type); }
private static SubDir_s initActualSubDir(BinaryReader reader, int index, MainDir_s actualMainDir, SubDir_s actualSubDir) { Array.Resize <byte>(ref actualSubDir.Type2, index + 1); actualSubDir.Type2[index] = reader.ReadByte(); actualSubDir.Type = actualSubDir.Type2[index]; actualSubDir.Parent_ID = actualMainDir.FFile_ID; return(actualSubDir); }
private static int loadSubFiles(BinaryReader reader, Nds.NdsFat_s FAT, List <Common.FileInfo_s> fileInfoList, ref MainDir_s actualMainDir, ref SubDir_s actualSubDir) { int type; Common.FileInfo_s actualFileInfo = new Common.FileInfo_s(); if (actualSubDir.Files == null) { actualSubDir.Files = new List <Common.FileInfo_s>(); } type = actualSubDir.Type; actualFileInfo.Name = new string(Encoding.GetEncoding("shift_jis").GetChars(reader.ReadBytes(type))); actualFileInfo.ID = actualMainDir.FFile_ID; actualFileInfo.Offset = FAT.getFileStartAt((int)actualFileInfo.ID); actualFileInfo.Size = FAT.getFileEndAt((int)actualFileInfo.ID) - actualFileInfo.Offset; long num5 = reader.BaseStream.Position; reader.BaseStream.Seek((long)actualFileInfo.Offset, SeekOrigin.Begin); actualFileInfo.FileData = new ClosableMemoryStream(); Utils.loadStream(reader, actualFileInfo.Size, actualFileInfo.FileData); reader.BaseStream.Seek((long)actualFileInfo.Offset, SeekOrigin.Begin); FAT.setFileStreamAt((int)actualFileInfo.ID, actualFileInfo.FileData); reader.BaseStream.Seek(num5, SeekOrigin.Begin); actualMainDir.FFile_ID = (ushort)(actualMainDir.FFile_ID + 1); actualSubDir.Files.Add(actualFileInfo); fileInfoList.Add(actualFileInfo); return(type); }
private static void loadSubElements(BinaryReader reader, Nds.NdsFat_s FAT, ref int index, List <Common.FileInfo_s> fileInfoList, ref MainDir_s actualMainDir, ref SubDir_s actualSubDir) { int type; if (actualSubDir.Type < 0x80) { type = loadSubFiles(reader, FAT, fileInfoList, ref actualMainDir, ref actualSubDir); } if (actualSubDir.Type > 0x80) { type = loadSubFolders(reader, ref actualSubDir); } updateTypes(reader, ref index, ref actualSubDir); }