1- using Newtonsoft . Json ;
2-
3- using System ;
4- using System . Drawing ;
5- using System . Text . RegularExpressions ;
6-
7- namespace LogExpert . Classes . Highlight
8- {
9- [ Serializable ]
10- [ method: JsonConstructor ]
11- public class HilightEntry ( ) : ICloneable
12- {
13- #region Fields
14-
15- [ NonSerialized ] private Regex regex = null ;
16-
17- private string _searchText = string . Empty ;
18-
19- #endregion Fields
20-
21- #region Properties
22-
23- public bool IsStopTail { get ; set ; }
24-
25- public bool IsSetBookmark { get ; set ; }
26-
27- public bool IsRegEx { get ; set ; }
28-
29- public bool IsCaseSensitive { get ; set ; }
30-
31- public Color ForegroundColor { get ; set ; }
32-
33- public Color BackgroundColor { get ; set ; }
34-
35- public string SearchText
36- {
37- get => _searchText ;
38- set
39- {
40- _searchText = value ;
41- regex = null ;
42- }
43- }
44-
45- public bool IsLedSwitch { get ; set ; }
46-
47- public ActionEntry ActionEntry { get ; set ; }
48-
49- public bool IsActionEntry { get ; set ; }
50-
51- public string BookmarkComment { get ; set ; }
52-
53- public Regex Regex
54- {
55- get
56- {
57- if ( regex == null )
58- {
59- if ( IsRegEx )
60- {
61- regex = new Regex ( SearchText , IsCaseSensitive ? RegexOptions . None : RegexOptions . IgnoreCase ) ;
62- }
63- else
64- {
65- regex = new Regex ( Regex . Escape ( SearchText ) , IsCaseSensitive ? RegexOptions . None : RegexOptions . IgnoreCase ) ;
66- }
67- }
68- return regex ;
69- }
70- }
71-
72- public bool IsWordMatch { get ; set ; }
73-
74- // highlightes search result
75- [ field: NonSerialized ]
76- public bool IsSearchHit { get ; set ; }
77-
78- public bool IsBold { get ; set ; }
79-
80- public bool NoBackground { get ; set ; }
81-
82- public object Clone ( )
83- {
84- var highLightEntry = new HilightEntry
85- {
86- SearchText = SearchText ,
87- ForegroundColor = ForegroundColor ,
88- BackgroundColor = BackgroundColor ,
89- IsRegEx = IsRegEx ,
90- IsCaseSensitive = IsCaseSensitive ,
91- IsLedSwitch = IsLedSwitch ,
92- IsStopTail = IsStopTail ,
93- IsSetBookmark = IsSetBookmark ,
94- IsActionEntry = IsActionEntry ,
95- ActionEntry = ActionEntry != null ? ( ActionEntry ) ActionEntry . Clone ( ) : null ,
96- IsWordMatch = IsWordMatch ,
97- IsBold = IsBold ,
98- BookmarkComment = BookmarkComment ,
99- NoBackground = NoBackground ,
100- IsSearchHit = IsSearchHit
101- } ;
102-
103- return highLightEntry ;
104- }
105-
106- #endregion Properties
107- }
1+ using Newtonsoft . Json ;
2+
3+ using System ;
4+ using System . Drawing ;
5+ using System . Text . RegularExpressions ;
6+
7+ namespace LogExpert . Classes . Highlight
8+ {
9+ [ Serializable ]
10+ [ method: JsonConstructor ]
11+ public class HighlightEntry ( ) : ICloneable
12+ {
13+ #region Fields
14+
15+ [ NonSerialized ] private Regex regex = null ;
16+
17+ private string _searchText = string . Empty ;
18+
19+ #endregion Fields
20+
21+ #region Properties
22+
23+ public bool IsStopTail { get ; set ; }
24+
25+ public bool IsSetBookmark { get ; set ; }
26+
27+ public bool IsRegEx { get ; set ; }
28+
29+ public bool IsCaseSensitive { get ; set ; }
30+
31+ public Color ForegroundColor { get ; set ; }
32+
33+ public Color BackgroundColor { get ; set ; }
34+
35+ public string SearchText
36+ {
37+ get => _searchText ;
38+ set
39+ {
40+ _searchText = value ;
41+ regex = null ;
42+ }
43+ }
44+
45+ public bool IsLedSwitch { get ; set ; }
46+
47+ public ActionEntry ActionEntry { get ; set ; }
48+
49+ public bool IsActionEntry { get ; set ; }
50+
51+ public string BookmarkComment { get ; set ; }
52+
53+ public Regex Regex
54+ {
55+ get
56+ {
57+ if ( regex == null )
58+ {
59+ if ( IsRegEx )
60+ {
61+ regex = new Regex ( SearchText , IsCaseSensitive ? RegexOptions . None : RegexOptions . IgnoreCase ) ;
62+ }
63+ else
64+ {
65+ regex = new Regex ( Regex . Escape ( SearchText ) , IsCaseSensitive ? RegexOptions . None : RegexOptions . IgnoreCase ) ;
66+ }
67+ }
68+ return regex ;
69+ }
70+ }
71+
72+ public bool IsWordMatch { get ; set ; }
73+
74+ // highlightes search result
75+ [ field: NonSerialized ]
76+ public bool IsSearchHit { get ; set ; }
77+
78+ public bool IsBold { get ; set ; }
79+
80+ public bool NoBackground { get ; set ; }
81+
82+ public object Clone ( )
83+ {
84+ var highLightEntry = new HighlightEntry
85+ {
86+ SearchText = SearchText ,
87+ ForegroundColor = ForegroundColor ,
88+ BackgroundColor = BackgroundColor ,
89+ IsRegEx = IsRegEx ,
90+ IsCaseSensitive = IsCaseSensitive ,
91+ IsLedSwitch = IsLedSwitch ,
92+ IsStopTail = IsStopTail ,
93+ IsSetBookmark = IsSetBookmark ,
94+ IsActionEntry = IsActionEntry ,
95+ ActionEntry = ActionEntry != null ? ( ActionEntry ) ActionEntry . Clone ( ) : null ,
96+ IsWordMatch = IsWordMatch ,
97+ IsBold = IsBold ,
98+ BookmarkComment = BookmarkComment ,
99+ NoBackground = NoBackground ,
100+ IsSearchHit = IsSearchHit
101+ } ;
102+
103+ return highLightEntry ;
104+ }
105+
106+ #endregion Properties
107+ }
108108}
0 commit comments