Table of Contents

Class UpgradeBackup

Namespace
Stride.Core.Assets
Assembly
Stride.Core.Assets.dll

Copy-on-write snapshot of the files an in-place upgrade is about to overwrite. Armed by BackupBeforeUpgrade and called from each upgrade write point right before it overwrites a file. The timestamped backup folder is created lazily on the first real snapshot (so nothing is written when an upgrade modifies no files), and each original is copied at most once (a file may be touched by several upgraders).

public sealed class UpgradeBackup
Inheritance
object
UpgradeBackup
Extension Methods

Constructors

UpgradeBackup(string, DateTime, ILogger?)

public UpgradeBackup(string rootDirectory, DateTime timestamp, ILogger? log = null)

Parameters

rootDirectory string

The folder the backup mirrors — each file is stored under it preserving its path relative to this root. Usually the solution directory (the project directory for a standalone upgrade).

timestamp DateTime

The upgrade start time, used to name the backup folder.

log ILogger

Logger that receives a single notice when the backup folder is first created.

Methods

Snapshot(string)

Copies originalFullPath into the backup folder (preserving its path relative to the backup root) the first time it is seen. No-op if the file doesn't exist, lies outside the root, or sits under bin/, obj/, or the backup folder. Safe to call repeatedly for the same file.

public void Snapshot(string originalFullPath)

Parameters

originalFullPath string