public RepOperationLog OperationLog(ParamOperationLog paramOperationLog)
        {
            RepOperationLog repOperationLog = new RepOperationLog();

            try {
                if (paramOperationLog.sAction == "Delete")
                {
                    string sPath = AppDomain.CurrentDomain.BaseDirectory + "LogDebugAsXML.Log";
                    if (File.Exists(sPath))
                    {
                        DateTime dt        = DateTime.Now;
                        string   Suffixe   = dt.DayOfYear.ToString() + "-" + dt.Hour.ToString() + "-" + dt.Minute.ToString() + "-" + dt.Second.ToString();
                        string   sPathSave = AppDomain.CurrentDomain.BaseDirectory + "LogDebugAsXML" + Suffixe + "Log.xml";
                        //File.Copy(sPath, sPathSave);
                        ConvertToXMLCompliantAndSaveFileAs(sPathSave);  // on sauve le log direct en xml
                        File.Delete(sPath);
                        // On recree le fichier log..
                        fichierLog = new FichierLog(sPathLogFile, FichierLog.EModeCreation.Creation);  // ce constructeur va formatter le début du fichier log si necessaire
                        repOperationLog.sMessage = "Copy Log to : " + sPathSave;
                    }
                }
                if (paramOperationLog.sAction == "TestLog")
                {
                    AjouteLog("SenderTest", "TestLog");
                    repOperationLog.sMessage = "Ajout TestLog ";
                }
            }
            catch (Exception ex) {
                repOperationLog.sMessage = "OperationLog : " + ex.Message;
            }
            return(repOperationLog);
        }
 protected SingleLogFileAsXml()
 {
     if (fichierLog == null)
     {
         fichierLog = new FichierLog(sPathLogFile, FichierLog.EModeCreation.Creation);  // ce constructeur va formatter le début du fichier log si necessaire
     }
 }
        // Ici on se fait une copy du fichier de log que l'on formatte pour etre directement exploitable en desérialisation
        public void ConvertToXMLCompliantAndSaveFileAs(string sPathDestination, string sPathOrigine = "")
        {
            if (sPathOrigine == "")
            {
                sPathOrigine = sPathLogFile;
            }
            File.Copy(sPathOrigine, sPathDestination, true);
            FichierLog fichierLogDestination = new FichierLog(sPathDestination, FichierLog.EModeCreation.Recopie);  // ce constructeur va formatter le début du fichier log si necessaire

            fichierLogDestination.AjouteLogSimple("\t</listXmlLineLog>");
            fichierLogDestination.AjouteLogSimple("</TestXmlLog>");
            //string sRep = "";
            //TestXmlLog test = (TestXmlLog)Serialization.DeSerializeObjectFromPath(typeof(TestXmlLog), sPathDestination, ref sRep);
        }
Esempio n. 4
0
 protected SingleLogFile(string sPathName)
 {
     sPathLogFile = sPathName;
     fichierLog   = new FichierLog(sPathLogFile, "#####################################################  Log   ###########################################################\n\r####################################################################################################################################################", 2);
 }