Skip to content

Allow SpfState to Persist Between Sessions #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Aha43 opened this issue Mar 3, 2025 · 0 comments
Open

Allow SpfState to Persist Between Sessions #8

Aha43 opened this issue Mar 3, 2025 · 0 comments

Comments

@Aha43
Copy link
Owner

Aha43 commented Mar 3, 2025

Right now, SpfState is in-memory only. It would be useful to persist state between program runs.

🔹 Improvement Suggestion:

  • Implement a file-based state store (e.g., JSON or SQLite).
  • Add a method like SaveState() in SpfState.

Modify SpfState:

public void SaveState()
{
    File.WriteAllText("spf_state.json", JsonSerializer.Serialize(_state));
}

public void LoadState()
{
    if (File.Exists("spf_state.json"))
        _state = JsonSerializer.Deserialize<Dictionary<string, object>>(File.ReadAllText("spf_state.json"));
}

✅ Advantage: This allows session persistence, making SPF more powerful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant