コード例 #1
0
  @Override
  public void runLiveReplay(URI uri) throws IOException {
    if (!uri.getScheme().equals(FAF_LIFE_PROTOCOL)) {
      throw new IllegalArgumentException("Invalid protocol: " + uri.getScheme());
    }

    Map<String, String> queryParams =
        Splitter.on('&').trimResults().withKeyValueSeparator("=").split(uri.getQuery());

    String mod = queryParams.get("mod");
    String mapName = queryParams.get("map");
    Integer replayId = Integer.parseInt(queryParams.get(uri.getPath().split("/")[0]));

    try {
      URL gpgReplayUrl = new URL(GPGNET_SCHEME, uri.getHost(), uri.getPort(), uri.getPath());
      gameService.runWithReplay(gpgReplayUrl, replayId);
    } catch (MalformedURLException e) {
      throw new RuntimeException();
    }
  }
コード例 #2
0
  private void runFafReplayFile(Path path) throws IOException {
    String fileName = path.getFileName().toString();
    byte[] rawReplayBytes = replayFileReader.readReplayData(path);

    Path tempSupComReplayFile =
        preferencesService.getCacheDirectory().resolve(TEMP_SCFA_REPLAY_FILE_NAME);

    Files.createDirectories(tempSupComReplayFile.getParent());
    Files.copy(
        new ByteArrayInputStream(rawReplayBytes),
        tempSupComReplayFile,
        StandardCopyOption.REPLACE_EXISTING);

    LocalReplayInfo replayInfo = replayFileReader.readReplayInfo(path);
    String featuredMod = replayInfo.featuredMod;
    Integer replayId = replayInfo.uid;
    Map<String, Integer> featuredModVersions = replayInfo.featuredModVersions;

    String version = parseSupComVersion(rawReplayBytes);

    gameService.runWithReplay(tempSupComReplayFile, replayId);
  }
コード例 #3
0
 private void runSupComReplayFile(Path path) throws IOException {
   String fileName = path.getFileName().toString();
   String featuredMod = guessModByFileName(fileName);
   gameService.runWithReplay(path, null);
 }