-
Notifications
You must be signed in to change notification settings - Fork 183
Fix/MultiFile pattern (Issue #696) #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,9 +238,10 @@ private string EscapeNonvarRegions (string formatString) | |
| } | ||
| } | ||
|
|
||
| _ = result.Append(Regex.Escape(segment.ToString())); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Index parsing from a rotated file is still broken. Spec: "app.1.log → Rotated log (Index 1)". RolloverFilenameHandler calls SetFileName on whatever file the user opens; for $J(.).log the regex .(?'index'\d*).log has a greedy .* that swallows the digit in app.1.log, so Index parses as 0 and BuildFileName would produce app.1.1.log. Grouping only works when the active file (app.log) is opened. The same flaw pre-exists for *$J(.) with app.log.1, so it's parity rather than a regression — so the index mapping is only partially delivered. |
||
| fmt = result.ToString().Replace('\xFFFD', '*'); | ||
| return fmt; | ||
| } | ||
|
|
||
| #endregion | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1680,12 +1680,16 @@ Ein ausgewähltes Tool erscheint in der Iconbar. Alle anderen verfügbaren Tools | |
| <value>Muster syntax: | ||
|
|
||
| * = alle Zeichen (wildcard) | ||
| $D(&lt;date&gt;) = Datumsmuster | ||
| $D(<date>) = Datumsmuster | ||
| $I = Dateiindexnummer | ||
| $J = Dateiindexnummer, versteckt wenn 09 | ||
| $J(&lt;prefix&gt;) = Wie $J, jedoch wird ein &lt;prefix&gt; hinzugefügt when es nicht 0 ist | ||
| $J(<prefix>) = Wie $J, jedoch wird ein <prefix> hinzugefügt when es nicht 0 ist | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wenn |
||
|
|
||
| &lt;date&gt;: | ||
| Beispiele: | ||
| *$J(.) → app.log, app.log.1, app.log.2 | ||
| *$J(.).log → app.log, app.1.log, app.2.log | ||
|
|
||
| <date>: | ||
| DD = Tag | ||
| MM = Monat | ||
| YY[YY] = Jahr | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ public void TestFilename1(string expectedResult, string formatString) | |
| [TestCase("engine.log", "engine1.log","engine$J.log")] | ||
| [TestCase("engine1.log", "engine2.log","engine$J.log")] | ||
| [TestCase("engine.log", "engine.log.1","*$J(.)")] | ||
| [TestCase("engine.log", "engine.1.log", "*$J(.).log")] | ||
| [TestCase("engine_2010-06-12.log", "engine_2010-06-12.log.1", "*$D(yyyy-MM-dd).log$J(.)")] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $I untested. For "$J, $I" support, the fix itself generalizes, but no test covers $I or $D followed by a trailing literal (e.g. *$D(yyyy-MM-dd)$J(.).log).
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ParseFormatString computes datePos from the original string but edits the escaped one — a literal with regex metachars before $D (e.g. app.$D(yyyy-MM-dd)) corrupts the regex. Not introduced here, but the new trailing-literal support makes such patterns likelier. |
||
| public void TestFilenameAnd1(string fileName, string expectedResult, string formatString) | ||
| { | ||
|
|
@@ -45,6 +46,7 @@ public void TestFilenameAnd1(string fileName, string expectedResult, string form | |
| [Test] | ||
| [TestCase("engine.log", "engine.log.2","*$J(.)")] | ||
| [TestCase("engine.log", "engine.log.2","*.log$J(.)")] | ||
| [TestCase("engine.log", "engine.2.log", "*$J(.).log")] | ||
| public void TestFilenameAnd2(string fileName, string expectedResult, string formatString) | ||
| { | ||
| RolloverFilenameBuilder fnb = new(formatString); | ||
|
|
@@ -65,4 +67,4 @@ public void TestFilenameMinus1(string fileName, string expectedResult, string fo | |
| var name = fnb.BuildFileName(); | ||
| Assert.That(name, Is.EqualTo("engine.log")); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| app.1.log |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| app.2.log |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated Code — [RolloverFilenameBuilder.cs:241] is the exact shape of the state-0 flush at line 202. A tiny local FlushEscaped() would let both share it