package com.xiaoboluo.d2r.widget; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; import java.util.Comparator; /** 仅生成合成存档,绝不访问玩家目录。 | Generates synthetic saves only; never reads a player's directory. */ public final class SaveSummaryReaderTest { private static int checks; private static void check(boolean value,String label) { ++checks; if (!value) throw new AssertionError(label); } private static void sign(byte[] bytes) { ByteBuffer data=ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); data.putInt(8,bytes.length); data.putInt(12,0); int sum=0; for (byte b:bytes) sum=Integer.rotateLeft(sum,1)+Byte.toUnsignedInt(b); data.putInt(12,sum); } private static int bits(byte[] bytes,int offset,int width,long value) { for (int i=0;i paths=Files.walk(temp)) { for (Path path:(Iterable)paths.sorted(Comparator.reverseOrder())::iterator) Files.delete(path); } } System.out.println("SaveSummaryReader OK ("+checks+" synthetic checks; no player data)"); } }