You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #506 from LogExperts/new_reader
This pull request introduces a new set of "Memory"-based interfaces and updates the `Column` and related classes to use `ReadOnlyMemory<char>` instead of `string` for improved performance and flexibility. It also adds new helper methods for memory-based string manipulation and updates unit tests accordingly. The changes are grouped into interface additions/updates, core class refactoring, and unit test adjustments.
**Interface additions and updates:**
* Introduced new interfaces: `IColumnMemory`, `IColumnizedLogLineMemory`, `IAutoLogLineMemoryColumnizerCallback`, `IColumnizerConfiguratorMemory`, and `IColumnizerPriorityMemory` to support `ReadOnlyMemory<char>`-based operations and memory-efficient log processing. [[1]](diffhunk://#diff-eaf296844edf561a63b84b9ef2b8c924f4b8fad5be46d0a9fb1bbfbeabc5252aR1-R14) [[2]](diffhunk://#diff-e02515e0983411eb71e6aa95f8763d2e05e49580c029d5a4ec321cf2ca6cac85R1-R12) [[3]](diffhunk://#diff-e5cc913c39aac5f822d1a787dfcd6e87d7ece16c3488ef503a37e9c8a692aa0dR1-R11) [[4]](diffhunk://#diff-f76163582848504aa13c43d097cb606347dfd67fff88d79e941b7c86a2195be1R1-R33) [[5]](diffhunk://#diff-5820099353f1719a29f19a82fd07602bf7ee6c4c447716e0941d3a709a322845R1-R18)
* Updated existing interfaces and consumers to provide backward compatibility via `[Obsolete]` members and to reference new memory-based types where appropriate, such as in `IColumnizedLogLine` and `IContextMenuEntry`. [[1]](diffhunk://#diff-4e43acad58ef97a690c3d2fb084f7404e1b8966b32cdb4f3ab0f061f69881102L3-R15) [[2]](diffhunk://#diff-3ab334a54d4cee00572d2fc337cf3f7d2a32714743067dc0e31cf4c513204335L35-R37) [[3]](diffhunk://#diff-3ab334a54d4cee00572d2fc337cf3f7d2a32714743067dc0e31cf4c513204335L49-R51)
**Core class refactoring:**
* Refactored the `Column` class and related factory methods to operate on `ReadOnlyMemory<char>` instead of `string`, updated the replacement pipeline to use memory-based functions, and added private helpers for tab, truncation, and null character replacement. [[1]](diffhunk://#diff-ebd366a6ccebff87772fc1844a80b4d3d62420539e4d9d6a19d74b30a048c046L3-R5) [[2]](diffhunk://#diff-ebd366a6ccebff87772fc1844a80b4d3d62420539e4d9d6a19d74b30a048c046L13-R20) [[3]](diffhunk://#diff-ebd366a6ccebff87772fc1844a80b4d3d62420539e4d9d6a19d74b30a048c046L29-R86) [[4]](diffhunk://#diff-ebd366a6ccebff87772fc1844a80b4d3d62420539e4d9d6a19d74b30a048c046L74-R97) [[5]](diffhunk://#diff-ebd366a6ccebff87772fc1844a80b4d3d62420539e4d9d6a19d74b30a048c046L102-R128) [[6]](diffhunk://#diff-ebd366a6ccebff87772fc1844a80b4d3d62420539e4d9d6a19d74b30a048c046L121-R230)
* Updated `ColumnizedLogLine` to implement the new memory-based interface and expose both old and new properties for compatibility.
**Unit test adjustments:**
* Updated unit tests in `ColumnTests.cs` to use `AsMemory()` for test values and to call `.ToString()` when checking `DisplayValue` for string assertions. Also added suppression attributes for globalization warnings in tests. [[1]](diffhunk://#diff-0360b593d6854dd1529b1803a960513e97d09daed09033e70748b6dfc35aa4a5L47-R47) [[2]](diffhunk://#diff-0360b593d6854dd1529b1803a960513e97d09daed09033e70748b6dfc35aa4a5L60-R61) [[3]](diffhunk://#diff-0360b593d6854dd1529b1803a960513e97d09daed09033e70748b6dfc35aa4a5L72-R72) [[4]](diffhunk://#diff-0360b593d6854dd1529b1803a960513e97d09daed09033e70748b6dfc35aa4a5R83-R88) [[5]](diffhunk://#diff-0360b593d6854dd1529b1803a960513e97d09daed09033e70748b6dfc35aa4a5R107-R112)
**General codebase cleanup:**
* Removed unused `using` statements from several interface files for clarity and maintainability. [[1]](diffhunk://#diff-14fa0b69b47a0ea7de5d351a09d989c6f1725c7c23145f269a73b70a40312513L1-L5) [[2]](diffhunk://#diff-18d4b090367c70b89766d89c953aedf0dce8eb04edc10724a6d4b2c2f1fc384dL1-L5) [[3]](diffhunk://#diff-bf531b4bca29ffb50a7baa5fa171d4dc636eb26edc1a013f2ba089e826cf2e15L1-L4)
* Added or improved XML documentation comments on interfaces for better code documentation. [[1]](diffhunk://#diff-9bbe6cc05b779d408640f0ef6cd92063a47c2967f35614249f8a2ca92730f0c8L1-R8) [[2]](diffhunk://#diff-5820099353f1719a29f19a82fd07602bf7ee6c4c447716e0941d3a709a322845R1-R18)
These changes collectively modernize the columnizer infrastructure to be more memory-efficient and extensible, paving the way for future performance improvements and better support for large log files.
// Allocate new buffer: original length + (tabCount * 1) since we replace 1 char with 2
173
+
varnewLength=input.Length+tabCount;
174
+
varbuffer=newchar[newLength];
175
+
varbufferPos=0;
176
+
177
+
for(vari=0;i<span.Length;i++)
178
+
{
179
+
if(span[i]=='\t')
180
+
{
181
+
buffer[bufferPos++]=' ';
182
+
buffer[bufferPos++]=' ';
183
+
}
184
+
else
185
+
{
186
+
buffer[bufferPos++]=span[i];
187
+
}
188
+
}
189
+
190
+
returnbuffer;
191
+
}
192
+
193
+
/// <summary>
194
+
/// Shortens the memory buffer to the specified maximum length and appends "...".
195
+
/// </summary>
196
+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization","CA1303:Do not pass literals as localized parameters",Justification="Non Localiced Parameter")]
0 commit comments