using System; using System.Collections.Generic; using System.IO; using UnityEngine; namespace Amanotes { [Serializable] internal class DevModeSnapshot { private static readonly string dir = Path.Combine("Library", "AmaDev"); private static readonly string filePath = Path.Combine(dir, "dev-mode-snapshot.json"); public List devPackages = new List(); internal static DevModeSnapshot Load() { if (!File.Exists(filePath)) return new DevModeSnapshot(); var json = File.ReadAllText(filePath); if (string.IsNullOrEmpty(json)) return new DevModeSnapshot(); var s = JsonUtility.FromJson(json); return s ?? new DevModeSnapshot(); } internal void Save() { if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); File.WriteAllText(filePath, JsonUtility.ToJson(this, true)); } } }