/// <summary> /// Builds a path to the input data. /// </summary> /// <param name="data">Data to build a path for.</param> /// <param name="top">Highest directory in the stack to build the path to.</param> public static string BuildPath(this IArchiveData data, IArchiveData top = null) { var names = new Stack <string>(4); var current = data; while (current.Parent != top) { names.Push(current.Name); current = current.Parent; } string path = string.Join("/", names); return(data.IsFile() ? path : $"{path}/"); }
public ArchiveController(IMonafasaData monafasaData, IArchiveData archiveData) { this.monafasaData = monafasaData; this.archiveData = archiveData; }
/// <summary> /// Verifies whether or not the input data is a directory. /// </summary> /// <param name="data">Data to verify.</param> public static bool IsDirectory(this IArchiveData data) => data is IArchiveDirectory;
/// <summary> /// Verifies whether or not the input data is a file. /// </summary> /// <param name="data">Data to verify.</param> public static bool IsFile(this IArchiveData data) => data is IArchiveFile;