Skip to content

Commit 1b36c80

Browse files
committed
Code Quality: Added comments for the IThumbnail contracts
1 parent e0fb9ae commit 1b36c80

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using Files.App.Data.Enums;
5-
64
namespace Files.App.Data.Contracts
75
{
6+
/// <summary>
7+
/// Stores and retrieves cached thumbnails.
8+
/// </summary>
89
public interface IThumbnailCache
910
{
11+
/// <summary>
12+
/// Retrieves a cached thumbnail.
13+
/// </summary>
14+
/// <returns>Thumbnail bytes, or null if not cached.</returns>
1015
Task<byte[]?> GetAsync(string path, int size, IconOptions options, CancellationToken ct);
1116

17+
/// <summary>
18+
/// Stores a thumbnail in the cache.
19+
/// </summary>
1220
Task SetAsync(string path, int size, IconOptions options, byte[] thumbnail, CancellationToken ct);
1321

22+
/// <summary>
23+
/// Gets the current cache size in bytes.
24+
/// </summary>
1425
Task<long> GetSizeAsync();
1526

27+
/// <summary>
28+
/// Reduces cache size to the specified target in bytes.
29+
/// </summary>
1630
Task EvictToSizeAsync(long targetSizeBytes);
1731

32+
/// <summary>
33+
/// Removes all cached thumbnails.
34+
/// </summary>
1835
Task ClearAsync();
1936
}
2037
}

src/Files.App/Data/Contracts/IThumbnailGenerator.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33

44
namespace Files.App.Data.Contracts
55
{
6+
/// <summary>
7+
/// Generates thumbnails for specific file types.
8+
/// </summary>
69
public interface IThumbnailGenerator
710
{
11+
/// <summary>
12+
/// Gets the file extensions this generator supports.
13+
/// </summary>
814
IEnumerable<string> SupportedTypes { get; }
915

16+
/// <summary>
17+
/// Generates a thumbnail for the specified path.
18+
/// </summary>
19+
/// <returns>Thumbnail bytes, or null if generation fails.</returns>
1020
Task<byte[]?> GenerateAsync(
1121
string path,
1222
int size,

src/Files.App/Data/Contracts/IThumbnailService.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,40 @@
33

44
namespace Files.App.Data.Contracts
55
{
6+
/// <summary>
7+
/// Provides thumbnail retrieval and cache management.
8+
/// </summary>
69
public interface IThumbnailService
710
{
11+
/// <summary>
12+
/// Gets a thumbnail for the specified path.
13+
/// </summary>
14+
/// <returns>Thumbnail bytes, or null if unavailable.</returns>
815
Task<byte[]?> GetThumbnailAsync(
916
string path,
1017
int size,
1118
bool isFolder,
1219
IconOptions options = IconOptions.None,
1320
CancellationToken ct = default);
1421

22+
/// <summary>
23+
/// Registers a thumbnail generator.
24+
/// </summary>
1525
void RegisterGenerator(IThumbnailGenerator generator);
1626

27+
/// <summary>
28+
/// Clears all cached thumbnails.
29+
/// </summary>
1730
Task ClearCacheAsync();
1831

32+
/// <summary>
33+
/// Gets the current cache size in bytes.
34+
/// </summary>
1935
Task<long> GetCacheSizeAsync();
2036

37+
/// <summary>
38+
/// Reduces cache size to the specified target in bytes.
39+
/// </summary>
2140
Task EvictCacheAsync(long targetSizeBytes);
2241
}
2342
}

0 commit comments

Comments
 (0)