SessionEntry

References
public sealed class SessionEntry : IStorable
Records the state of a single open document at the time a session snapshot was written. One SessionEntry is created per open document and stored within a SessionRecord.

Constructors

SessionEntry

#
public SessionEntry(Guid identity, string autoSavePath, int parentEntryIndex = -1, Guid parentClusterId = default(Guid))
Construct a session entry for an unnamed document. The entry tracks the document by its runtime Document.Identity and points at the autosave file under Folders.UnnamedFilesFolder. Unnamed entries are always treated as modified since there is no on-disk original to fall back to.
identity (Guid)The document's runtime identity.
autoSavePath (string)Full path to the autosave file under UnnamedFilesFolder.
parentEntryIndex (int = -1)Index of the entry whose document contains the cluster being edited. -1 if this is a top-level unnamed document rather than a cluster inner doc.
parentClusterId (Guid = null)InstanceId of the cluster object inside the parent document whose inner-doc edit this entry represents. Empty when parentEntryIndex is -1.

SessionEntry

#
public SessionEntry(IReader reader)
Deserialisation constructor. Tolerates older records that pre-date the Kind field by defaulting to SessionEntryKind.Named.
reader (IReader)

SessionEntry

#
public SessionEntry(string originalPath, bool wasModified, string autoSavePath, DateTime originalLastWriteUtc)
Construct a session entry for a document that has been saved to disk.
originalPath (string)
wasModified (bool)
autoSavePath (string)
originalLastWriteUtc (DateTime)

Properties

AutoSavePath

#
public string AutoSavePath { get; }
Full path to the autosave file written for this document at shutdown. For named entries: only meaningful when WasModified is true. For unnamed entries: always set; restore loads from here.

Identity

#
public Guid Identity { get; }
Runtime identity of the document. Set only when Kind is SessionEntryKind.Unnamed. Used to reattach the same identity to the restored document so that successive autosaves continue to overwrite the same file under Folders.UnnamedFilesFolder.

Kind

#
public SessionEntryKind Kind { get; }
Whether this entry describes a named (on-disk) document or an unnamed one.

OriginalLastWriteUtc

#
public DateTime OriginalLastWriteUtc { get; }
Last-write timestamp (UTC) of the original file at the moment the session was written. Used during restore to detect external edits between sessions. Only meaningful when Kind is SessionEntryKind.Named.

OriginalPath

#
public string OriginalPath { get; }
Full path to the original document on disk. Set only when Kind is SessionEntryKind.Named.

ParentClusterId

#
public Guid ParentClusterId { get; }
InstanceId of the cluster object inside the parent document whose inner-doc edit this entry represents. Empty when ParentEntryIndex is -1. Only meaningful when Kind is SessionEntryKind.Unnamed.

ParentEntryIndex

#
public int ParentEntryIndex { get; }
Index of the entry whose document contains the cluster being edited. -1 when this entry is a top-level document rather than a cluster inner doc. Only meaningful when Kind is SessionEntryKind.Unnamed.

WasModified

#
public bool WasModified { get; }
True if the document had unsaved changes at the moment the session was written. For SessionEntryKind.Unnamed entries this is always true; there is no on-disk original, so any unnamed document being captured must be restored from its autosave file.

Methods

Store

#
public void Store(IWriter writer)
Serialise this entry into the supplied writer.
writer (IWriter)
Store