public override void CommitLogEvent(LogEvent logEvent) { if (nextLog == -1) GetNextLogNumber(); string fileName = GetFileName(); if (!File.Exists(fileName)) { log = new XmlLog(); } else if( log == null ) { log = new XmlLog(); DefaultConfiguration.TryFromXml<XmlLog>(log, fileName); } if (log.LogEvents.Length >= entriesPerFile) { DefaultConfiguration.ToXml(log, fileName); nextLog++; CommitLogEvent(logEvent); return; } log.AddEvent(logEvent); FileInfo info = new FileInfo(fileName); if (!info.Directory.Exists) { info.Directory.Create(); } DefaultConfiguration.ToXml(log, fileName); }
private void GetNextLogNumber() { //string fileName = this.LogLocation + "\\" + this.LogName + "_"; int check = 0; while (nextLog == -1) { string currentCheckFile = GetCheckFile(check); if (!File.Exists(currentCheckFile)) { nextLog = check; } else { XmlLog checkLog = new XmlLog(); DefaultConfiguration.TryFromXml <XmlLog>(checkLog, currentCheckFile); //checkLog.TryFromXml<XmlLog>(currentCheckFile); if (checkLog.LogEvents.Length < entriesPerFile) { nextLog = check; } } check++; } }
public override void CommitLogEvent(LogEvent logEvent) { if (nextLog == -1) { GetNextLogNumber(); } string fileName = GetFileName(); if (!File.Exists(fileName)) { log = new XmlLog(); } else if (log == null) { log = new XmlLog(); DefaultConfiguration.TryFromXml <XmlLog>(log, fileName); } if (log.LogEvents.Length >= entriesPerFile) { DefaultConfiguration.ToXml(log, fileName); nextLog++; CommitLogEvent(logEvent); return; } log.AddEvent(logEvent); FileInfo info = new FileInfo(fileName); if (!info.Directory.Exists) { info.Directory.Create(); } DefaultConfiguration.ToXml(log, fileName); }
private void GetNextLogNumber() { //string fileName = this.LogLocation + "\\" + this.LogName + "_"; int check = 0; while (nextLog == -1) { string currentCheckFile = GetCheckFile(check); if (!File.Exists(currentCheckFile)) nextLog = check; else { XmlLog checkLog = new XmlLog(); DefaultConfiguration.TryFromXml<XmlLog>(checkLog, currentCheckFile); //checkLog.TryFromXml<XmlLog>(currentCheckFile); if (checkLog.LogEvents.Length < entriesPerFile) nextLog = check; } check++; } }
public static bool TryFromXml(string filePath, out XmlLog log) { log = new XmlLog(); return DefaultConfiguration.TryFromXml<XmlLog>(log, filePath); }
public static bool TryFromXml(string filePath, out XmlLog log) { log = new XmlLog(); return(DefaultConfiguration.TryFromXml <XmlLog>(log, filePath)); }