diff --git a/ChaosBot/Models/CustomCommand.cs b/ChaosBot/Models/CustomCommand.cs index d6fa2bb..3bc0e94 100644 --- a/ChaosBot/Models/CustomCommand.cs +++ b/ChaosBot/Models/CustomCommand.cs @@ -22,6 +22,7 @@ namespace ChaosBot.Models public enum CustomCommandType { - Basic + Basic = 0, + CustomLua = 1 } -} \ No newline at end of file +} diff --git a/ChaosBot/Services/ProgrammingLanguageInterpreter/IProgrammingLanguageInterpreter.cs b/ChaosBot/Services/ProgrammingLanguageInterpreter/IProgrammingLanguageInterpreter.cs new file mode 100644 index 0000000..10372de --- /dev/null +++ b/ChaosBot/Services/ProgrammingLanguageInterpreter/IProgrammingLanguageInterpreter.cs @@ -0,0 +1,7 @@ +namespace ChaosBot.Services.ProgrammingLanguageInterpreter +{ + public interface IProgrammingLanguageInterpreter + { + void Interpret(string content); + } +} diff --git a/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs b/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs new file mode 100644 index 0000000..9ea1aba --- /dev/null +++ b/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs @@ -0,0 +1,15 @@ +using System; +using NLog; + +namespace ChaosBot.Services.ProgrammingLanguageInterpreter +{ + internal class LuaProgrammingLanguageInterpreter : IProgrammingLanguageInterpreter + { + private static readonly ILogger Logger = Program.GetLogger(); + + public void Interpret(string content) + { + throw new NotImplementedException(); + } + } +} diff --git a/ChaosBot/Services/ProgrammingLanguageInterpreter/ProgrammingLanguageInterpreterFacade.cs b/ChaosBot/Services/ProgrammingLanguageInterpreter/ProgrammingLanguageInterpreterFacade.cs new file mode 100644 index 0000000..dd88949 --- /dev/null +++ b/ChaosBot/Services/ProgrammingLanguageInterpreter/ProgrammingLanguageInterpreterFacade.cs @@ -0,0 +1,15 @@ +using ChaosBot.Models; + +namespace ChaosBot.Services.ProgrammingLanguageInterpreter +{ + public static class ProgrammingLanguageInterpreterFacade + { + public static void Interpret(CustomCommand customCommand) + { + IProgrammingLanguageInterpreter interpreter = + ProgrammingLanguageInterpreterFactory.GetInterpreter(customCommand.Type); + + interpreter.Interpret(customCommand.Content); + } + } +} diff --git a/ChaosBot/Services/ProgrammingLanguageInterpreter/ProgrammingLanguageInterpreterFactory.cs b/ChaosBot/Services/ProgrammingLanguageInterpreter/ProgrammingLanguageInterpreterFactory.cs new file mode 100644 index 0000000..de2b345 --- /dev/null +++ b/ChaosBot/Services/ProgrammingLanguageInterpreter/ProgrammingLanguageInterpreterFactory.cs @@ -0,0 +1,18 @@ +using ChaosBot.Models; + +namespace ChaosBot.Services.ProgrammingLanguageInterpreter +{ + internal static class ProgrammingLanguageInterpreterFactory + { + public static IProgrammingLanguageInterpreter GetInterpreter(CustomCommandType type) + { + switch (type) + { + case CustomCommandType.CustomLua: + return new LuaProgrammingLanguageInterpreter(); + default: + return new LuaProgrammingLanguageInterpreter(); + } + } + } +}