public TestXmlLog GetLogInXml(string sPath = "")
 {
     if (sPath == "")
     {
         sPath = AppDomain.CurrentDomain.BaseDirectory + "LogDebugAsXML.Log";
     }
     if (File.Exists(sPath))
     {
         StreamReader streamReader = new StreamReader(sPath);
         string       text         = streamReader.ReadToEnd();
         streamReader.Close();
         text += "</listXmlLineLog></TestXmlLog>";
         try {
             testXmlLog = Serialization.DeserializeObject_UTF8 <TestXmlLog>(text);
         }
         catch (Exception ex) {
             testXmlLog = new TestXmlLog();
             testXmlLog.listXmlLineLog.Add(new XmlLineLog()
             {
                 dt = DateTime.Now, Sender = "InternalLOG", message = "Exception : " + ex.Message
             });
             return(testXmlLog);
         }
     }
     else
     {
         testXmlLog = new TestXmlLog();
         testXmlLog.listXmlLineLog.Add(new XmlLineLog()
         {
             dt = DateTime.Now, Sender = "InternalLOG", message = "File Log not exist  "
         });
     }
     return(testXmlLog);
 }
        public ResultLogFile GetLogsFiltre(ParamFiltreLog paramFiltreLog)
        {
            ResultLogFile resultLogFile = new ResultLogFile()
            {
                listSenders = new List <string>(), listXmlLineLog = new List <XmlLineLog>()
            };
            TestXmlLog testXmlLog = GetLogInXml();

            List <XmlLineLog> listXmlLineLog = testXmlLog.listXmlLineLog;

            resultLogFile.listSenders.Add(""); // choix vide
            resultLogFile.listSenders = listXmlLineLog.Select(c => c.Sender).ToList().Distinct().ToList();

            if (paramFiltreLog.IsFiltreDate)
            {
                DateTime dtFiltreMin = paramFiltreLog.dtFiltre.Date;
                DateTime dtFiltreMax = dtFiltreMin.AddDays(1);
                listXmlLineLog = listXmlLineLog.Where(c => c.dt >= dtFiltreMin && c.dt <= dtFiltreMax).ToList();
            }
            if (paramFiltreLog.IsFiltreSender)
            {
                if (!string.IsNullOrEmpty(paramFiltreLog.SenderFiltre))
                {
                    listXmlLineLog = listXmlLineLog.Where(c => c.Sender == paramFiltreLog.SenderFiltre).ToList();
                }
                if (!string.IsNullOrEmpty(paramFiltreLog.SenderExclureFiltre))
                {
                    listXmlLineLog = listXmlLineLog.Where(c => c.Sender != paramFiltreLog.SenderExclureFiltre).ToList();
                }
            }
            resultLogFile.listXmlLineLog = listXmlLineLog;
            return(resultLogFile);
        }