private static PlugResponse Humeur(PlugCall call)
 {
     PlugResponse response = new PlugResponse();
     response.WaitForChainedAction = false;
     response.Response = "Je vais bien, merci";
     return response;
 }
 private static PlugResponse StandBy(PlugCall call)
 {
     GlobalManager.STANDBY = true;
     PlugResponse response = new PlugResponse();
     response.WaitForChainedAction = false;
     response.Response = "Mode espion activé";
     return response;
 }
 public ImapProvider(string Host, string login, string pass, Int32 Port)
 {
     HOST = Host;
     LOGIN = login;
     PWD = pass;
     PORT = Port;
     RESPONSE = new PlugResponse();
 }
 private static PlugResponse Hello(PlugCall call)
 {
     PlugResponse response = new PlugResponse();
     response.WaitForChainedAction = true;
     response.ChainedQuestion = "Comment ça va ?";
     response.Response = "Bonjour !";
     response.NextChainedAction = "HUMEUR";
     return response;
 }
 private static PlugResponse ContextChange(PlugCall call)
 {
     PlugResponse response = new PlugResponse();
     response.Response = "Quel contexte voulez vous charger ?";
     response.WaitForChainedAction = true;
     response.NextChainedAction = "LOAD CONTEXT";
     GlobalManager.LastResponse = response;
     return response;
 }
        public static PlugResponse FireAction(string ActionName, string sentence)
        {
            PlugResponse response = new PlugResponse();
            PlugCall call = new PlugCall();
            call.ACTION = ActionName;
            call.Text = sentence;

            SENTENCES tmp = CONTEXT.SENTENCESLIST.Where(t => t.CMD.CMD.Equals(ActionName)).Where(t=>t.SENTENCE.Equals(sentence)).Single();
            // Todo: recherche une correspondance dans la BDD
            if (tmp == null)
            {
                return new PlugResponse();
            }

            else
            {

                // Chargement de la DLL concernée
                SENTENCES cmd = GlobalManager.CONTEXT.SENTENCESLIST.Where(t => t.CMD.CMD.Equals(ActionName) && t.SENTENCE.Equals(sentence)).Single();
                if (cmd.CMD.MODULE.NAME.Equals("SYSTEM"))
                {
                    response = SYSMODULE.DoAction(call);
                    LastResponse = response;
                    return response;
                }
                else
                {
                    /* TEST */
                    // Chargement de la DLL
                    string DLLPATH = cmd.CMD.MODULE.DLL;
                    List<Assembly> assemblies = new List<Assembly>();
                    Assembly DLL = Assembly.LoadFrom(@"C:\Users\adasilva\Documents\Visual Studio 2015\Projects\MATHIAS\Mathias\bin\Debug\plugins\EmailPlug.dll");

                    // Récupération de l'objet à utiliser
                    var typeFromPlug = DLL.GetType(cmd.CMD.FULLTYPEOBJECT);
                    var plug = Activator.CreateInstance(typeFromPlug, new object[] { "imap.gmail.com", "login", "password", 993 });

                    // Récupération de la méthode
                    var method = typeFromPlug.GetMethod("DoAction");

                    //Execution de la méthode et retour du cast
                    return (PlugResponse) method.Invoke(plug, new object[] { call });
                }

                response = new PlugResponse();
                // LOAD DLL
            }

            // Création de l'objet PlugCall
            // Lancement de la méthode concernée
            // Si non
            // Indiquer aucune commande correspondante.

            return null;
        }