< Summary

Information
Class: Chronicler.DefaultSaver
Assembly: Chronicler
File(s): /home/runner/work/Chronicler/Chronicler/src/Chronicler/Recording/DefaultSaver.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 63
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Save()100%11100%
OnSave()100%11100%
EarlyApply()100%11100%
OnEarlyApply()100%11100%
Apply()100%11100%
OnApply()100%11100%
LateApply()100%11100%
OnLateApply()100%11100%

File(s)

/home/runner/work/Chronicler/Chronicler/src/Chronicler/Recording/DefaultSaver.cs

#LineLine coverage
 1//=======================================================================
 2// DefaultSaver.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8namespace Chronicler;
 9
 10/// <summary>
 11/// Provides a reusable save/apply lifecycle base for explicit state transfer helpers.
 12/// </summary>
 13/// <remarks>
 14/// Host integrations can use these hooks to transfer settings and configuration
 15/// between a library and an editor or game engine. The host owns when each phase
 16/// runs; this base class has no engine dependency.
 17/// </remarks>
 18public abstract class DefaultSaver
 19{
 20    /// <summary>Capture the state to transfer.</summary>
 21    /// <remarks>Calls <see cref="OnSave"/> synchronously. The host decides when to run the phase.</remarks>
 22    public void Save()
 23    {
 224        OnSave();
 225    }
 26
 27    /// <summary>Capture the state to transfer.</summary>
 28    /// <remarks>Override to implement <see cref="Save"/> for the host. The default hook has no effect.</remarks>
 129    protected virtual void OnSave() { }
 30
 31    /// <summary>Prepare the destination for applying state.</summary>
 32    /// <remarks>Calls <see cref="OnEarlyApply"/> synchronously. The host decides when to run the phase.</remarks>
 33    public void EarlyApply()
 34    {
 235        OnEarlyApply();
 236    }
 37
 38    /// <summary>Prepare the destination for applying state.</summary>
 39    /// <remarks>Override to implement <see cref="EarlyApply"/> for the host. The default hook has no effect.</remarks>
 140    protected virtual void OnEarlyApply() { }
 41
 42    /// <summary>Apply the transferred state.</summary>
 43    /// <remarks>Calls <see cref="OnApply"/> synchronously. The host decides when to run the phase.</remarks>
 44    public void Apply()
 45    {
 246        OnApply();
 247    }
 48
 49    /// <summary>Apply the transferred state.</summary>
 50    /// <remarks>Override to implement <see cref="Apply"/> for the host. The default hook has no effect.</remarks>
 151    protected virtual void OnApply() { }
 52
 53    /// <summary>Finish applying state and reconnect dependent host state.</summary>
 54    /// <remarks>Calls <see cref="OnLateApply"/> synchronously. The host decides when to run the phase.</remarks>
 55    public void LateApply()
 56    {
 257        OnLateApply();
 258    }
 59
 60    /// <summary>Finish applying state and reconnect dependent host state.</summary>
 61    /// <remarks>Override to implement <see cref="LateApply"/> for the host. The default hook has no effect.</remarks>
 162    protected virtual void OnLateApply() { }
 63}