using System.Collections.Generic;
using System.IO;
namespace MangaUtils
{
///
/// Class, which describes folder with its subfolders.
///
public class Folder
{
///
/// Absolute path to current folder
///
public string Path;
///
/// List of subfolders (if any).
///
public List Subfolders;
///
/// Default constructor - nothing special, just initializing.
///
public Folder()
{
Path = string.Empty;
Subfolders = new List();
}
///
/// Constructor which scans recursively given folder.
///
/// Absolutte path to folder.
public Folder(string path)
{
Path = path;
Subfolders = new List();
var dirs = new List(Directory.GetDirectories(path));
foreach (var dir in dirs)
{
var folder = new Folder(dir);
Subfolders.Add(folder);
}
}
///
/// Overriden method, which returns name of current folder.
///
/// Name of current folder.
public override string ToString()
{
int lastSlashPos = Path.LastIndexOf('\\');
var str = Path.Substring(lastSlashPos + 1);
return str;
}
}
}