客户端rsa,冗余清理,bug修复,安卓build问题
This commit is contained in:
@@ -11,6 +11,7 @@ public static class EquipmentConsumableLedgerStorage
|
||||
private const string MainFileName = ".eqc.dat";
|
||||
private const string BackupFileName = ".eqc.bak";
|
||||
private const string TempFileName = ".eqc.tmp";
|
||||
private const string RecoverySlotKey = "equipment_consumable_ledger_storage";
|
||||
|
||||
private static string VaultDirectoryPath => Path.Combine(SaveIdentityUtility.GetCanonicalPersistentRoot(), VaultDirectoryName);
|
||||
private static string MainFilePath => Path.Combine(VaultDirectoryPath, MainFileName);
|
||||
@@ -38,9 +39,22 @@ public static class EquipmentConsumableLedgerStorage
|
||||
return true;
|
||||
}
|
||||
|
||||
if (LocalRecoveryMirror.TryLoadJson(RecoverySlotKey, out payload) && payload != null)
|
||||
{
|
||||
TrySave(payload);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool HasAnyRecoverableState()
|
||||
{
|
||||
return HasAnyVaultFile(MainFileName)
|
||||
|| HasAnyVaultFile(BackupFileName)
|
||||
|| LocalRecoveryMirror.HasSlotData(RecoverySlotKey);
|
||||
}
|
||||
|
||||
public static bool TrySave(EquipmentConsumableLedgerPayload payload)
|
||||
{
|
||||
try
|
||||
@@ -62,6 +76,7 @@ public static class EquipmentConsumableLedgerStorage
|
||||
TryHidePath(MainFilePath);
|
||||
File.Delete(TempFilePath);
|
||||
PlayerProgressBackupService.SaveEquipmentConsumable(payload);
|
||||
LocalRecoveryMirror.SaveJson(RecoverySlotKey, payload);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -81,6 +96,20 @@ public static class EquipmentConsumableLedgerStorage
|
||||
};
|
||||
}
|
||||
|
||||
private static bool HasAnyVaultFile(string fileName)
|
||||
{
|
||||
var candidates = SaveIdentityUtility.GetVaultFilePathVariants(fileName);
|
||||
for (int i = 0; i < candidates.Count; i++)
|
||||
{
|
||||
if (File.Exists(candidates[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool TryReadPayload(string path, out EquipmentConsumableLedgerPayload payload)
|
||||
{
|
||||
payload = CreateDefaultPayload();
|
||||
|
||||
Reference in New Issue
Block a user