// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.Text;
namespace Gauntlet
{
///
/// Keeps a folder and file structure of generated content starting from the given path and
/// is used for comparison using
///
public class ContentFolder
{
public string Name { get; }
public IList SubFolders { get; set; }
public IList Files { get; set; }
public ContentFolder(string InName)
{
Name = InName;
SubFolders = new List();
Files = new List();
}
///
/// The recursive method visualizes a folder/file tree as a string using indentation
///
///
public override string ToString()
{
var Sb = new StringBuilder();
BuildFolderString(Sb, 0);
return Sb.ToString();
}
private void BuildFolderString(StringBuilder Sb, int IndentLevel)
{
Sb.AppendLine($"{new string(' ', IndentLevel * 2)}{Name}");
foreach (string File in Files)
{
Sb.AppendLine($"{new string(' ', (IndentLevel + 1) * 2)}- {File}");
}
foreach (ContentFolder SubFolder in SubFolders)
{
SubFolder.BuildFolderString(Sb, IndentLevel + 1);
}
}
}
}