Skip to content

Commit 387d579

Browse files
Copilotgfs
andcommitted
Rename CustomAsyncExtractorInterface to ICustomAsyncExtractor per code review
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
1 parent be00882 commit 387d579

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ catch(OverflowException)
167167
<br/>
168168
You can extend RecursiveExtractor with custom extractors to support additional archive or file formats not natively supported. This is useful for formats like MSI, MSP, or other proprietary archive formats.
169169

170-
To create a custom extractor, implement the `CustomAsyncExtractorInterface` interface and register it with the extractor:
170+
To create a custom extractor, implement the `ICustomAsyncExtractor` interface and register it with the extractor:
171171

172172
```csharp
173173
using Microsoft.CST.RecursiveExtractor;
@@ -177,7 +177,7 @@ using System.Collections.Generic;
177177
using System.Linq;
178178

179179
// Example: Custom extractor for a hypothetical archive format with magic bytes "MYARC"
180-
public class MyCustomExtractor : CustomAsyncExtractorInterface
180+
public class MyCustomExtractor : ICustomAsyncExtractor
181181
{
182182
private readonly Extractor context;
183183
private static readonly byte[] MAGIC_BYTES = System.Text.Encoding.ASCII.GetBytes("MYARC");

RecursiveExtractor.Tests/ExtractorTests/CustomExtractorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class CustomExtractorTests
1616
/// A simple test custom extractor that extracts files with a specific magic number
1717
/// For testing purposes, it recognizes files starting with "CUSTOM1"
1818
/// </summary>
19-
private class TestCustomExtractor : CustomAsyncExtractorInterface
19+
private class TestCustomExtractor : ICustomAsyncExtractor
2020
{
2121
private readonly Extractor context;
2222
private static readonly byte[] MAGIC_BYTES = System.Text.Encoding.ASCII.GetBytes("CUSTOM1");
@@ -71,7 +71,7 @@ public async IAsyncEnumerable<FileEntry> ExtractAsync(FileEntry fileEntry, Extra
7171
/// <summary>
7272
/// A second test custom extractor that recognizes files starting with "CUSTOM2"
7373
/// </summary>
74-
private class SecondTestCustomExtractor : CustomAsyncExtractorInterface
74+
private class SecondTestCustomExtractor : ICustomAsyncExtractor
7575
{
7676
private readonly Extractor context;
7777
private static readonly byte[] MAGIC_BYTES = System.Text.Encoding.ASCII.GetBytes("CUSTOM2");

RecursiveExtractor/Extractor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public Extractor()
4545
/// Collection of custom extractors that can handle file types not natively supported.
4646
/// These are checked when a file type is detected as UNKNOWN.
4747
/// </summary>
48-
internal HashSet<CustomAsyncExtractorInterface> CustomExtractors { get; } = new HashSet<CustomAsyncExtractorInterface>();
48+
internal HashSet<ICustomAsyncExtractor> CustomExtractors { get; } = new HashSet<ICustomAsyncExtractor>();
4949

5050
/// <summary>
5151
/// Set up the Default Extractors compatible with this platform.
@@ -109,7 +109,7 @@ public void ClearExtractors()
109109
/// </summary>
110110
/// <param name="customExtractor">The custom extractor implementation to add.</param>
111111
/// <returns>True if the extractor was added, false if it was already present.</returns>
112-
public bool AddCustomExtractor(CustomAsyncExtractorInterface customExtractor)
112+
public bool AddCustomExtractor(ICustomAsyncExtractor customExtractor)
113113
{
114114
if (customExtractor == null)
115115
{
@@ -123,7 +123,7 @@ public bool AddCustomExtractor(CustomAsyncExtractorInterface customExtractor)
123123
/// </summary>
124124
/// <param name="customExtractor">The custom extractor to remove.</param>
125125
/// <returns>True if the extractor was removed, false if it was not found.</returns>
126-
public bool RemoveCustomExtractor(CustomAsyncExtractorInterface customExtractor)
126+
public bool RemoveCustomExtractor(ICustomAsyncExtractor customExtractor)
127127
{
128128
if (customExtractor == null)
129129
{
@@ -356,7 +356,7 @@ public async IAsyncEnumerable<FileEntry> ExtractAsync(string filename, byte[] ar
356356
/// </summary>
357357
/// <param name="fileEntry">The file entry to check.</param>
358358
/// <returns>A custom extractor that can handle the file, or null if none found.</returns>
359-
private CustomAsyncExtractorInterface? FindMatchingCustomExtractor(FileEntry fileEntry)
359+
private ICustomAsyncExtractor? FindMatchingCustomExtractor(FileEntry fileEntry)
360360
{
361361
foreach (var customExtractor in CustomExtractors)
362362
{

RecursiveExtractor/Extractors/CustomAsyncExtractorInterface.cs renamed to RecursiveExtractor/Extractors/ICustomAsyncExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.CST.RecursiveExtractor.Extractors
66
/// An interface for custom extractors that can determine if they can handle a given stream.
77
/// This allows library users to extend the extractor with support for additional archive types.
88
/// </summary>
9-
public interface CustomAsyncExtractorInterface : AsyncExtractorInterface
9+
public interface ICustomAsyncExtractor : AsyncExtractorInterface
1010
{
1111
/// <summary>
1212
/// Determines if this extractor can extract the given stream based on binary signatures or other criteria.

0 commit comments

Comments
 (0)