using System; namespace Umbraco.Core.IO { // shadow filesystems is definitively ... too convoluted internal class ShadowFileSystems : ICompletable { private readonly FileSystems _fileSystems; private bool _completed; // invoked by the filesystems when shadowing public ShadowFileSystems(FileSystems fileSystems, Guid id) { _fileSystems = fileSystems; Id = id; _fileSystems.BeginShadow(id); } // for tests public Guid Id { get; } // invoked by the scope when exiting, if completed public void Complete() { _completed = true; } // invoked by the scope when exiting public void Dispose() { _fileSystems.EndShadow(Id, _completed); } } }