Add a custom key for if someone makes a mod of the game it won't clash with the main savefile

This commit is contained in:
2025-08-20 13:25:18 -07:00
parent b9becd25a1
commit e38a37801b
2 changed files with 3 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ public class BazookaManager : MonoBehaviour
public void Load() public void Load()
{ {
string path = Path.Join(Application.persistentDataPath, "BazookaManager.dat"); string path = Path.Join(Application.persistentDataPath, SensitiveInfo.BAZOOKA_MANAGER_FILE_KEY + ".dat");
if (!File.Exists(path)) if (!File.Exists(path))
{ {
File.Create(path).Dispose(); File.Create(path).Dispose();
@@ -68,7 +68,7 @@ public class BazookaManager : MonoBehaviour
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
string path = Path.Join(Application.persistentDataPath, "BazookaManager.dat"); string path = Path.Join(Application.persistentDataPath, SensitiveInfo.BAZOOKA_MANAGER_FILE_KEY + "BazookaManager.dat");
var encoded = SensitiveInfo.EncryptRaw(saveFile.ToString(Formatting.None), SensitiveInfo.BAZOOKA_MANAGER_KEY); var encoded = SensitiveInfo.EncryptRaw(saveFile.ToString(Formatting.None), SensitiveInfo.BAZOOKA_MANAGER_KEY);
if (encoded == null) return; if (encoded == null) return;
using var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None); using var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);

View File

@@ -10,6 +10,7 @@ public class SensitiveInfo
public static readonly string SERVER_RECEIVE_TRANSFER_KEY = ""; public static readonly string SERVER_RECEIVE_TRANSFER_KEY = "";
public static readonly string SERVER_SEND_TRANSFER_KEY = ""; public static readonly string SERVER_SEND_TRANSFER_KEY = "";
public static readonly string BAZOOKA_MANAGER_KEY = ""; public static readonly string BAZOOKA_MANAGER_KEY = "";
public static readonly string BAZOOKA_MANAGER_FILE_KEY = "9b9ad7a5a824436144083c19dd071d66";
public static string Encrypt(string plainText, string key) public static string Encrypt(string plainText, string key)
{ {