public LogQueue()
        {
            configuration = LoggerConfiguration.Read();

            queue = new List<Line>();

            queueTimer = new System.Timers.Timer();
            queueTimer.Interval = Math.Max(500, configuration.QueueWriteInterval);
            queueTimer.Elapsed += queue_TIMER_Elapsed;
            queueTimer.Enabled = true;
        }
        private void Save()
        {
            var config = new LoggerConfiguration();
            config.QueueWriteInterval = QueueWriteInterval;

            config.Debug = DebugEnabled;
            config.Error = ErrorEnabled;
            config.Notification = NotificationEnabled;
            config.Warning = WarningEnabled;

            config.DebugRecycleDays = GetDaysFromMilliseconds(DebugRecycleDays);
            config.ErrorRecycleDays = GetDaysFromMilliseconds(ErrorRecycleDays);
            config.NotificationRecycleDays = GetDaysFromMilliseconds(NotificationRecycleDays);
            config.WarningRecycleDays = GetDaysFromMilliseconds(WarningRecycleDays);

            LoggerConfiguration.Create(config);
        }
 private void Watcher_Changed(object sender, FileSystemEventArgs e)
 {
     configuration = LoggerConfiguration.Read();
 }
 private void Watcher_Changed(object sender, FileSystemEventArgs e)
 {
     configuration = LoggerConfiguration.Read();
 }
        private static XmlDocument CreateDocument(LoggerConfiguration config)
        {
            var result = new XmlDocument();

            XmlNode docNode = result.CreateXmlDeclaration("1.0", "UTF-8", null);
            result.AppendChild(docNode);

            XmlNode root = result.CreateElement("LoggerConfiguration");
            result.AppendChild(root);

            foreach (var info in typeof(LoggerConfiguration).GetProperties())
            {
                XmlNode node = result.CreateElement(info.Name);
                var val = info.GetValue(config, new object[] { });
                if (val != null) node.InnerText = val.ToString();
                root.AppendChild(node);
            }

            return result;
        }
        public static LoggerConfiguration Read()
        {
            var result = new LoggerConfiguration();

            if (File.Exists(ConfigFilePath))
            {
                try
                {
                    var xml = new XmlDocument();
                    xml.Load(ConfigFilePath);

                    foreach (XmlNode node in xml.DocumentElement.ChildNodes)
                    {
                        if (node.NodeType == XmlNodeType.Element)
                        {
                            if (node.InnerText != "")
                            {
                                Type Settings = typeof(LoggerConfiguration);
                                PropertyInfo info = Settings.GetProperty(node.Name);

                                if (info != null)
                                {
                                    Type t = info.PropertyType;
                                    info.SetValue(result, Convert.ChangeType(node.InnerText, t), null);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex) { Logger.Log("Exception :: " + ex.Message); }
            }

            return result;
        }
        //public static string ConfigFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CONFIG_FILENAME);
        public static bool Create(LoggerConfiguration config)
        {
            bool result = false;

            Remove();

            if (config != null)
            {
                var xml = CreateDocument(config);
                Files.WriteDocument(xml, ConfigFilePath);
            }

            return result;
        }