예제 #1
0
  private void outputVolumeIndex(
      String tagName,
      String titleName,
      String titleIntroduction,
      List<String> volumeTitleList,
      List<String> snsSysIDList) {
    String outputDirectory = getBaseOutputDirectory();
    String text = "";
    int count = volumeTitleList.size();
    text += "TITLE_NAME = '" + getOutputText(titleName) + "';\n";
    text += "TITLE_INTRODUCTION = '" + getOutputText(titleIntroduction) + "';\n";
    text += "VOLUME_LIST = new Array( ";
    for (int i = 0; i < count; i++) {
      if (i > 0) text += ", ";
      text +=
          "'"
              + getOutputText(volumeTitleList.get(i))
              + "', "
              + "'"
              + getVolumeID(snsSysIDList.get(i))
              + "'";
    }
    text += "\n);\n";

    Common.outputFile(text, outputDirectory, tagName + ".js");
  }
예제 #2
0
  private void outputListFile(
      List<List<String>> combinationList, String variableName, String filePath, String fileName) {
    String text = variableName + " = new Array( ";
    String temp = "";
    int count = combinationList.get(0).size();
    for (int i = 0; i < count; i++) {
      if (i > 0) text += ", ";

      for (int j = 0; j < combinationList.size(); j++) {
        temp = combinationList.get(j).get(i);
        text += "'" + getOutputText(temp) + "'";

        if (j < combinationList.size() - 1) text += ", ";
      }
    }
    text += "\n);";

    Common.outputFile(text, filePath, fileName);
    print("已經寫出列表 : " + fileName);
  }
예제 #3
0
  private void outputVolumeComment(
      String tagName,
      String volumeTitle,
      String fileName,
      String siteName,
      List<String> commentList) {
    String text = "";
    text += "VOLUME_TITLE = '" + volumeTitle + "';\n";
    text += siteName + " = new Array( \n";

    for (int i = 0; i < commentList.size(); i++) {
      if (i > 0) {
        text += ", ";
      }
      text += "'" + commentList.get(i) + "'";
    }
    text += "\n);";

    String outputDirectory = getBaseOutputDirectory() + tagName + Common.getSlash();
    Common.outputFile(text, outputDirectory, fileName + ".js");
  }
예제 #4
0
  private void updateIndexFile(
      String tagName,
      String titleName,
      String titleIntroduction,
      String volumeTitle,
      String snsSysID) {
    String text = Common.getFileString(getBaseOutputDirectory(), tagName + ".js");

    int midIndex1 = text.indexOf("new Array(") + 11;
    int endIndex = text.length();

    if (midIndex1 < 11) {
      print("第 1 筆索引資料");
      // 新建index file
      List<String> volumeTitleList = new ArrayList<String>();
      List<String> snsSysIDList = new ArrayList<String>();
      volumeTitleList.add(volumeTitle);
      snsSysIDList.add(snsSysID);
      outputVolumeIndex(tagName, titleName, titleIntroduction, volumeTitleList, snsSysIDList);
      return;
    }

    print("第 n 筆索引資料");

    text =
        text.substring(0, midIndex1)
            + "'"
            + getOutputText(volumeTitle)
            + "', "
            + "'"
            + getVolumeID(snsSysID)
            + "', "
            + text.substring(midIndex1, endIndex);

    Common.outputFile(text, getBaseOutputDirectory(), tagName + ".js");
  }
예제 #5
0
 @Override
 public void outputVolumeAndUrlList(List<String> volumeList, List<String> urlList) {
   Common.outputFile(volumeList, SetUp.getTempDirectory(), Common.tempVolumeFileName);
   Common.outputFile(urlList, SetUp.getTempDirectory(), Common.tempUrlFileName);
 }