hellbound/Assets/Scripts/Game/Save/SaveDiagnostics.cs

40 lines
1.2 KiB
C#

using System.IO;
using System.Text;
using UnityEngine;
public partial class GameData
{
public struct SaveDiagnostics
{
public string LastSaveFile;
public string LastSaveDeviceID;
public string LastSaveAppVersion;
public string SaveDir;
public string SaveFile;
public bool IsDirWritable;
public PersistError PersistError;
public bool IsOk()
{
if (LastSaveFile != string.Empty && PersistError != 0)
return false;
return IsDirWritable;
}
public override string ToString()
{
var builder = new StringBuilder();
builder.Append($"last version: {LastSaveAppVersion}, ");
builder.Append($"file: {SaveFile}, ");
builder.Append($"exists: {File.Exists(SaveFile)}, ");
builder.Append($"dir writable: {IsDirWritable}, ");
builder.Append($"last file: {LastSaveFile}, ");
builder.Append($"persist.error: {PersistError}, ");
builder.Append($"device ids: {LastSaveDeviceID} vs {SystemInfo.deviceUniqueIdentifier}.");
return builder.ToString();
}
}
}