Exemple #1
0
        private void LoadRootAttributes()
        {
            if (bool.TryParse(Log4NetNode.Attributes[Log4NetXmlConstants.Debug]?.Value, out bool debugResult) && debugResult)
            {
                Debug = true;
            }
            else
            {
                Debug = false;
            }

            if (Enum.TryParse(Log4NetNode.Attributes[Log4NetXmlConstants.Update]?.Value, out Update update) && Equals(update, Update.Overwrite))
            {
                Update = Update.Overwrite;
            }
            else
            {
                Update = Update.Merge;
            }

            if (Log4NetUtilities.TryParseLevel(Log4NetNode.Attributes[Log4NetXmlConstants.Threshold]?.Value, out Level levelResult) && !Equals(levelResult, Level.All))
            {
                Threshold = levelResult;
            }
            else
            {
                Threshold = Level.All;
            }
        }
 protected void TryLoadSelectedLevel(string level)
 {
     if (Log4NetUtilities.TryParseLevel(level, out Level match))
     {
         SelectedValue = match.Name;
     }
 }
Exemple #3
0
        private void ParseNode()
        {
            string level     = Node.GetValueAttributeValueFromChildElement(LevelName);
            string foreColor = Node.GetValueAttributeValueFromChildElement(ForeColorName);
            string backColor = Node.GetValueAttributeValueFromChildElement(BackColorName);

            if (string.IsNullOrEmpty(level) || !Log4NetUtilities.TryParseLevel(level, out Level parsedLevel))
            {
                return;
            }

            Level = parsedLevel;
            OnPropertyChanged(nameof(Level));

            if (Enum.TryParse(foreColor, out ConsoleColor foreParsed))
            {
                ForeColor = foreParsed;
                OnPropertyChanged(nameof(ForeColor));
            }

            if (Enum.TryParse(backColor, out ConsoleColor backParsed))
            {
                BackColor = backParsed;
                OnPropertyChanged(nameof(BackColor));
            }
        }