[Ready for Testing] Folder-Syncing
This commit is contained in:
parent
9cd0ef1f04
commit
0b9d6093a0
11 changed files with 1034 additions and 608 deletions
|
@ -3,7 +3,7 @@ package ru.bclib.config;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.dataexchange.DataExchangeAPI;
|
||||
import ru.bclib.api.dataexchange.FileHash;
|
||||
import ru.bclib.api.dataexchange.SyncFileHash;
|
||||
import ru.bclib.api.dataexchange.handler.AutoSyncID;
|
||||
import ru.bclib.api.dataexchange.handler.FileContentWrapper;
|
||||
import ru.bclib.config.ConfigKeeper.BooleanEntry;
|
||||
|
@ -50,7 +50,7 @@ public abstract class Config {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean compareForSync(FileHash fileHash, FileHash fileHash1, FileContentWrapper content) {
|
||||
private boolean compareForSync(SyncFileHash syncFileHash, SyncFileHash syncFileHash1, FileContentWrapper content) {
|
||||
return keeper.compareAndUpdateForSync(content);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public final class ConfigKeeper {
|
|||
changed = true;
|
||||
me.add(myKey.first + myKey.second, otherValue);
|
||||
}
|
||||
else if (otherValue.isJsonPrimitive()) {
|
||||
else if (otherValue.isJsonPrimitive() || otherValue.isJsonArray() || otherValue.isJsonNull()) {
|
||||
if (!otherValue.equals(myValue)) {
|
||||
changed = true;
|
||||
me.add(myKey.first + myKey.second, otherValue);
|
||||
|
@ -93,17 +93,13 @@ public final class ConfigKeeper {
|
|||
else if (otherValue.isJsonObject()) {
|
||||
changed |= compareAndUpdateForSync(myValue.getAsJsonObject(), otherValue.getAsJsonObject());
|
||||
}
|
||||
else if (otherValue.isJsonArray()) {
|
||||
if (!otherValue.equals(myValue)) {
|
||||
changed = true;
|
||||
me.add(myKey.first + myKey.second, otherValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else { //no entry, just copy the value from other
|
||||
changed = true;
|
||||
me.add(otherKey.first + otherKey.second, otherValue);
|
||||
if (!otherValue.isJsonNull()) {
|
||||
changed = true;
|
||||
temp = find(me, otherKey);
|
||||
me.add(otherKey.first + otherKey.second, otherValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue