コード例 #1
0
ファイル: BSA.java プロジェクト: kellen/skyproc-library
 BSA(String filePath, boolean load) throws FileNotFoundException, IOException, BadParameter {
   this.filePath = filePath;
   in.openFile(filePath);
   if (!in.extractString(0, 3).equals("BSA") || in.extractInt(1, 4) != 104) {
     throw new BadParameter("Was not a BSA file of version 104: " + filePath);
   }
   offset = in.extractInt(0, 4);
   archiveFlags = new LFlags(in.extract(0, 4));
   folderCount = in.extractInt(0, 4);
   folders = new HashMap<>(folderCount);
   fileCount = in.extractInt(0, 4);
   folderNameLength = in.extractInt(0, 4);
   fileNameLength = in.extractInt(0, 4);
   fileFlags = new LFlags(in.extract(0, 4));
   if (SPGlobal.debugBSAimport && SPGlobal.logging()) {
     SPGlobal.logSpecial(LogTypes.BSA, header, "|==================>");
     SPGlobal.logSpecial(LogTypes.BSA, header, "| Imported " + filePath);
     SPGlobal.logSpecial(
         LogTypes.BSA, header, "| Offset " + offset + ", archiveFlags: " + archiveFlags);
     SPGlobal.logSpecial(
         LogTypes.BSA,
         header,
         "| hasDirectoryNames: "
             + archiveFlags.get(0)
             + ", hasFileNames: "
             + archiveFlags.get(1)
             + ", compressed: "
             + archiveFlags.get(2));
     SPGlobal.logSpecial(
         LogTypes.BSA,
         header,
         "| FolderCount: "
             + Ln.prettyPrintHex(folderCount)
             + ", FileCount: "
             + Ln.prettyPrintHex(fileCount));
     SPGlobal.logSpecial(
         LogTypes.BSA,
         header,
         "| totalFolderNameLength: "
             + Ln.prettyPrintHex(folderNameLength)
             + ", totalFileNameLength: "
             + Ln.prettyPrintHex(fileNameLength));
     SPGlobal.logSpecial(LogTypes.BSA, header, "| fileFlags: " + fileFlags.toString());
     SPGlobal.logSpecial(LogTypes.BSA, header, "|==================>");
   }
   if (load) {
     loadFolders();
   }
 }