Esempio n. 1
0
        /// <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}/");
        }
Esempio n. 2
0
 public ArchiveController(IMonafasaData monafasaData, IArchiveData archiveData)
 {
     this.monafasaData = monafasaData;
     this.archiveData  = archiveData;
 }
Esempio n. 3
0
 /// <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;
Esempio n. 4
0
 /// <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;