using System;
using System.Collections.Generic;
using System.IO;

namespace QC.QMine.QMineInterface;

[Serializable]
public class FolderItem : FileSystemItem
{
	private bool includeSubFolders;

	private bool canIncludeSubFolders = true;

	public override string ItemName
	{
		get
		{
			char[] separator = new char[2]
			{
				Path.DirectorySeparatorChar,
				Path.AltDirectorySeparatorChar
			};
			string[] array = base.FullPath.Split(separator, StringSplitOptions.RemoveEmptyEntries);
			string text = null;
			if (array.Length > 2)
			{
				return array[array.Length - 2] + "\\" + array[array.Length - 1];
			}
			return base.FullPath;
		}
	}

	public bool IncludeSubFolders
	{
		get
		{
			return includeSubFolders;
		}
		set
		{
			if (includeSubFolders != value)
			{
				includeSubFolders = value;
				OnPropertyChanged("IncludeSubFolders");
			}
		}
	}

	public bool CanIncludeSubFolders
	{
		get
		{
			return canIncludeSubFolders;
		}
		set
		{
			if (canIncludeSubFolders != value)
			{
				canIncludeSubFolders = value;
				OnPropertyChanged("CanIncludeSubFolders");
			}
		}
	}

	public List<string> GetFiles()
	{
		List<string> list = new List<string>();
		foreach (FileInfo file in CommonFunctions.GetFiles(new DirectoryInfo(base.FullPath), IncludeSubFolders))
		{
			list.Add(file.FullName);
		}
		return list;
	}
}
