using System.Reflection;
using SlatedGameToolkit.Framework;
using SlatedGameToolkit.Tools.CommandSystem;
using SlatedGameToolkit.Tools.CommandSystem.Interaction;

namespace SlatedGameToolkit.Tools.Commands
{
    public class ListEmbeddedResourcesCommand : IInvocable
    {
        private string[] invokers = new string[] {"GetEmbedded"};
        public void Dispose()
        {
        }

        public bool Execute(IInteractable interactable, string[] args)
        {
            Assembly assembly = Assembly.GetAssembly(typeof(GameEngine));
            string[] embeddedFiles = assembly.GetManifestResourceNames();
            interactable.Tell("Loaded embedded files:");
            foreach (string fileName in embeddedFiles)
            {
                interactable.Tell(fileName);
            }
            return true;
        }

        public string getDescription()
        {
            return "Returns a list of embedded resources in the given assembly.";
        }

        public string[] GetInvokers()
        {
            return invokers;
        }

        public string getUsage(string arg)
        {
            return "Usage: \"GetEmbedded\" to retrieve a list of embedded files in the framework and tools.";
        }
    }
}