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

#
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.
public SessionEntry(
identity,
The document's runtime identity.
autoSavePath,
Full path to the autosave file under UnnamedFilesFolder.
parentEntryIndex = -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 = default(Guid)
InstanceId of the cluster object inside the parent document whose inner-doc edit this entry represents. Empty when parentEntryIndex is -1.
)

SessionEntry

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

SessionEntry

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

Properties

AutoSavePath

#
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.
public string AutoSavePath { get; }

Identity

#
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.
public Guid Identity { get; }

Kind

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

OriginalLastWriteUtc

#
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.
public DateTime OriginalLastWriteUtc { get; }

OriginalPath

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

ParentClusterId

#
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.
public Guid ParentClusterId { get; }

ParentEntryIndex

#
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.
public int ParentEntryIndex { get; }

WasModified

#
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.
public bool WasModified { get; }

Methods

Store

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