using ChaosBot.Models; namespace ChaosBot.Services.ProgrammingLanguageInterpreter { public static class ProgrammingLanguageInterpreterFacade { public static bool TryInterpret(CustomCommand customCommand, out string errorReason) { errorReason = ""; IProgrammingLanguageInterpreter interpreter = ProgrammingLanguageInterpreterFactory.GetInterpreter(customCommand.Type); if (interpreter == null) { errorReason = "Could not set up an interpreter for the code"; return false; } interpreter.Interpret(customCommand.Content, customCommand.Command); return true; } } }