added game&mod version to the status file

This commit is contained in:
Szum123321 2022-11-29 22:34:02 +01:00
parent 472aeda184
commit 5f1706eed3
3 changed files with 12 additions and 5 deletions

View File

@ -54,7 +54,13 @@ public class TextileBackup implements ModInitializer {
@Override
public void onInitialize() {
log.info("Starting Textile Backup by Szum123321");
Globals.INSTANCE.setCombinedVersionString(
FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata().getVersion().getFriendlyString() +
":" +
FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion().getFriendlyString()
);
log.info("Starting Textile Backup {} by Szum123321", Globals.INSTANCE.getCombinedVersionString());
ConfigHelper.updateInstance(AutoConfig.register(ConfigPOJO.class, JanksonConfigSerializer::new));

View File

@ -25,7 +25,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp) implements Serializable {
public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, String version) implements Serializable {
public static final String DATA_FILENAME = "textile_status.data";
public boolean isValid(long decompressedHash) {
return decompressedHash == treeHash && brokenFiles.isEmpty();
@ -55,7 +55,7 @@ public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles,
.append(date.format(DateTimeFormatter.ISO_DATE_TIME))
.append(", start time stamp: ").append(startTimestamp)
.append(", finish time stamp: ").append(finishTimestamp)
;//.append(", Mod Version: ").append(modVersion.getFriendlyString());
.append(", Mod Version: ").append(version);
builder.append(", broken files: ");
if(brokenFiles.isEmpty()) builder.append("[]");

View File

@ -18,6 +18,7 @@
package net.szum123321.textile_backup.core.create.compressors;
import net.szum123321.textile_backup.Globals;
import net.szum123321.textile_backup.TextileBackup;
import net.szum123321.textile_backup.TextileLogger;
import net.szum123321.textile_backup.config.ConfigHelper;
@ -100,8 +101,8 @@ public abstract class AbstractCompressor {
CompressionStatus status = new CompressionStatus (
fileHashBuilder.getValue(),
brokenFileHandler.get(),
ctx.startDate(), start.toEpochMilli(), now.toEpochMilli()//,
//TextileBackup.VERSION
ctx.startDate(), start.toEpochMilli(), now.toEpochMilli(),
Globals.INSTANCE.getCombinedVersionString()
);
addEntry(new StatusFileInputSupplier(status.serialize()), arc);