private void BtnDone_Click(object sender, EventArgs e)
        {
            if (rdoRegex.Checked)
            {
                try
                {
                    Regex r = new Regex(TxtUserInput.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("Not a valid Regex");
                    return;
                }
            }

            if (rdoExact.Checked)
                ResultFilter = new StringMatching(StringMatchingMode.Exact, TxtUserInput.Text);
            else if (RdoStartsWith.Checked)
                ResultFilter = new StringMatching(StringMatchingMode.StartsWith, TxtUserInput.Text);
            else if (rdoContains.Checked)
                ResultFilter = new StringMatching(StringMatchingMode.Contains, TxtUserInput.Text);
            else if (rdoEndsWith.Checked)
                ResultFilter = new StringMatching(StringMatchingMode.EndsWith, TxtUserInput.Text);
            else if (rdoRegex.Checked)
                ResultFilter = new StringMatching(StringMatchingMode.Regex, TxtUserInput.Text);
            else
            {
                MessageBox.Show("Not a valid mode");
                return;
            }

            DialogResult = DialogResult.OK;
        }
        public StringMatchingFilterDialog(StringMatching existingFilter)
        {
            m_existingFilter = existingFilter;
            InitializeComponent();

            TxtUserInput.Text = m_existingFilter.MatchText;
            switch (m_existingFilter.MatchMode)
            {
                case StringMatchingMode.Exact:
                    rdoExact.Checked = true;
                    break;
                case StringMatchingMode.StartsWith:
                    RdoStartsWith.Checked = true;
                    break;
                case StringMatchingMode.Contains:
                    rdoContains.Checked = true;
                    break;
                case StringMatchingMode.EndsWith:
                    rdoEndsWith.Checked = true;
                    break;
                case StringMatchingMode.Regex:
                    rdoRegex.Checked = true;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
 public LogMessageFilter(Stream stream)
 {
     byte version = stream.ReadNextByte();
     switch (version)
     {
         case 1:
             FilterLevel = (FilterLevel)stream.ReadNextByte();
             if (stream.ReadBoolean())
                 TimeFilter = new TimestampMatching(stream);
             if (stream.ReadBoolean())
                 Classification = new EnumMatchingFlags(stream);
             if (stream.ReadBoolean())
                 Level = new EnumMatchingFlags(stream);
             if (stream.ReadBoolean())
                 Flags = new EnumMatchingFlags(stream);
             if (stream.ReadBoolean())
                 Assembly = new StringMatching(stream);
             if (stream.ReadBoolean())
                 Type = new StringMatching(stream);
             if (stream.ReadBoolean())
                 RelatedType = new StringMatching(stream);
             if (stream.ReadBoolean())
                 StackDetails = new StackDetailsMatching(stream);
             if (stream.ReadBoolean())
                 StackTraceDetails = new StackTraceMatching(stream);
             if (stream.ReadBoolean())
                 EventName = new StringMatching(stream);
             if (stream.ReadBoolean())
                 MessageText = new StringMatching(stream);
             if (stream.ReadBoolean())
                 DetailsText = new StringMatching(stream);
             if (stream.ReadBoolean())
                 ExceptionText = new StringMatching(stream);
             break;
         default:
             throw new VersionNotFoundException();
     }
 }
Пример #4
0
        public LogMessageFilter(Stream stream)
        {
            byte version = stream.ReadNextByte();

            switch (version)
            {
            case 1:
                FilterLevel = (FilterLevel)stream.ReadNextByte();
                if (stream.ReadBoolean())
                {
                    TimeFilter = new TimestampMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    Classification = new EnumMatchingFlags(stream);
                }
                if (stream.ReadBoolean())
                {
                    Level = new EnumMatchingFlags(stream);
                }
                if (stream.ReadBoolean())
                {
                    Flags = new EnumMatchingFlags(stream);
                }
                if (stream.ReadBoolean())
                {
                    Assembly = new StringMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    Type = new StringMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    RelatedType = new StringMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    StackDetails = new StackDetailsMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    StackTraceDetails = new StackTraceMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    EventName = new StringMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    MessageText = new StringMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    DetailsText = new StringMatching(stream);
                }
                if (stream.ReadBoolean())
                {
                    ExceptionText = new StringMatching(stream);
                }
                break;

            default:
                throw new VersionNotFoundException();
            }
        }