mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Reformat to use Fabric API's checkstyle (#137)
* Reformat to use Fabric API's checkstyle * Fix * Fix * Update * Travis and fixes * possible fix for checkstyle? * Helps if i push the checkstyle.xml file... * Log checkstyle issues to console - used by travis * Fix some more issues * opps
This commit is contained in:
@@ -24,15 +24,15 @@
|
||||
|
||||
package net.fabricmc.loom.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.Files;
|
||||
import org.gradle.api.logging.Logger;
|
||||
import org.gradle.api.logging.Logging;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Checksum {
|
||||
private static final Logger log = Logging.getLogger(Checksum.class);
|
||||
|
||||
@@ -40,18 +40,22 @@ public class Checksum {
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
//noinspection deprecation
|
||||
HashCode hash = Files.asByteSource(file).hash(Hashing.sha1());
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (Byte hashBytes : hash.asBytes()) {
|
||||
builder.append(Integer.toString((hashBytes & 0xFF) + 0x100, 16).substring(1));
|
||||
}
|
||||
|
||||
log.debug("Checksum check: '" + builder.toString() + "' == '" + checksum + "'?");
|
||||
return builder.toString().equals(checksum);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user