Ejemplo n.º 1
0
 public void computeBranding() {
   if (brandings == null) {
     Builder brd = ImmutableList.<String>builder();
     brd.add(Loader.instance().getMCVersionString());
     brd.add(Loader.instance().getMCPVersionString());
     brd.add("FML v" + Loader.instance().getFMLVersionString());
     String forgeBranding = (String) callForgeMethod("getBrandingVersion");
     if (!Strings.isNullOrEmpty(forgeBranding)) {
       brd.add(forgeBranding);
     }
     if (sidedDelegate != null) {
       brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
     }
     try {
       Properties props = new Properties();
       props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));
       brd.add(props.getProperty("fmlbranding"));
     } catch (Exception ex) {
       // Ignore - no branding file found
     }
     int tModCount = Loader.instance().getModList().size();
     int aModCount = Loader.instance().getActiveModList().size();
     brd.add(
         String.format(
             "%d mod%s loaded, %d mod%s active",
             tModCount, tModCount != 1 ? "s" : "", aModCount, aModCount != 1 ? "s" : ""));
     brandings = brd.build();
   }
 }
Ejemplo n.º 2
0
  public JavaToolchainData(
      String sourceVersion,
      String targetVersion,
      String encoding,
      List<String> xlint,
      List<String> misc,
      List<String> jvmOpts) {

    this.sourceVersion = sourceVersion;
    this.targetVersion = targetVersion;
    this.encoding = encoding;

    this.jvmOpts = ImmutableList.copyOf(jvmOpts);
    Builder<String> builder = ImmutableList.<String>builder();
    if (!sourceVersion.isEmpty()) {
      builder.add("-source", sourceVersion);
    }
    if (!targetVersion.isEmpty()) {
      builder.add("-target", targetVersion);
    }
    if (!encoding.isEmpty()) {
      builder.add("-encoding", encoding);
    }
    if (!xlint.isEmpty()) {
      builder.add("-Xlint:" + Joiner.on(",").join(xlint));
    }
    this.options = builder.addAll(misc).build();
  }
Ejemplo n.º 3
0
  static byte[] encode(RSAPrivateCrtKey key) {
    List<BigInteger> seq =
        ImmutableList.<BigInteger>builder()
            .add(BigInteger.valueOf(0)) // version
            .add(key.getModulus())
            .add(key.getPublicExponent())
            .add(key.getPrivateExponent())
            .add(key.getPrimeP())
            .add(key.getPrimeQ())
            .add(key.getPrimeExponentP())
            .add(key.getPrimeExponentQ())
            .add(key.getCrtCoefficient())
            .build();
    int length = 0;
    for (BigInteger part : seq) {
      byte[] bytes = part.toByteArray();
      length += 1 + calculateBodyLength(bytes.length) + bytes.length;
    }

    Builder<Byte> output = ImmutableList.<Byte>builder();
    output.add((byte) (SEQUENCE | CONSTRUCTED));
    writeLength(output, length);
    for (BigInteger part : seq) {
      byte[] bytes = part.toByteArray();
      output.add((byte) TAG);
      writeLength(output, bytes.length);
      output.addAll(Bytes.asList(bytes));
    }
    return Bytes.toArray(output.build());
  }